Print this page
smf: switch to a tri-state for process-security properties true=on,false=off,nil=default
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libscf/inc/libscf_priv.h
+++ new/usr/src/lib/libscf/inc/libscf_priv.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright 2013, Joyent, Inc. All rights reserved.
24 24 */
25 25
26 26 #ifndef _LIBSCF_PRIV_H
27 27 #define _LIBSCF_PRIV_H
28 28
29 29
30 30 #include <libscf.h>
31 31 #include <unistd.h>
32 32 #if !defined(NATIVE_BUILD)
33 33 #include <sys/secflags.h>
34 34 #endif
35 35
36 36 #ifdef __cplusplus
37 37 extern "C" {
38 38 #endif
39 39
40 40 /*
41 41 * NOTE
42 42 *
43 43 * The contents of this file are private to the implementation of Solaris
44 44 * and are subject to change at any time without notice.
45 45 */
46 46
47 47 #define SCF_PG_GENERAL_TYPE SCF_GROUP_FRAMEWORK
48 48 #define SCF_PG_GENERAL_FLAGS 0
49 49
50 50 #define SCF_PG_GENERAL_OVR_TYPE SCF_GROUP_FRAMEWORK
51 51 #define SCF_PG_GENERAL_OVR_FLAGS SCF_PG_FLAG_NONPERSISTENT
52 52
53 53 #define SCF_PG_DEATHROW_TYPE SCF_GROUP_FRAMEWORK
54 54 #define SCF_PG_DEATHROW_FLAGS SCF_PG_FLAG_NONPERSISTENT
55 55
56 56 #define SCF_PG_OPTIONS_TYPE SCF_GROUP_FRAMEWORK
57 57 #define SCF_PG_OPTIONS_FLAGS 0
58 58
59 59 #define SCF_PG_OPTIONS_OVR_TYPE SCF_GROUP_FRAMEWORK
60 60 #define SCF_PG_OPTIONS_OVR_FLAGS SCF_PG_FLAG_NONPERSISTENT
61 61
62 62 #define SCF_PG_RESTARTER_TYPE SCF_GROUP_FRAMEWORK
63 63 #define SCF_PG_RESTARTER_FLAGS SCF_PG_FLAG_NONPERSISTENT
64 64
65 65 #define SCF_PG_RESTARTER_ACTIONS_TYPE SCF_GROUP_FRAMEWORK
66 66 #define SCF_PG_RESTARTER_ACTIONS_FLAGS SCF_PG_FLAG_NONPERSISTENT
67 67
68 68 #define SCF_PROPERTY_CLEAR ((const char *)"maint_off")
69 69 #define SCF_PROPERTY_MAINTENANCE ((const char *)"maint_on")
70 70
71 71 #define SCF_PROPERTY_LOGFILE ((const char *)"logfile")
72 72 #define SCF_PROPERTY_ALT_LOGFILE ((const char *)"alt_logfile")
73 73
74 74 #define SCF_LEGACY_SERVICE ((const char *)"smf/legacy_run")
75 75
76 76 #define SCF_LEGACY_PROPERTY_NAME ((const char *)"name")
77 77 #define SCF_LEGACY_PROPERTY_INODE ((const char *)"inode")
78 78 #define SCF_LEGACY_PROPERTY_SUFFIX ((const char *)"suffix")
79 79
80 80 #define SCF_FMRI_TYPE_SVC 0x1
81 81 #define SCF_FMRI_TYPE_FILE 0x2
82 82
83 83 /*
84 84 * Strings for use in constructing FMRIs
85 85 */
86 86 #define SCF_FMRI_SVC_PREFIX "svc:"
87 87 #define SCF_FMRI_FILE_PREFIX "file:"
88 88 #define SCF_FMRI_SCOPE_PREFIX "//"
89 89 #define SCF_FMRI_LOCAL_SCOPE "localhost"
90 90 #define SCF_FMRI_SCOPE_SUFFIX "@localhost"
91 91 #define SCF_FMRI_SERVICE_PREFIX "/"
92 92 #define SCF_FMRI_INSTANCE_PREFIX ":"
93 93 #define SCF_FMRI_PROPERTYGRP_PREFIX "/:properties/"
94 94 #define SCF_FMRI_PROPERTY_PREFIX "/"
95 95 #define SCF_FMRI_LEGACY_PREFIX "lrc:"
96 96
97 97 /*
98 98 * sulogin Service FMRI
99 99 */
100 100 #define SVC_SULOGIN_FMRI ((const char *)"svc:/system/sulogin")
101 101
102 102 typedef struct scf_decoration_info {
103 103 const char *sdi_name;
104 104 scf_type_t sdi_type;
105 105 scf_value_t *sdi_value; /* can be SCF_DECORATE_CLEAR */
106 106 } scf_decoration_info_t;
107 107
108 108 typedef int (*scf_decoration_func)(const scf_decoration_info_t *, void *);
109 109
110 110 /*
111 111 * calls a callback function for each decoration on the handle. If the
112 112 * callback returns 0, the iteration stops and returns 0. If the callback
113 113 * returns a non-zero value, the iteration continues. After full completion,
114 114 * 1 is returned. On error, -1 is returned.
115 115 */
116 116 int _scf_handle_decorations(scf_handle_t *, scf_decoration_func *,
117 117 scf_value_t *, void *);
118 118
119 119 /*
120 120 * wait for a change to the propertygroup -- may return early.
121 121 * For now, only one of these can be outstanding at a time.
122 122 *
123 123 * The second argument is how long, in seconds, to wait for a response.
124 124 *
125 125 * Returns SCF_COMPLETE on timeout, -1 on error, and SCF_SUCCESS in every
126 126 * other case. You must call scf_pg_update() to see if the object has
127 127 * actually changed.
128 128 */
129 129 int _scf_pg_wait(scf_propertygroup_t *, int);
130 130
131 131 /*
132 132 * set up notifications for changes to a class of property groups (by name
133 133 * and type)
134 134 *
135 135 * Only one thread can be sleeping in _scf_notify_wait() -- others will
136 136 * fail. Deletions give an fmri in the output path.
137 137 *
138 138 * These do not survive unbind()->bind() -- in fact, that is currently the
139 139 * only way to clear them.
140 140 */
141 141 int _scf_notify_add_pgname(scf_handle_t *, const char *);
142 142 int _scf_notify_add_pgtype(scf_handle_t *, const char *);
143 143 int _scf_notify_wait(scf_propertygroup_t *, char *, size_t);
144 144
145 145 /*
146 146 * Internal interfaces for snapshot creation:
147 147 * _scf_snapshot_take_new(), _scf_snapshot_take_new_named(), and
148 148 * _scf_snapshot_take_attach() create a set of snaplevels
149 149 * containing frozen versions of both the instance's property groups and
150 150 * its parent service's property groups. _scf_snapshot_take_new() and
151 151 * _scf_snapshot_take_new_named() create a new snapshot to which the
152 152 * new snaplevels are attached, while _scf_snapshot_take_attach()
153 153 * attaches the new snaplevels to a pre-existing snapshot.
154 154 *
155 155 * _scf_snapshot_take_new_named() records the passed in names into the
156 156 * snaplevel instead of the instance and service name. This creates
157 157 * an inconsistency, which should be resolved by using
158 158 * _scf_snapshot_attach() to attach the new snaplevels to a snapshot
159 159 * underneath the appropriate instance. The first snapshot can
160 160 * then be deleted.
161 161 *
162 162 * _scf_snapshot_attach(snap1, snap2) points snap2 at the snaplevels
163 163 * pointed to by snap1. After a call to either
164 164 * _scf_snapshot_take_attach(snap1, snap2) or
165 165 * _scf_snapshot_attach(inst, snap), scf_snapshot_update() will be
166 166 * required for any open references to snap or snap2 to see the new
167 167 * snaplevels.
168 168 *
169 169 * _scf_snapshot_delete() deletes the snapshot object. While
170 170 * snaplevels, being only loosely connected to snapshots, stay
171 171 * around until they are no longer referenced, any references *through
172 172 * this snapshot object* will be invalidated.
173 173 *
174 174 * _scf_snapshot_take_new() can fail with at least _HANDLE_MISMATCH,
175 175 * _CONNECTION_BROKEN, _INVALID_ARGUMENT, _NO_RESOURCES, _PERMISSION_DENIED,
176 176 * _NOT_SET, _EXISTS.
177 177 *
178 178 * _scf_snapshot_take_new_named() can fail with at least _HANDLE_MISMATCH,
179 179 * _CONNECTION_BROKEN, _INVALID_ARGUMENT, _NO_RESOURCES, _PERMISSION_DENIED,
180 180 * _NOT_SET, _EXISTS.
181 181 *
182 182 * _scf_snapshot_take_attach() can fail with _CONNECTION_BROKEN, _NOT_SET,
183 183 * _PERMISSION_DENIED, _NO_RESOURCES, _INVALID_ARGUMENT.
184 184 *
185 185 * _scf_snapshot_attach() can fail with _HANDLE_MISMATCH, _CONNECTION_BROKEN,
186 186 * _NOT_SET, _NO_RESOURCES, _PERMISSION_DENIED.
187 187 */
188 188 int _scf_snapshot_take_new(scf_instance_t *, const char *, scf_snapshot_t *);
189 189 int _scf_snapshot_take_new_named(scf_instance_t *,
190 190 const char *, const char *, const char *, scf_snapshot_t *);
191 191 int _scf_snapshot_take_attach(scf_instance_t *, scf_snapshot_t *);
192 192 int _scf_snapshot_attach(scf_snapshot_t *, scf_snapshot_t *);
193 193 int _scf_snapshot_delete(scf_snapshot_t *);
194 194
195 195 /*
196 196 * Destructively portions up the first argument into the different portions
197 197 * of a svc: fmri, and returns pointers to the applicable portions. Omitted
198 198 * portions are set to NULL, except for the scope, which is set to the
199 199 * default local scope if not specified.
200 200 *
201 201 * Parsing is attempted in the order of: svc:, file:. The identified type
202 202 * of the service is returned in the second argument and may take a value
203 203 * of: SCF_FMRI_TYPE_SVC or SCF_FMRI_TYPE_FILE.
204 204 *
205 205 * Note that some of the returned pointers (in particular the scope) may not
206 206 * point into the passed buffer.
207 207 */
208 208 int scf_parse_fmri(char *, int *, const char **, const char **, const char **,
209 209 const char **, const char **);
210 210
211 211 int scf_parse_svc_fmri(char *, const char **, const char **, const char **,
212 212 const char **, const char **);
213 213
214 214 int scf_parse_file_fmri(char *fmri, const char **scope, const char **path);
215 215
216 216 ssize_t scf_canonify_fmri(const char *, char *, size_t);
217 217
218 218 int _smf_refresh_instance_i(scf_instance_t *);
219 219
220 220 typedef struct scf_simple_handle {
221 221 scf_handle_t *h;
222 222 scf_snapshot_t *snap;
223 223 scf_instance_t *inst;
224 224 scf_propertygroup_t *running_pg;
225 225 scf_propertygroup_t *editing_pg;
226 226 } scf_simple_handle_t;
227 227
228 228 void scf_simple_handle_destroy(scf_simple_handle_t *);
229 229 scf_simple_handle_t *scf_general_pg_setup(const char *, const char *);
230 230 scf_transaction_t *scf_transaction_setup(scf_simple_handle_t *);
231 231 int scf_transaction_restart(scf_simple_handle_t *, scf_transaction_t *);
232 232 int scf_read_count_property(scf_simple_handle_t *, char *, uint64_t *);
233 233 int scf_set_count_property(scf_transaction_t *, char *, uint64_t, boolean_t);
234 234
235 235 /*
236 236 * Walks all the instances matching a given fmri list. Each fmri in the array
237 237 * can be one of the following:
238 238 *
239 239 * - Full instance name
240 240 * - Full service name
241 241 * - Full property group or property name
242 242 * - Partial service or instance name
243 243 * - A globbed pattern
244 244 *
245 245 * The matching rules for partial fmris are a slightly more complex. We allow
246 246 * for any substring anchored at the end of the instance or service name,
247 247 * provided it begins with a complete element in the fmri. For example, given
248 248 * the fmri "svc:/system/filesystem/local:default", any of the following would
249 249 * be acceptable matches: 'default', 'local', 'local:default',
250 250 * 'filesystem/local'. The following would not be acceptable:
251 251 * 'system/filesystem', 'filesystem/loc', 'system/local'. Possible flag values:
252 252 *
253 253 * SCF_WALK_MULTIPLE Allow individual arguments to correspond to
254 254 * multiple instances.
255 255 *
256 256 * SCF_WALK_LEGACY Walk legacy services (indicated by a non-NULL
257 257 * propery group).
258 258 *
259 259 * SCF_WALK_SERVICE If the user specifies a service, pass the
260 260 * service to the callback without iterating over
261 261 * its instances.
262 262 *
263 263 * SCF_WALK_PROPERTY Allow FMRIs which match property groups or
264 264 * individual properties. Incompatible with
265 265 * SCF_WALK_LEGACY.
266 266 *
267 267 * SCF_WALK_NOINSTANCE Walk only services. Must be used in
268 268 * conjunction with SCF_WALK_SERVICE.
269 269 *
270 270 * SCF_WALK_EXPLICIT Walk only services if the match is exact
271 271 * else return instances. Must be used in
272 272 * conjunction with SCF_WALK_SERVICE.
273 273 *
274 274 * SCF_WALK_UNIPARTIAL Can be combined with SCF_WALK_MULTIPLE
275 275 * so that an error is returned if a partial
276 276 * fmri matches multiple instances, unless
277 277 * a wildcard match is also used.
278 278 *
279 279 * If no arguments are given, then all instances in the service graph are
280 280 * walked.
281 281 *
282 282 * The second to last parameter is set to UU_EXIT_FATAL if one of the arguments
283 283 * is an invalid FMRI or matches multiple FMRIs when SCF_WALK_MULTIPLE is not
284 284 * set.
285 285 *
286 286 * The last parameter is a user-supplied error function that is called when
287 287 * reporting invalid arguments.
288 288 */
289 289
290 290 #define SCF_WALK_MULTIPLE 0x01
291 291 #define SCF_WALK_LEGACY 0x02
292 292 #define SCF_WALK_SERVICE 0x04
293 293 #define SCF_WALK_PROPERTY 0x08
294 294 #define SCF_WALK_NOINSTANCE 0x10
295 295 #define SCF_WALK_EXPLICIT 0x20
296 296 #define SCF_WALK_UNIPARTIAL 0x40
297 297
298 298 /*
299 299 * The default locations of the repository dbs
300 300 */
301 301 #define REPOSITORY_DB "/etc/svc/repository.db"
302 302 #define NONPERSIST_DB "/etc/svc/volatile/svc_nonpersist.db"
303 303 #define FAST_REPOSITORY_DB "/etc/svc/volatile/fast_repository.db"
304 304 #define REPOSITORY_CHECKPOINT "/etc/svc/volatile/checkpoint_repository.db"
305 305
306 306
307 307 typedef struct scf_walkinfo {
308 308 const char *fmri;
309 309 scf_scope_t *scope;
310 310 scf_service_t *svc;
311 311 scf_instance_t *inst;
312 312 scf_propertygroup_t *pg;
313 313 scf_property_t *prop;
314 314 int count; /* svcprop special */
315 315 } scf_walkinfo_t;
316 316
317 317 typedef int (*scf_walk_callback)(void *, scf_walkinfo_t *);
318 318
319 319 scf_error_t scf_walk_fmri(scf_handle_t *, int, char **, int,
320 320 scf_walk_callback, void *, int *, void (*)(const char *, ...));
321 321
322 322 /*
323 323 * Requests a backup of the repository with a particular name, which
324 324 * can be any alphabetic string. Only privileged users can do this.
325 325 *
326 326 * Can fail with:
327 327 * _NOT_BOUND, _CONNECTION_BROKEN, _PERMISSION_DENIED, _INVALID_ARGUMENT,
328 328 * _INTERNAL (path too long, or the backup failed for an odd reason),
329 329 * _BACKEND_READONLY (filesystem is still read-only)
330 330 */
331 331 int _scf_request_backup(scf_handle_t *, const char *);
332 332
333 333 /*
334 334 * Repository switch client
335 335 */
336 336 int _scf_repository_switch(scf_handle_t *, int);
337 337
338 338 /*
339 339 * Determines whether a property group requires authorization to read; this
340 340 * does not in any way reflect whether the caller has that authorization.
341 341 * To determine that, the caller must attempt to read the value of one of the
342 342 * group's properties.
343 343 *
344 344 * Can fail with:
345 345 * _NOT_BOUND, _CONNECTION_BROKEN, _INVALID_ARGUMENT, _INTERNAL,
346 346 * _NO_RESOURCES, _CONSTRAINT_VIOLATED, _DELETED.
347 347 */
348 348 int _scf_pg_is_read_protected(const scf_propertygroup_t *, boolean_t *);
349 349
350 350 /*
351 351 * Sets annotation data for SMF audit logging. Once this function has been
352 352 * set, the next audit record will be preceded by an ADT_smf_annotation
353 353 * with the information provided in this function. This function is used
354 354 * to mark operations which comprise multiple primitive operations such as
355 355 * svccfg import.
356 356 */
357 357 int _scf_set_annotation(scf_handle_t *h, const char *operation,
358 358 const char *file);
359 359
360 360 /*
361 361 * scf_pattern_t
362 362 */
363 363 typedef struct scf_pattern {
364 364 enum {
365 365 PATTERN_INVALID, /* Uninitialized state */
366 366 PATTERN_EXACT,
367 367 PATTERN_GLOB,
368 368 PATTERN_PARTIAL
369 369 } sp_type;
370 370 char *sp_arg; /* Original argument */
371 371 struct scf_match *sp_matches; /* List of matches */
372 372 int sp_matchcount; /* # of matches */
373 373 } scf_pattern_t;
374 374
375 375 int scf_cmp_pattern(char *, scf_pattern_t *);
376 376
377 377 int gen_filenms_from_fmri(const char *, const char *, char *, char *);
378 378
379 379 /*
380 380 * Interfaces for bulk access to SMF-stored configuration.
381 381 *
382 382 * Each scf_propvec_t represents a single property to be read (with
383 383 * scf_read_propvec) or written (with scf_write_propvec).
384 384 *
385 385 * The fields of a scf_propvec_t have the following meanings:
386 386 *
387 387 * pv_prop - the name of the property
388 388 * pv_desc - a description string (optional; to be consumed by the caller)
389 389 * pv_type - the type of the property
390 390 * pv_ptr - where to store the data read, or a pointer to the data to
391 391 * be written
392 392 * pv_aux - additional data influencing the interpretation of pv_ptr
393 393 *
394 394 * The meaning of pv_ptr and pv_aux depends on the type of property. For:
395 395 *
396 396 * boolean - if pv_aux is 0, pv_ptr is a pointer to a boolean_t
397 397 * if pv_aux is non-0, pv_ptr is a pointer to a uint64_t,
398 398 * where pv_aux indicates the bit holding the truth value.
399 399 * count - pv_ptr is a pointer to a uint64_t; pv_aux is unused
400 400 * integer - pv_ptr is a pointer to an int64_t; pv_aux is unused
401 401 * time - pv_ptr is a pointer to an scf_time_t; pv_aux is unused
402 402 * opaque - pv_ptr is a pointer to an scf_opaque_t; pv_aux is unused
403 403 * strings - (scf_read_propvec) pv_ptr is a pointer to a char *
404 404 * (scf_write_propvec) pv_ptr is a pointer to an array of char
405 405 * (both) pv_aux is unused
406 406 */
407 407 typedef struct {
408 408 void *so_addr;
409 409 size_t so_size;
410 410 } scf_opaque_t;
411 411
412 412 typedef struct {
413 413 const char *pv_prop;
414 414 const char *pv_desc;
415 415 scf_type_t pv_type;
416 416 void *pv_ptr;
417 417 uint64_t pv_aux;
418 418 } scf_propvec_t;
419 419
420 420 void scf_clean_propvec(scf_propvec_t *);
421 421 int scf_read_propvec(const char *, const char *, boolean_t, scf_propvec_t *,
422 422 scf_propvec_t **);
423 423 int scf_write_propvec(const char *, const char *, scf_propvec_t *,
424 424 scf_propvec_t **);
425 425
426 426 scf_tmpl_errors_t *_scf_create_errors(const char *, int);
427 427 int _scf_tmpl_add_error(scf_tmpl_errors_t *errs, scf_tmpl_error_type_t type,
428 428 const char *pg_name, const char *prop_name,
429 429 const char *ev1, const char *ev2, const char *actual,
430 430 const char *tmpl_fmri, const char *tmpl_pg_name, const char *tmpl_pg_type,
431 431 const char *tmpl_prop_name, const char *tmpl_prop_type);
432 432 int _scf_tmpl_error_set_prefix(scf_tmpl_errors_t *, const char *);
433 433
434 434 /*
435 435 * Templates definitions
436 436 */
437 437
438 438 /*
439 439 * For CARDINALITY_VIOLATION and RANGE_VIOLATION, te_ev1 holds
440 440 * the min value and te_ev2 holds the max value
441 441 *
442 442 * For MISSING_PG te_ev1 should hold the expected pg_name and
443 443 * expected2 holds the expected pg_type.
444 444 *
445 445 * For SCF_TERR_PG_PATTERN_CONFLICT and SCF_TERR_GENERAL_REDEFINE te_ev1 is
446 446 * the FMRI holding the conflicting pg_pattern. te_ev2 is the name of the
447 447 * conflicting pg_pattern, and actual is the type of the conflicting
448 448 * pg_pattern.
449 449 *
450 450 * SCF_TERR_PROP_PATTERN_CONFLICT te_ev1 is the FMRI holding the
451 451 * conflicting prop_pattern. te_ev2 is the name of the conflicting
452 452 * prop_pattern, and actual is the type of the conflicting prop_pattern.
453 453 *
454 454 * For SCF_TERR_INCLUDE_VALUES te_ev1 is the type specified for the
455 455 * include_values element.
456 456 *
457 457 * For all other errors, te_ev1 should hold the expected value and
458 458 * te_ev2 is ignored
459 459 *
460 460 * te_actual holds the current value of the property
461 461 */
462 462
463 463 struct scf_tmpl_error {
464 464 scf_tmpl_errors_t *te_errs;
465 465 scf_tmpl_error_type_t te_type;
466 466 const char *te_pg_name;
467 467 const char *te_prop_name;
468 468 const char *te_ev1;
469 469 const char *te_ev2;
470 470 const char *te_actual;
471 471 const char *te_tmpl_fmri;
472 472 const char *te_tmpl_pg_name;
473 473 const char *te_tmpl_pg_type;
474 474 const char *te_tmpl_prop_name;
475 475 const char *te_tmpl_prop_type;
476 476 };
477 477
478 478 /*
479 479 * The pg_pattern element has two optional attributes that play a part in
480 480 * selecting the appropriate prefix for the name of the pg_pattern property
481 481 * group. The two attributes are name and type. The appropriate prefix
482 482 * encodes the presence are absence of these attributes.
483 483 *
484 484 * SCF_PG_TM_PG_PATTERN_PREFIX neither attribute
485 485 * SCF_PG_TM_PG_PATTERN_N_PREFIX name only
486 486 * SCF_PG_TM_PG_PATTERN_T_PREFIX type only
487 487 * SCF_PG_TM_PG_PATTERN_NT_PREFIX both name and type
488 488 */
489 489 #define SCF_PG_TM_PG_PAT_BASE "tm_pgpat"
490 490 #define SCF_PG_TM_PG_PATTERN_PREFIX ((const char *)SCF_PG_TM_PG_PAT_BASE \
491 491 "_")
492 492 #define SCF_PG_TM_PG_PATTERN_N_PREFIX ((const char *)SCF_PG_TM_PG_PAT_BASE \
493 493 "n_")
494 494 #define SCF_PG_TM_PG_PATTERN_T_PREFIX ((const char *)SCF_PG_TM_PG_PAT_BASE \
495 495 "t_")
496 496 #define SCF_PG_TM_PG_PATTERN_NT_PREFIX ((const char *)SCF_PG_TM_PG_PAT_BASE \
497 497 "nt_")
498 498 #define SCF_PG_TM_PROP_PATTERN_PREFIX ((const char *)"tm_proppat_")
499 499
500 500 /*
501 501 * Pad character to use when encoding strings for property names.
502 502 */
503 503 #define SCF_ENCODE32_PAD ('-')
504 504
505 505 /*
506 506 * Functions for base 32 encoding/decoding
507 507 */
508 508 int scf_decode32(const char *, size_t, char *, size_t, size_t *, char);
509 509 int scf_encode32(const char *, size_t, char *, size_t, size_t *, char);
510 510
511 511 /*
512 512 * handy functions
513 513 */
514 514 /*
515 515 * _scf_sanitize_locale
516 516 * Make sure a locale string has only alpha-numeric or '_' characters
517 517 */
518 518 void _scf_sanitize_locale(char *);
519 519
520 520 /*
521 521 * _scf_read_tmpl_prop_type_as_string()
522 522 * Handy function to get template property type as a string
523 523 */
524 524 char *_scf_read_tmpl_prop_type_as_string(const scf_prop_tmpl_t *);
525 525 /*
526 526 * _scf_read_single_astring_from_pg()
527 527 * Given a property group (pg) and a property name (pn), this function
528 528 * retrives an astring value from pg/pn.
529 529 */
530 530 char *_scf_read_single_astring_from_pg(scf_propertygroup_t *, const char *);
531 531
532 532 /*
533 533 * scf_instance_delete_prop()
534 534 * Given instance, property group, and property, delete the property.
535 535 */
536 536 int
537 537 scf_instance_delete_prop(scf_instance_t *, const char *, const char *);
538 538
539 539 /*
540 540 * Functions to extract boot config information from FMRI_BOOT_CONFIG
541 541 */
542 542 void scf_get_boot_config(uint8_t *);
543 543 void scf_get_boot_config_ovr(uint8_t *);
544 544 int scf_is_fastboot_default(void);
545 545
546 546 /*
547 547 * Set value of "config_ovr/fastreboot_default".
548 548 */
549 549 int scf_fastreboot_default_set_transient(boolean_t);
550 550
551 551 /*
552 552 * scf_is_compatible_type()
553 553 * Return true if the second type is the same type, or a subtype of the
554 554 * first.
555 555 */
556 556 int scf_is_compatible_type(scf_type_t, scf_type_t);
557 557
558 558 /*
559 559 * Check an array of services and enable any that don't have the
560 560 * "application/auto_enable" property set to "false", which is
561 561 * the interface to turn off this behaviour (see PSARC 2004/739).
562 562 */
563 563 void _check_services(char **);
564 564
565 565 /*
566 566 * _scf_handle_create_and_bind()
567 567 * convenience function that creates and binds a handle
568 568 */
569 569 scf_handle_t *_scf_handle_create_and_bind(scf_version_t);
570 570
571 571 /*
572 572 * _smf_refresh_all_instances()
573 573 * refresh all intances of a service
574 574 * return SCF_SUCCESS or SCF_FAILED on _PERMISSION_DENIED, _BACKEND_ACCESS
575 575 * or _BACKEND_READONLY.
576 576 */
577 577 int _smf_refresh_all_instances(scf_service_t *);
578 578
579 579 /*
580 580 * _scf_get_fma_notify_params()
581 581 * Specialized fuction to get fma notifitation parameters
582 582 */
583 583 int _scf_get_fma_notify_params(const char *, nvlist_t *, int);
584 584
585 585 /*
586 586 * _scf_get_svc_notify_params()
587 587 * Specialized function to get SMF state transition notification parameters
588 588 */
↓ open down ↓ |
588 lines elided |
↑ open up ↑ |
589 589 int _scf_get_svc_notify_params(const char *, nvlist_t *, int32_t, int, int);
590 590
591 591 /*
592 592 * _scf_notify_get_params()
593 593 * Specialized function to get notification parametes from a pg into an
594 594 * nvlist_t
595 595 */
596 596 int _scf_notify_get_params(scf_propertygroup_t *, nvlist_t *);
597 597
598 598 #if !defined(NATIVE_BUILD)
599 -int scf_default_secflags(scf_handle_t *, psecflags_t *);
599 +int scf_default_secflags(scf_handle_t *, scf_secflags_t *);
600 600 #endif
601 601
602 602 #define SCF_NOTIFY_PARAMS_SOURCE_NAME ((const char *)"preference_source")
603 603
604 604 #ifdef __cplusplus
605 605 }
606 606 #endif
607 607
608 608 #endif /* _LIBSCF_PRIV_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX