Service Configuration Facility Library Functions
smfenableinstance(3SCF)
NAME
smfenableinstance, smfdisableinstance,
smfrefreshinstance, smfrestartinstance,
smfmaintaininstance, smfdegradeinstance,
smfrestoreinstance, smfgetstate - administrative inter-
face to the Service Configuration Facility
SYNOPSIS
cc [ flag... ] file... -lscf [ library... ]
#include
int smfenableinstance(const char *instance, int flags);
int smfdisableinstance(const char *instance, int flags);
int smfrefreshinstance(const char *instance);
int smfrestartinstance(const char *instance);
int smfmaintaininstance(const char *instance, int flags);
int smfdegradeinstance(const char *instance, int flags);
int smfrestoreinstance(const char *instance);
char *smfgetstate(const char *instance);
DESCRIPTION
These functions provide administrative control over service
instances. Using these functions, an administrative tool can
make a request to enable, disable, refresh, or restart an
instance. All calls are asynchronous. They request an
action, but do not wait to see if the action succeeds or
fails.
The smfenableinstance() function enables the service
instance specified by instance FMRI. If flags is
SMFTEMPORARY, the enabling of the service instance is a
temporary change, lasting only for the lifetime of the
current system instance. The flags argument is set to 0 if
no flags are to be use.
SunOS 5.11 Last change: 5 Nov 2007 1
Service Configuration Facility Library Functions
smfenableinstance(3SCF)
The smfdisableinstance() function places the service
instance specified by instance FMRI in the disabled state
and triggers the stop method (see svc.startd(1M)). If flags
is SMFTEMPORARY, the disabling of the service instance is a
temporary change, lasting only for the lifetime of the
current system instance. The flags argument is set to 0 if
no flags are to be use.
The smfrefreshinstance() function causes the service
instance specified by instance FMRI to re-read its confi-
guration information.
The smfrestartinstance() function restarts the service
instance specified by instance FMRI.
The smfmaintaininstance() function moves the service
instance specified by instance into the maintenance state.
If flags is SMFIMEDIATE, the instance is moved into
maintenance state immediately, killing any running methods.
If flags is SMFTEMPORARY, the change to maintenance state
is a temporary change, lasting only for the lifetime of the
current system instance. The flags argument is set to 0 if
no flags are to be use.
The smfdegradeinstance() function moves an online service
instance into the degraded state. This function operates
only on instances in the online state. The flags argument is
set to 0 if no flags are to be use. The only available flag
is SMFIMEDIATE, which causes the instance to be moved into
the degraded state immediately.
The smfrestoreinstance() function brings an instance
currently in the maintenance to the uninitialized state, so
that it can be brought back online. For a service in the
degraded state, smfrestoreinstance() brings the specified
instance back to the online state.
The smfgetstate() function returns a pointer to a string
containing the name of the instance's current state. The
user is responsible for freeing this string. Possible state
strings are defined as the following:
#define SCFSTATESTRINGUNINIT ((const char *)"uninitialized")
#define SCFSTATESTRINGMAINT ((const char *)"maintenance")
#define SCFSTATESTRINGOFLINE ((const char *)"offline")
SunOS 5.11 Last change: 5 Nov 2007 2
Service Configuration Facility Library Functions
smfenableinstance(3SCF)
#define SCFSTATESTRINGDISABLED ((const char *)"disabled")
#define SCFSTATESTRINGONLINE ((const char *)"online")
#define SCFSTATESTRINGDEGRADED ((const char *)"degraded")
RETURN VALUES
Upon successful completion, smfenableinstance(),
smfdisableinstance(), smfrefreshinstance(),
smfrestartinstance(), smfmaintaininstance(),
smfdegradeinstance(), and smfrestoreinstance() return 0.
Otherwise, they return -1.
Upon successful completion, smfgetstate returns an allo-
cated string. Otherwise, it returns NUL.
ERORS
These functions will fail if:
SCFERORNOMEMORY
The memory allocation failed.
SCFERORINVALIDARGUMENT
The instance FMRI or flags argument is invalid.
SCFERORNOTFOUND
The FMRI is valid but there is no matching instance
found.
SCFERORCONECTIONBROKEN
The connection to repository was broken.
SCFERORNORESOURCES
The server has insufficient resources.
The smfmaintaininstance(), smfrefreshinstance(),
smfrestartinstance(), smfdegradeinstance(), and
smfrestoreinstance() functions will fail if:
SunOS 5.11 Last change: 5 Nov 2007 3
Service Configuration Facility Library Functions
smfenableinstance(3SCF)
SCFERORPERMISIONDENIED
User does not have proper authorizations. See
smfsecurity(5).
SCFERORBACKENDACES
The repository's backend refused access.
SCFERORBACKENDREADONLY
The repository's backend is read-only.
The smfrestoreinstance() and smfdegradeinstance() func-
tions will fail if:
SCFERORCONSTRAINTVIOLATED
The function is called on an instance in an inappropri-
ate state.
The scferror(3SCF) function can be used to retrieve the
error value.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
MT-Level Safe
SEE ALSO
svc.startd(1M), libscf(3LIB), scferror(3SCF), attri-
butes(5), smfsecurity(5)
SunOS 5.11 Last change: 5 Nov 2007 4
Service Configuration Facility Library Functions
smfenableinstance(3SCF)
SunOS 5.11 Last change: 5 Nov 2007 5
|