/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <stdio.h>
#include <umem.h>
#include <assert.h>
#include <string.h>
#include <unistd.h>
#include <alloca.h>
#include <libuvfs_impl.h>
const char *
{
}
static void
{
return;
return;
}
/*
* This should succeed if we're an smf service, and fail otherwise.
* If it fails, fs_scf_props will be NULL. The caller will have to
* deal with this if it's expected to have the values.
*
* We always allocate memory for fs_daemon_fmri, even if we are not
* in a daemon process. That way, the buffer can be used in other
* places, e.g. launching an instance.
*/
fs->fs_daemon_fmri);
}
int
libuvfs_is_daemon(void)
{
int fmri_size;
char *fmri;
goto out;
if (scf_handle_bind(scf) != 0)
goto out;
goto out;
out:
return (is_daemon);
}
const char *
{
char *found_exec;
return (NULL);
}
"daemon");
return (NULL);
return (NULL);
if (found_exec == NULL)
return (NULL);
return (libuvfs_strdup(found_exec));
}
void
{
return;
}
return;
return;
}
static int
{
int type;
return (-1);
}
return (-1);
}
return (0);
}
static int
const char *val)
{
int rc;
/* protect against passing NULL as meaning "nothing" */
val = "";
if (rc == 0)
return (rc);
}
static int
{
int rc;
return (rc);
}
int
{
int rc;
rc = -1;
goto out;
}
rc = -1;
goto out;
}
rc = -1;
goto out;
}
if (rc != 0)
goto out;
if (error != SCF_ERROR_EXISTS) {
rc = -1;
goto out;
}
!= 0) {
rc = -1;
goto out;
}
}
if (rc != 0) {
if ((error != SCF_ERROR_EXISTS) ||
goto out;
}
if (rc != 0)
goto out;
if (rc != 0)
goto out;
if (rc != 0)
goto out;
if (rc != 0)
goto out;
if (rc != 0)
goto out;
if (rc != 0)
goto out;
rc = -1;
goto out;
}
if (rc == -1)
goto out;
if (rc == -1)
goto out;
out:
if (rc != 0)
}
return (rc);
}
void
{
exit(0);
exit(0);
}
void
libuvfs_daemon_atexit(void)
{
if (fs->fs_daemon_fmri)
}
int
{
char *inst_fmri;
int rc = 0;
return (-1);
if (rc != 0)
goto out;
if (rc != 0)
goto out;
char *state;
if (rc == -1)
continue;
"restarter", "state");
continue;
continue;
continue;
(void) scf_instance_delete(instance);
continue;
}
"general", "enabled");
continue;
continue;
continue;
if (*enabled)
continue;
(void) scf_instance_delete(instance);
}
out:
if (rc != 0)
return (rc);
}