1scf_service_creaSteer(v3iScCeF)Configuration Facility Library Fsucnfc_tsieornvsice_create(3SCF)
2
3
4

NAME

6       scf_service_create,  scf_service_handle,  scf_service_destroy, scf_ser‐
7       vice_get_parent,      scf_service_get_name,      scf_scope_get_service,
8       scf_scope_add_service,  scf_service_delete - create and manipulate ser‐
9       vice handles and services in the Service Configuration Facility
10

SYNOPSIS

12       cc [ flag... ] file... -lscf [ library... ]
13       #include <libscf.h>
14
15       scf_service_t *scf_service_create(scf_handle_t *handle);
16
17
18       scf_handle_t *scf_service_handle(scf_service_t *svc);
19
20
21       void scf_service_destroy(scf_service_t *svc);
22
23
24       int scf_service_get_parent(scf_service_t *svc, scf_scope_t *sc);
25
26
27       ssize_t scf_service_get_name(const scf_service_t *svc, char *buf,
28            size_t size);
29
30
31       int scf_scope_get_service(const scf_scope_t *sc, const char *name,
32            scf_service_t *svc);
33
34
35       int scf_scope_add_service(const scf_scope_t *sc, const char *name,
36            scf_service_t *svc);
37
38
39       int scf_service_delete(scf_service_t *svc);
40
41

DESCRIPTION

43       Services form the middle layer of the  Service  Configuration  Facility
44       repository  tree.  Services are children of a scope (see scf_scope_cre‐
45       ate(3SCF)) and have three sets of children:
46
47       Property groups    These hold configuration information shared  by  all
48                          of  the  instances  of  the service. See scf_pg_cre‐
49                          ate(3SCF),      scf_iter_service_pgs(3SCF),      and
50                          scf_iter_service_pgs_typed(3SCF).
51
52
53       Instances          A  particular  instantiation  of  the  service.  See
54                          scf_instance_create(3SCF).
55
56
57
58       A service groups one or more related instances and  provides  a  shared
59       configuration for them.
60
61
62       An  scf_service_t  is an opaque handle that can be set to a single ser‐
63       vice at any given time. The scf_service_create() function allocates and
64       initializes   a   new  scf_service_t  bound  to  handle.  The  scf_ser‐
65       vice_destroy() function destroys and frees svc.
66
67
68       The scf_service_handle() function retrieves the handle to which svc  is
69       bound.
70
71
72       The  scf_service_get_parent() function sets sc to the scope that is the
73       parent of svc.
74
75
76       The scf_service_get_name() function retrieves the name of  the  service
77       to which svc is set.
78
79
80       The  scf_scope_get_service() function sets svc to the service specified
81       by name in the scope specified by sc.
82
83
84       The scf_scope_add_service() function sets svc to a new  service  speci‐
85       fied by name in the scope specified by sc.
86
87
88       The  scf_service_delete()  function deletes the service to which svc is
89       set, as well as all of its children.
90

RETURN VALUES

92       Upon successful completion, scf_service_create() returns a new scf_ser‐
93       vice_t. Otherwise, it returns NULL.
94
95
96       Upon  successful completion, scf_service_handle() returns the handle to
97       which svc is bound. Otherwise, it returns NULL.
98
99
100       Upon successful completion, scf_service_get_name() returns  the  length
101       of  the string written, not including the terminating null byte. Other‐
102       wise, it returns -1.
103
104
105       Upon       successful       completion,       scf_service_get_parent(),
106       scf_scope_get_service(),    scf_scope_add_service(),    and    scf_ser‐
107       vice_delete() return 0. Otherwise, it returns -1.
108

ERRORS

110       The scf_service_create() function will fail if:
111
112       SCF_ERROR_INVALID_ARGUMENT    The value of the handle argument is NULL.
113
114
115       SCF_ERROR_NO_MEMORY           There is not enough memory to allocate an
116                                     scf_service_t.
117
118
119       SCF_ERROR_NO_RESOURCES        The   server   does   not  have  adequate
120                                     resources for a new scope handle.
121
122
123
124       The scf_service_handle() function will fail if:
125
126       SCF_ERROR_HANDLE_DESTROYED    The handle associated with svc  has  been
127                                     destroyed.
128
129
130
131       The   scf_service_get_name(),  scf_service_get_parent(),  and  scf_ser‐
132       vice_delete() functions will fail if:
133
134       SCF_ERROR_DELETED
135
136           The service has been deleted by someone else.
137
138
139       SCF_ERROR_NOT_SET
140
141           The service is not set.
142
143
144       SCF_ERROR_NOT_BOUND
145
146           The handle is not bound.
147
148
149       SCF_ERROR_CONNECTION_BROKEN
150
151           The connection to the repository was lost.
152
153
154
155       The scf_service_delete() function will fail if:
156
157       SCF_ERROR_EXISTS          The service contains instances.
158
159
160       SCF_ERROR_NO_RESOURCES    The server does not have  adequate  resources
161                                 for a new scope handle.
162
163
164
165       The scf_scope_add_service() function will fail if:
166
167       SCF_ERROR_EXISTS    A   {service,instance,property  group}  named  name
168                           already exists.
169
170
171
172       The scf_scope_get_service() function will fail if:
173
174       SCF_ERROR_BACKEND_ACCESS    The  storage  mechanism  that  the   repos‐
175                                   itory  server  (svc.configd(1M))  chose for
176                                   the operation denied access.
177
178
179       SCF_ERROR_INTERNAL          An internal error occurred.
180
181
182
183       The scf_scope_add_service() and scf_scope_get_service() functions  will
184       fail if:
185
186       SCF_ERROR_CONNECTION_BROKEN
187
188           The connection to the repository was lost.
189
190
191       SCF_ERROR_DELETED
192
193           The parent entity has been deleted.
194
195
196       SCF_ERROR_HANDLE_MISMATCH
197
198           The scope and service are not derived from the same handle.
199
200
201       SCF_ERROR_INVALID_ARGUMENT
202
203           The value of the name argument is not a valid service name.
204
205
206       SCF_ERROR_NO_RESOURCES
207
208           The server does not have the resources to complete the request.
209
210
211       SCF_ERROR_NOT_BOUND
212
213           The handle is not bound.
214
215
216       SCF_ERROR_NOT_FOUND
217
218           The service specified by name was not found.
219
220
221       SCF_ERROR_NOT_SET
222
223           The scope is not set.
224
225
226
227       The  scf_scope_add_service()  and  scf_service_delete()  functions will
228       fail if:
229
230       SCF_ERROR_PERMISSION_DENIED
231
232           The user does not have sufficient privileges to create or delete  a
233           service.
234
235
236       SCF_ERROR_BACKEND_READONLY
237
238           The repository backend is read-only.
239
240
241       SCF_ERROR_BACKEND_ACCESS
242
243           The repository backend refused the modification.
244
245
246
247       The scf_error(3SCF) function can be used to retrieve the error value.
248

ATTRIBUTES

250       See attributes(5) for descriptions of the following attributes:
251
252
253
254
255       ┌─────────────────────────────┬─────────────────────────────┐
256       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
257       ├─────────────────────────────┼─────────────────────────────┤
258       │Interface Stability          │Committed                    │
259       ├─────────────────────────────┼─────────────────────────────┤
260       │MT-Level                     │Safe                         │
261       └─────────────────────────────┴─────────────────────────────┘
262

SEE ALSO

264       libscf(3LIB),       scf_error(3SCF),      scf_handle_decode_fmri(3SCF),
265       scf_iter_service_pgs(3SCF),           scf_iter_service_pgs_typed(3SCF),
266       scf_instance_create(3SCF), scf_pg_create(3SCF), scf_scope_create(3SCF),
267       scf_service_to_fmri(3SCF), attributes(5), smf(5)
268
269
270
271SunOS 5.11                        27 Aug 2007         scf_service_create(3SCF)
Impressum