1smf_enable_instaSnecrev(i3cSeCFC)onfiguration Facility LibrarysFmufn_cetniaobnlse_instance(3SCF)
2
3
4

NAME

6       smf_enable_instance,     smf_disable_instance,    smf_refresh_instance,
7       smf_restart_instance,   smf_maintain_instance,    smf_degrade_instance,
8       smf_restore_instance,  smf_get_state  - administrative interface to the
9       Service Configuration Facility
10

SYNOPSIS

12       cc [ flag... ] file... -lscf [ library... ]
13       #include <libscf.h>
14
15       int smf_enable_instance(const char *instance, int flags);
16
17
18       int smf_disable_instance(const char *instance, int flags);
19
20
21       int smf_refresh_instance(const char *instance);
22
23
24       int smf_restart_instance(const char *instance);
25
26
27       int smf_maintain_instance(const char *instance, int flags);
28
29
30       int smf_degrade_instance(const char *instance, int flags);
31
32
33       int smf_restore_instance(const char *instance);
34
35
36       char *smf_get_state(const char *instance);
37
38

DESCRIPTION

40       These functions provide administrative control over service  instances.
41       Using  these  functions,  an  administrative tool can make a request to
42       enable, disable, refresh, or restart an instance. All calls  are  asyn‐
43       chronous.  They request an action, but do not wait to see if the action
44       succeeds or fails.
45
46
47       The smf_enable_instance() function enables the service instance  speci‐
48       fied  by  instance FMRI. If flags is SMF_TEMPORARY, the enabling of the
49       service instance is a temporary change, lasting only for  the  lifetime
50       of  the  current  system instance. The flags argument is set to 0 if no
51       flags are to be use.
52
53
54       The smf_disable_instance() function places the service instance  speci‐
55       fied  by  instance  FMRI  in  the  disabled state and triggers the stop
56       method (see svc.startd(1M)). If flags is SMF_TEMPORARY,  the  disabling
57       of  the  service  instance  is a temporary change, lasting only for the
58       lifetime of the current system instance. The flags argument is set to 0
59       if no flags are to be use.
60
61
62       The  smf_refresh_instance() function causes the service instance speci‐
63       fied by instance FMRI to re-read its configuration information.
64
65
66       The smf_restart_instance() function restarts the service instance spec‐
67       ified by instance FMRI.
68
69
70       The  smf_maintain_instance() function moves the service instance speci‐
71       fied by instance into the maintenance state. If flags is SMF_IMMEDIATE,
72       the  instance  is moved into maintenance state immediately, killing any
73       running methods. If flags is SMF_TEMPORARY, the change  to  maintenance
74       state  is a temporary change, lasting only for the lifetime of the cur‐
75       rent system instance. The flags argument is set to 0 if no flags are to
76       be use.
77
78
79       The  smf_degrade_instance()  function  moves an online service instance
80       into the degraded state. This function operates only  on  instances  in
81       the  online state. The flags argument is set to 0 if no flags are to be
82       use. The  only  available  flag  is  SMF_IMMEDIATE,  which  causes  the
83       instance to be moved into the degraded state immediately.
84
85
86       The smf_restore_instance() function brings an instance currently in the
87       maintenance to the uninitialized state, so that it can be brought  back
88       online.  For  a  service  in the degraded state, smf_restore_instance()
89       brings the specified instance back to the online state.
90
91
92       The smf_get_state() function returns a pointer to a  string  containing
93       the  name  of the instance's current state. The user is responsible for
94       freeing this string. Possible state strings are defined as the  follow‐
95       ing:
96
97         #define SCF_STATE_STRING_UNINIT         ((const char *)"uninitialized")
98         #define SCF_STATE_STRING_MAINT          ((const char *)"maintenance")
99         #define SCF_STATE_STRING_OFFLINE        ((const char *)"offline")
100         #define SCF_STATE_STRING_DISABLED       ((const char *)"disabled")
101         #define SCF_STATE_STRING_ONLINE         ((const char *)"online")
102         #define SCF_STATE_STRING_DEGRADED       ((const char *)"degraded")
103
104

RETURN VALUES

106       Upon    successful    completion,    smf_enable_instance(),    smf_dis‐
107       able_instance(),    smf_refresh_instance(),     smf_restart_instance(),
108       smf_maintain_instance(),           smf_degrade_instance(),          and
109       smf_restore_instance() return 0. Otherwise, they return -1.
110
111
112       Upon successful completion, smf_get_state returns an allocated  string.
113       Otherwise, it returns NULL.
114

ERRORS

116       These functions will fail if:
117
118       SCF_ERROR_NO_MEMORY
119
120           The memory allocation failed.
121
122
123       SCF_ERROR_INVALID_ARGUMENT
124
125           The instance FMRI or flags argument is invalid.
126
127
128       SCF_ERROR_NOT_FOUND
129
130           The FMRI is valid but there is no matching instance found.
131
132
133       SCF_ERROR_CONNECTION_BROKEN
134
135           The connection to repository was broken.
136
137
138       SCF_ERROR_NO_RESOURCES
139
140           The server has insufficient resources.
141
142
143
144       The           smf_maintain_instance(),          smf_refresh_instance(),
145       smf_restart_instance(),           smf_degrade_instance(),           and
146       smf_restore_instance() functions will fail if:
147
148       SCF_ERROR_PERMISSION_DENIED
149
150           User does not have proper authorizations. See smf_security(5).
151
152
153       SCF_ERROR_BACKEND_ACCESS
154
155           The repository's backend refused access.
156
157
158       SCF_ERROR_BACKEND_READONLY
159
160           The repository's backend is read-only.
161
162
163
164       The  smf_restore_instance()  and  smf_degrade_instance() functions will
165       fail if:
166
167       SCF_ERROR_CONSTRAINT_VIOLATED
168
169           The function is called on an instance in an inappropriate state.
170
171
172
173       The scf_error(3SCF) function can be used to retrieve the error value.
174

ATTRIBUTES

176       See attributes(5) for descriptions of the following attributes:
177
178
179
180
181       ┌─────────────────────────────┬─────────────────────────────┐
182       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
183       ├─────────────────────────────┼─────────────────────────────┤
184       │Interface Stability          │Committed                    │
185       ├─────────────────────────────┼─────────────────────────────┤
186       │MT-Level                     │Safe                         │
187       └─────────────────────────────┴─────────────────────────────┘
188

SEE ALSO

190       svc.startd(1M), libscf(3LIB), scf_error(3SCF), attributes(5), smf_secu‐
191       rity(5)
192
193
194
195SunOS 5.11                        5 Nov 2007         smf_enable_instance(3SCF)
Impressum