svcadm(1M)을 검색하려면 섹션에서 1M 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
scf_handle_decode_fmri(3scf)
Service Configuration Facility Library Functions
scf_handle_decode_fmri(3SCF)
NAME
scf_handle_decode_fmri, scf_scope_to_fmri, scf_service_to_fmri,
scf_instance_to_fmri, scf_pg_to_fmri, scf_property_to_fmri,
scf_name_to_fmri, scf_name_nested_pg_to_fmri - convert between objects
and FMRIs in the Service Configuration Facility
SYNOPSIS
cc [ flags... ] file... -lscf [ library... ]
#include <libscf.h>
int scf_handle_decode_fmri(scf_handle_t *handle, const char *fmri,
scf_scope_t *scope, scf_service_t *service,
scf_instance_t *instance, scf_propertygroup_t *pg,
scf_property_t *property, int flags);
ssize_t scf_scope_to_fmri(const scf_scope_t *object,
char *buffer, size_t sz);
ssize_t scf_service_to_fmri(const scf_scope_t *object,
char *buffer, size_t sz);
ssize_t scf_instance_to_fmri(const scf_instance_t *inst,
char *buffer, size_t sz);
ssize_t scf_pg_to_fmri(const scf_propertygroup_t *pg, char *out,
size_t sz);
ssize_t scf_property_to_fmri(const scf_scope_t *object,
char *buffer, size_t sz);
ssize_t scf_name_to_fmri(const char *scope,
const char *fqdn, const char *service,
const char *instance, const char *pgname,
const char *propname, char *fmri,
size_t sz, int flags);
ssize_t scf_name_nested_pg_to_fmri(const char *scope,
const char *fqdn, const char *service,
const char *instance, const char *pgnames[],
int npgs, const char *propname, char *fmri,
size_t sz, int flags);
DESCRIPTION
The scf_handle_decode_fmri() function decodes an FMRI string into a set
of repository entries. Any number of the entity handles can be NULL.
The validation and decoding of the FMRI are determined by the flags
argument and by those arguments that are NULL.
If flags == 0, any FMRI is accepted as long as it is well-formed and
exists in the repository.
If SCF_DECODE_FMRI_EXACT is set in flags, the last part of the FMRI
must match the last non-null entity handle. For example, if property is
NULL and pg is non-null, the FMRI must be a property group FMRI.
If SCF_DECODE_FMRI_TRUNCATE is set in flags, there is no check for the
existence of any objects specified in the FMRI that follow the last
non-null entity handle. For example, if property is NULL, pg is non-
null, and a property FMRI is passed in, scf_handle_decode_fmri() suc‐
ceeds as long as the property group exists, even if the referenced
property does not exist.
If SCF_DECODE_FMRI_REQUIRE_INSTANCE (or
SCF_DECODE_FMRI_REQUIRE_NO_INSTANCE) is set in flags, then the FMRI
must (or must not) specify an instance.
If an error occurs, all of the entity handles that were passed to the
function are reset.
The scf_scope_to_fmri(), scf_service_to_fmri (),
scf_instance_to_fmri(), scf_pg_to_fmri (), and scf_property_to_fmri()
functions convert an entity handle to an FMRI. The scf_pg_to_fmri() and
scf_property_to_fmri() will perform any encoding required when they
convert the entity handle to an FMRI.
The scf_name_to_fmri() and scf_name_nested_pg_to_fmri() functions con‐
vert a given set of FMRI components (which may include the scope,
domain, service, instance, property group(s), and property) to a valid
FMRI which may be used with smf. This function will perform any encod‐
ing required when it builds the FMRI. When specifying the property
group hierarchy to scf_name_nested_pg_to_fmri(), specify each property
group in the array in the order in which the hierarchy should be tra‐
versed.
The scope is optional and may be omitted by specifying NULL. The fqdn
is optional and may be omitted by specifying NULL. If the instance is
NULL then the returned FMRI will be a service level FMRI rather than an
instance level FMRI. Specifying the instance requires that the service
must be specified. Specifying the propname requires that the pgname
must be specified.
The FMRI is returned through the fmri parameter whose length is speci‐
fied through the sz parameter. Specifying NULL for the fmri parameter
will cause scf_name_to_fmri() and scf_name_nested_pg_to_fmri() to
return the length of the FMRI without actually writing it to the fmri
parameter.
If SCF_ENCODE_FMRI_NO_SERVICE is set in flags, then the function may be
used to encode a property group name and a property name into a single
string separated by a slash. This is useful for creating a string
usable by the svccfg or svcprop utilities.
RETURN VALUES
Upon successful completion, scf_handle_decode_fmri() returns 0. Other‐
wise, it returns -1.
Upon successful completion, scf_scope_to_fmri(),
scf_service_to_fmri(), scf_instance_to_fmri(), scf_pg_to_fmri(),
scf_property_to_fmri(), scf_name_to_fmri() and
scf_name_nested_pg_to_fmri() return the length of the FMRI. The buffer
will be null-terminated if sz > 0, similar to strlcpy(3C). Otherwise,
they return -1 and the contents of buffer are undefined.
ERRORS
The scf_handle_decode_fmri() function will fail if:
SCF_ERROR_BACKEND_ACCESS
The storage mechanism that the repository server (svc.configd(8))
chose for the operation denied access.
SCF_ERROR_CONNECTION_BROKEN
The connection to the repository was lost.
SCF_ERROR_CONSTRAINT_VIOLATED
The FMRI does not meet the restrictions requested in the flags
argument.
SCF_ERROR_DELETED
The object argument refers to an object that has been deleted.
SCF_ERROR_HANDLE_MISMATCH
One or more of the entity handles was not derived from handle.
SCF_ERROR_INTERNAL
An internal error occurred.
SCF_ERROR_INVALID_ARGUMENT
The fmri argument is not a valid FMRI.
SCF_ERROR_NO_RESOURCES
The server does not have adequate resources to complete the
request.
SCF_ERROR_NOT_BOUND
The handle is not currently bound.
SCF_ERROR_NOT_FOUND
The FMRI is well-formed but there is no object in the repository
matching it.
SCF_ERROR_NOT_SET
Cannot use unset value.
The scf_scope_to_fmri(), scf_service_to_fmri (),
scf_instance_to_fmri(), scf_pg_to_fmri (), scf_property_to_fmri(),
scf_name_to_fmri() and scf_name_nested_pg_to_fmri() functions will fail
if:
SCF_ERROR_NOT_SET
The object argument is not currently set.
SCF_ERROR_DELETED
The object argument refers to an object that has been deleted.
SCF_ERROR_NOT_BOUND
The handle is not currently bound.
SCF_ERROR_CONNECTION_BROKEN
The connection to the repository was lost.
The scf_error(3SCF) function can be used to retrieve the error value.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelSafe
SEE ALSO
libscf(3LIB), scf_error(3SCF), attributes(7)
Oracle Solaris 11.4 06 Jan 2016
scf_handle_decode_fmri(3SCF)