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.h
+++ new/usr/src/lib/libscf/inc/libscf.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 */
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
21 21
22 22 /*
23 23 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 25
26 26 #ifndef _LIBSCF_H
27 27 #define _LIBSCF_H
28 28
29 29
30 30 #include <stddef.h>
31 -#include <sys/types.h>
32 31 #include <libnvpair.h>
33 32
33 +#ifndef NATIVE_BUILD
34 +#include <sys/secflags.h>
35 +#endif /* NATIVE_BUILD */
36 +#include <sys/types.h>
37 +
34 38 #ifdef __cplusplus
35 39 extern "C" {
36 40 #endif
37 41
38 42 typedef struct scf_version *scf_version_t;
39 43 #define SCF_VERSION ((scf_version_t)1UL)
40 44
41 45 /*
42 46 * Opaque structures
43 47 */
44 48 typedef struct scf_handle scf_handle_t;
45 49 typedef struct scf_scope scf_scope_t;
46 50 typedef struct scf_service scf_service_t;
47 51 typedef struct scf_instance scf_instance_t;
48 52 typedef struct scf_propertygroup scf_propertygroup_t;
49 53 typedef struct scf_property scf_property_t;
50 54
51 55 typedef struct scf_snapshot scf_snapshot_t;
52 56 typedef struct scf_snaplevel scf_snaplevel_t;
53 57
54 58 typedef struct scf_transaction scf_transaction_t;
55 59 typedef struct scf_transaction_entry scf_transaction_entry_t;
56 60 typedef struct scf_value scf_value_t;
57 61
58 62 typedef struct scf_iter scf_iter_t;
59 63
60 64 typedef struct scf_pg_tmpl scf_pg_tmpl_t;
61 65 typedef struct scf_prop_tmpl scf_prop_tmpl_t;
62 66 typedef struct scf_tmpl_errors scf_tmpl_errors_t;
63 67
64 68 typedef struct scf_simple_app_props scf_simple_app_props_t;
65 69 typedef struct scf_simple_prop scf_simple_prop_t;
66 70
67 71 /*
68 72 * Types
69 73 */
70 74 typedef enum {
71 75 SCF_TYPE_INVALID = 0,
72 76
73 77 SCF_TYPE_BOOLEAN,
74 78 SCF_TYPE_COUNT,
75 79 SCF_TYPE_INTEGER,
76 80 SCF_TYPE_TIME,
77 81 SCF_TYPE_ASTRING,
78 82 SCF_TYPE_OPAQUE,
79 83
80 84 SCF_TYPE_USTRING = 100,
81 85
82 86 SCF_TYPE_URI = 200,
83 87 SCF_TYPE_FMRI,
84 88
85 89 SCF_TYPE_HOST = 300,
86 90 SCF_TYPE_HOSTNAME,
87 91 SCF_TYPE_NET_ADDR_V4,
88 92 SCF_TYPE_NET_ADDR_V6,
89 93 SCF_TYPE_NET_ADDR
90 94 } scf_type_t;
91 95
92 96 typedef struct scf_time {
93 97 int64_t t_seconds;
94 98 int32_t t_ns;
95 99 } scf_time_t;
96 100
97 101 /*
98 102 * There is no explicit initializer for this structure. Functions
99 103 * which set or populate this structure assume that it is either
100 104 * uninitialized or destroyed.
101 105 */
102 106 typedef struct scf_values {
103 107 scf_type_t value_type;
104 108 void *reserved; /* reserved for future use */
105 109 int value_count;
106 110 char **values_as_strings;
107 111 union {
108 112 uint64_t *v_count;
109 113 uint8_t *v_boolean;
110 114 int64_t *v_integer;
111 115 char **v_astring;
112 116 char **v_ustring;
113 117 char **v_opaque;
114 118 scf_time_t *v_time;
115 119 } values;
116 120 } scf_values_t;
117 121
118 122 typedef struct scf_count_ranges {
119 123 int scr_num_ranges;
120 124 uint64_t *scr_min;
121 125 uint64_t *scr_max;
122 126 } scf_count_ranges_t;
123 127
124 128 typedef struct scf_int_ranges {
125 129 int sir_num_ranges;
126 130 int64_t *sir_min;
127 131 int64_t *sir_max;
128 132 } scf_int_ranges_t;
129 133
130 134 /*
131 135 * Return codes
132 136 */
133 137 #define SCF_SUCCESS 0
134 138 #define SCF_COMPLETE 1
135 139 #define SCF_FAILED -1
136 140
137 141 typedef enum scf_error {
138 142 SCF_ERROR_NONE = 1000, /* no error */
139 143 SCF_ERROR_NOT_BOUND, /* handle not bound */
140 144 SCF_ERROR_NOT_SET, /* cannot use unset argument */
141 145 SCF_ERROR_NOT_FOUND, /* nothing of that name found */
142 146 SCF_ERROR_TYPE_MISMATCH, /* type does not match value */
143 147 SCF_ERROR_IN_USE, /* cannot modify while in-use */
144 148 SCF_ERROR_CONNECTION_BROKEN, /* repository connection gone */
145 149 SCF_ERROR_INVALID_ARGUMENT, /* bad argument */
146 150 SCF_ERROR_NO_MEMORY, /* no memory available */
147 151 SCF_ERROR_CONSTRAINT_VIOLATED, /* required constraint not met */
148 152 SCF_ERROR_EXISTS, /* object already exists */
149 153 SCF_ERROR_NO_SERVER, /* repository server unavailable */
150 154 SCF_ERROR_NO_RESOURCES, /* server has insufficient resources */
151 155 SCF_ERROR_PERMISSION_DENIED, /* insufficient privileges for action */
152 156 SCF_ERROR_BACKEND_ACCESS, /* backend refused access */
153 157 SCF_ERROR_HANDLE_MISMATCH, /* mismatched SCF handles */
154 158 SCF_ERROR_HANDLE_DESTROYED, /* object bound to destroyed handle */
155 159 SCF_ERROR_VERSION_MISMATCH, /* incompatible SCF version */
156 160 SCF_ERROR_BACKEND_READONLY, /* backend is read-only */
157 161 SCF_ERROR_DELETED, /* object has been deleted */
158 162 SCF_ERROR_TEMPLATE_INVALID, /* template data is invalid */
159 163
160 164 SCF_ERROR_CALLBACK_FAILED = 1080, /* user callback function failed */
161 165
162 166 SCF_ERROR_INTERNAL = 1101 /* internal error */
163 167 } scf_error_t;
164 168
165 169 /*
166 170 * This enum MUST be kept in sync with
167 171 * struct _scf_tmpl_error_desc em_desc() in scf_tmpl.c
168 172 */
169 173 typedef enum scf_tmpl_error_type {
170 174 SCF_TERR_MISSING_PG, /* property group missing */
171 175 SCF_TERR_WRONG_PG_TYPE, /* property group type incorrect */
172 176 SCF_TERR_MISSING_PROP, /* missing required property */
173 177 SCF_TERR_WRONG_PROP_TYPE, /* property type incorrect */
174 178 SCF_TERR_CARDINALITY_VIOLATION, /* wrong number of values */
175 179 SCF_TERR_VALUE_CONSTRAINT_VIOLATED, /* constraint violated for value */
176 180 SCF_TERR_RANGE_VIOLATION, /* value violated specified range */
177 181 SCF_TERR_PG_REDEFINE, /* global or restarter pg_pattern */
178 182 /* redefined by the instance */
179 183 SCF_TERR_PROP_TYPE_MISMATCH, /* property and value type mismatch */
180 184 SCF_TERR_VALUE_OUT_OF_RANGE, /* value is out of range in template */
181 185 SCF_TERR_INVALID_VALUE, /* value is not valid for the */
182 186 /* template */
183 187 SCF_TERR_PG_PATTERN_CONFLICT, /* pg_pattern conflicts with higher */
184 188 /* level definition */
185 189 SCF_TERR_PROP_PATTERN_CONFLICT, /* prop_pattern conflicts with higher */
186 190 /* level definition */
187 191 SCF_TERR_GENERAL_REDEFINE, /* global or restarter template */
188 192 /* redefined */
189 193 SCF_TERR_INCLUDE_VALUES, /* No supporting constraints or */
↓ open down ↓ |
146 lines elided |
↑ open up ↑ |
190 194 /* values for include_values */
191 195 SCF_TERR_PG_PATTERN_INCOMPLETE, /* Required pg_pattern is missing */
192 196 /* name or type attribute. */
193 197 SCF_TERR_PROP_PATTERN_INCOMPLETE /* Required prop_pattern is */
194 198 /* missing a type attribute. */
195 199 } scf_tmpl_error_type_t;
196 200
197 201 typedef struct scf_tmpl_error scf_tmpl_error_t;
198 202
199 203 /*
204 + * This unfortunately needs to be public, because consumers of librestart must
205 + * deal with it
206 + */
207 +typedef struct {
208 +#ifndef NATIVE_BUILD
209 + secflagdelta_t ss_default;
210 + secflagdelta_t ss_lower;
211 + secflagdelta_t ss_upper;
212 +#else
213 + /*
214 + * This is never used, but is necessary for bootstrapping.
215 + * Not even the size matters.
216 + */
217 + void *ss_default;
218 + void *ss_lower;
219 + void *ss_upper;
220 +#endif /* NATIVE_BUILD */
221 +} scf_secflags_t;
222 +
223 +/*
200 224 * scf_tmpl_strerror() human readable flag
201 225 */
202 226 #define SCF_TMPL_STRERROR_HUMAN 0x1
203 227
204 228 /*
205 229 * Standard services
206 230 */
207 231 #define SCF_SERVICE_CONFIGD ((const char *) \
208 232 "svc:/system/svc/repository:default")
209 233 #define SCF_INSTANCE_GLOBAL ((const char *) \
210 234 "svc:/system/svc/global:default")
211 235 #define SCF_SERVICE_GLOBAL ((const char *) \
212 236 "svc:/system/svc/global")
213 237 #define SCF_SERVICE_STARTD ((const char *) \
214 238 "svc:/system/svc/restarter:default")
215 239 #define SCF_INSTANCE_EMI ((const char *) \
216 240 "svc:/system/early-manifest-import:default")
217 241 #define SCF_INSTANCE_FS_MINIMAL ((const char *) \
218 242 "svc:/system/filesystem/minimal:default")
219 243 #define SCF_INSTANCE_MI ((const char *) \
220 244 "svc:/system/manifest-import:default")
221 245
222 246 /*
223 247 * Major milestones
224 248 */
225 249 #define SCF_MILESTONE_SINGLE_USER \
226 250 ((const char *) "svc:/milestone/single-user:default")
227 251 #define SCF_MILESTONE_MULTI_USER \
228 252 ((const char *) "svc:/milestone/multi-user:default")
229 253 #define SCF_MILESTONE_MULTI_USER_SERVER \
230 254 ((const char *) "svc:/milestone/multi-user-server:default")
231 255
232 256 /*
233 257 * standard scope names
234 258 */
235 259 #define SCF_SCOPE_LOCAL ((const char *)"localhost")
236 260
237 261 /*
238 262 * Property group types
239 263 */
240 264 #define SCF_GROUP_APPLICATION ((const char *)"application")
241 265 #define SCF_GROUP_FRAMEWORK ((const char *)"framework")
242 266 #define SCF_GROUP_DEPENDENCY ((const char *)"dependency")
243 267 #define SCF_GROUP_METHOD ((const char *)"method")
244 268 #define SCF_GROUP_TEMPLATE ((const char *)"template")
245 269 #define SCF_GROUP_TEMPLATE_PG_PATTERN ((const char *)"template_pg_pattern")
246 270 #define SCF_GROUP_TEMPLATE_PROP_PATTERN ((const char *)"template_prop_pattern")
247 271
248 272 /*
249 273 * Dependency types
250 274 */
251 275 #define SCF_DEP_REQUIRE_ALL ((const char *)"require_all")
252 276 #define SCF_DEP_REQUIRE_ANY ((const char *)"require_any")
253 277 #define SCF_DEP_EXCLUDE_ALL ((const char *)"exclude_all")
254 278 #define SCF_DEP_OPTIONAL_ALL ((const char *)"optional_all")
255 279
256 280 #define SCF_DEP_RESET_ON_ERROR ((const char *)"error")
257 281 #define SCF_DEP_RESET_ON_RESTART ((const char *)"restart")
258 282 #define SCF_DEP_RESET_ON_REFRESH ((const char *)"refresh")
259 283 #define SCF_DEP_RESET_ON_NONE ((const char *)"none")
260 284
261 285 /*
262 286 * Standard property group names
263 287 */
264 288 #define SCF_PG_GENERAL ((const char *)"general")
265 289 #define SCF_PG_GENERAL_OVR ((const char *)"general_ovr")
266 290 #define SCF_PG_RESTARTER ((const char *)"restarter")
267 291 #define SCF_PG_RESTARTER_ACTIONS ((const char *)"restarter_actions")
268 292 #define SCF_PG_METHOD_CONTEXT ((const char *)"method_context")
269 293 #define SCF_PG_APP_DEFAULT ((const char *)"application")
270 294 #define SCF_PG_DEPENDENTS ((const char *)"dependents")
271 295 #define SCF_PG_OPTIONS ((const char *)"options")
272 296 #define SCF_PG_OPTIONS_OVR ((const char *)"options_ovr")
273 297 #define SCF_PG_STARTD ((const char *)"startd")
274 298 #define SCF_PG_STARTD_PRIVATE ((const char *)"svc-startd-private")
275 299 #define SCF_PG_DEATHROW ((const char *)"deathrow")
276 300 #define SCF_PG_MANIFESTFILES ((const char *)"manifestfiles")
277 301
278 302 /*
279 303 * Template property group names and prefixes
280 304 */
281 305 #define SCF_PG_TM_COMMON_NAME ((const char *)"tm_common_name")
282 306 #define SCF_PG_TM_DESCRIPTION ((const char *)"tm_description")
283 307
284 308 #define SCF_PG_TM_MAN_PREFIX ((const char *)"tm_man_")
285 309 #define SCF_PG_TM_DOC_PREFIX ((const char *)"tm_doc_")
286 310
287 311 /*
288 312 * Standard property names
289 313 */
290 314 #define SCF_PROPERTY_ACTIVE_POSTFIX ((const char *)"active")
291 315 #define SCF_PROPERTY_AUX_STATE ((const char *)"auxiliary_state")
292 316 #define SCF_PROPERTY_AUX_FMRI ((const char *)"auxiliary_fmri")
293 317 #define SCF_PROPERTY_AUX_TTY ((const char *)"auxiliary_tty")
294 318 #define SCF_PROPERTY_CONTRACT ((const char *)"contract")
295 319 #define SCF_PROPERTY_COREFILE_PATTERN ((const char *)"corefile_pattern")
296 320 #define SCF_PROPERTY_DEGRADED ((const char *)"degraded")
297 321 #define SCF_PROPERTY_DEGRADE_IMMEDIATE ((const char *)"degrade_immediate")
298 322 #define SCF_PROPERTY_DODUMP ((const char *)"do_dump")
299 323 #define SCF_PROPERTY_DURATION ((const char *)"duration")
300 324 #define SCF_PROPERTY_ENABLED ((const char *)"enabled")
301 325 #define SCF_PROPERTY_DEATHROW ((const char *)"deathrow")
302 326 #define SCF_PROPERTY_ENTITY_STABILITY ((const char *)"entity_stability")
303 327 #define SCF_PROPERTY_ENTITIES ((const char *)"entities")
304 328 #define SCF_PROPERTY_EXEC ((const char *)"exec")
305 329 #define SCF_PROPERTY_GROUP ((const char *)"group")
306 330 #define SCF_PROPERTY_GROUPING ((const char *)"grouping")
307 331 #define SCF_PROPERTY_IGNORE ((const char *)"ignore_error")
308 332 #define SCF_PROPERTY_INTERNAL_SEPARATORS ((const char *)"internal_separators")
309 333 #define SCF_PROPERTY_LIMIT_PRIVILEGES ((const char *)"limit_privileges")
310 334 #define SCF_PROPERTY_MAINT_OFF ((const char *)"maint_off")
311 335 #define SCF_PROPERTY_MAINT_ON ((const char *)"maint_on")
312 336 #define SCF_PROPERTY_MAINT_ON_IMMEDIATE ((const char *)"maint_on_immediate")
313 337 #define SCF_PROPERTY_MAINT_ON_IMMTEMP ((const char *)"maint_on_immtemp")
314 338 #define SCF_PROPERTY_MAINT_ON_TEMPORARY ((const char *)"maint_on_temporary")
315 339 #define SCF_PROPERTY_METHOD_PID ((const char *)"method_pid")
316 340 #define SCF_PROPERTY_MILESTONE ((const char *)"milestone")
317 341 #define SCF_PROPERTY_NEED_SESSION ((const char *)"need_session")
318 342 #define SCF_PROPERTY_NEXT_STATE ((const char *)"next_state")
319 343 #define SCF_PROPERTY_PACKAGE ((const char *)"package")
320 344 #define SCF_PROPERTY_PRIVILEGES ((const char *)"privileges")
321 345 #define SCF_PROPERTY_PROFILE ((const char *)"profile")
322 346 #define SCF_PROPERTY_PROJECT ((const char *)"project")
323 347 #define SCF_PROPERTY_REFRESH ((const char *)"refresh")
324 348 #define SCF_PROPERTY_RESOURCE_POOL ((const char *)"resource_pool")
325 349 #define SCF_PROPERTY_ENVIRONMENT ((const char *)"environment")
326 350 #define SCF_PROPERTY_RESTART ((const char *)"restart")
327 351 #define SCF_PROPERTY_RESTARTER ((const char *)"restarter")
328 352 #define SCF_PROPERTY_RESTART_INTERVAL ((const char *)"restart_interval")
329 353 #define SCF_PROPERTY_RESTART_ON ((const char *)"restart_on")
330 354 #define SCF_PROPERTY_RESTORE ((const char *)"restore")
331 355 #define SCF_PROPERTY_SECFLAGS ((const char *)"security_flags")
332 356 #define SCF_PROPERTY_SINGLE_INSTANCE ((const char *)"single_instance")
333 357 #define SCF_PROPERTY_START_METHOD_TIMESTAMP \
334 358 ((const char *)"start_method_timestamp")
335 359 #define SCF_PROPERTY_START_METHOD_WAITSTATUS \
336 360 ((const char *)"start_method_waitstatus")
337 361 #define SCF_PROPERTY_START_PID ((const char *)"start_pid")
338 362 #define SCF_PROPERTY_STATE ((const char *)"state")
339 363 #define SCF_PROPERTY_STABILITY ((const char *)"stability")
340 364 #define SCF_PROPERTY_STATE_TIMESTAMP ((const char *)"state_timestamp")
341 365 #define SCF_PROPERTY_SUPP_GROUPS ((const char *)"supp_groups")
342 366 #define SCF_PROPERTY_TIMEOUT ((const char *)"timeout_seconds")
343 367 #define SCF_PROPERTY_TIMEOUT_RETRY ((const char *)"timeout_retry")
344 368 #define SCF_PROPERTY_TRANSIENT_CONTRACT ((const char *)"transient_contract")
345 369 #define SCF_PROPERTY_TYPE ((const char *)"type")
346 370 #define SCF_PROPERTY_USE_PROFILE ((const char *)"use_profile")
347 371 #define SCF_PROPERTY_USER ((const char *)"user")
348 372 #define SCF_PROPERTY_UTMPX_PREFIX ((const char *)"utmpx_prefix")
349 373 #define SCF_PROPERTY_WORKING_DIRECTORY ((const char *)"working_directory")
350 374
351 375 /*
352 376 * Template property names
353 377 */
354 378 #define SCF_PROPERTY_TM_CARDINALITY_MIN ((const char *)"cardinality_min")
355 379 #define SCF_PROPERTY_TM_CARDINALITY_MAX ((const char *)"cardinality_max")
356 380 #define SCF_PROPERTY_TM_CHOICES_INCLUDE_VALUES ((const char *) \
357 381 "choices_include_values")
358 382 #define SCF_PROPERTY_TM_CHOICES_NAME ((const char *)"choices_name")
359 383 #define SCF_PROPERTY_TM_CHOICES_RANGE ((const char *)"choices_range")
360 384 #define SCF_PROPERTY_TM_CONSTRAINT_NAME ((const char *)"constraint_name")
361 385 #define SCF_PROPERTY_TM_CONSTRAINT_RANGE ((const char *)"constraint_range")
362 386 #define SCF_PROPERTY_TM_MANPATH ((const char *)"manpath")
363 387 #define SCF_PROPERTY_TM_NAME ((const char *)"name")
364 388 #define SCF_PROPERTY_TM_PG_PATTERN ((const char *)"pg_pattern")
365 389 #define SCF_PROPERTY_TM_REQUIRED ((const char *)"required")
366 390 #define SCF_PROPERTY_TM_SECTION ((const char *)"section")
367 391 #define SCF_PROPERTY_TM_TARGET ((const char *)"target")
368 392 #define SCF_PROPERTY_TM_TITLE ((const char *)"title")
369 393 #define SCF_PROPERTY_TM_TYPE ((const char *)"type")
370 394 #define SCF_PROPERTY_TM_URI ((const char *)"uri")
371 395 #define SCF_PROPERTY_TM_VALUE_PREFIX ((const char *)"value_")
372 396 #define SCF_PROPERTY_TM_VALUES_NAME ((const char *)"values_name")
373 397 #define SCF_PROPERTY_TM_VISIBILITY ((const char *)"visibility")
374 398 #define SCF_PROPERTY_TM_COMMON_NAME_PREFIX ((const char *)"common_name_")
375 399 #define SCF_PROPERTY_TM_DESCRIPTION_PREFIX ((const char *)"description_")
376 400 #define SCF_PROPERTY_TM_UNITS_PREFIX ((const char *)"units_")
377 401
378 402 /*
379 403 * Templates wildcard string
380 404 */
381 405 #define SCF_TMPL_WILDCARD ((const char *)"*")
382 406
383 407 /*
384 408 * Strings used by restarters for state and next_state properties.
385 409 * MAX_SCF_STATE_STRING holds the max length of a state string, including the
386 410 * terminating null.
387 411 */
388 412
389 413 #define MAX_SCF_STATE_STRING_SZ 14
390 414
391 415 #define SCF_STATE_STRING_NONE ((const char *)"none")
392 416 #define SCF_STATE_STRING_UNINIT ((const char *)"uninitialized")
393 417 #define SCF_STATE_STRING_MAINT ((const char *)"maintenance")
394 418 #define SCF_STATE_STRING_OFFLINE ((const char *)"offline")
395 419 #define SCF_STATE_STRING_DISABLED ((const char *)"disabled")
396 420 #define SCF_STATE_STRING_ONLINE ((const char *)"online")
397 421 #define SCF_STATE_STRING_DEGRADED ((const char *)"degraded")
398 422 #define SCF_STATE_STRING_LEGACY ((const char *)"legacy_run")
399 423
400 424 #define SCF_STATE_UNINIT 0x00000001
401 425 #define SCF_STATE_MAINT 0x00000002
402 426 #define SCF_STATE_OFFLINE 0x00000004
403 427 #define SCF_STATE_DISABLED 0x00000008
404 428 #define SCF_STATE_ONLINE 0x00000010
405 429 #define SCF_STATE_DEGRADED 0x00000020
406 430 #define SCF_STATE_ALL 0x0000003F
407 431
408 432 /*
409 433 * software fma svc-transition class
410 434 */
411 435 #define SCF_NOTIFY_PARAMS_VERSION 0X0
412 436 #define SCF_NOTIFY_NAME_FMRI ((const char *)"fmri")
413 437 #define SCF_NOTIFY_NAME_VERSION ((const char *)"version")
414 438 #define SCF_NOTIFY_NAME_TSET ((const char *)"tset")
415 439 #define SCF_NOTIFY_PG_POSTFIX ((const char *)"fmnotify")
416 440 #define SCF_NOTIFY_PARAMS ((const char *)"notify-params")
417 441 #define SCF_NOTIFY_PARAMS_INST \
418 442 ((const char *)"svc:/system/fm/notify-params:default")
419 443 #define SCF_SVC_TRANSITION_CLASS \
420 444 ((const char *)"ireport.os.smf.state-transition")
421 445 #define SCF_NOTIFY_PARAMS_PG_TYPE ((const char *)"notify_params")
422 446
423 447 /*
424 448 * Useful transition macros
425 449 */
426 450 #define SCF_TRANS_SHIFT_INITIAL_STATE(s) ((s) << 16)
427 451 #define SCF_TRANSITION_ALL \
428 452 (SCF_TRANS_SHIFT_INITIAL_STATE(SCF_STATE_ALL) | SCF_STATE_ALL)
429 453 #define SCF_TRANS(f, t) (SCF_TRANS_SHIFT_INITIAL_STATE(f) | (t))
430 454 #define SCF_TRANS_VALID(t) (!((t) & ~SCF_TRANSITION_ALL))
431 455 #define SCF_TRANS_INITIAL_STATE(t) ((t) >> 16 & SCF_STATE_ALL)
432 456 #define SCF_TRANS_FINAL_STATE(t) ((t) & SCF_STATE_ALL)
433 457
434 458 /*
435 459 * Prefixes for states in state transition notification
436 460 */
437 461 #define SCF_STN_PREFIX_FROM ((const char *)"from-")
438 462 #define SCF_STN_PREFIX_TO ((const char *)"to-")
439 463
440 464 #define SCF_PG_FLAG_NONPERSISTENT 0x1
441 465
442 466 #define SCF_TRACE_LIBRARY 0x1
443 467 #define SCF_TRACE_DAEMON 0x2
444 468
445 469 #define SMF_IMMEDIATE 0x1
446 470 #define SMF_TEMPORARY 0x2
447 471 #define SMF_AT_NEXT_BOOT 0x4
448 472
449 473 scf_error_t scf_error(void);
450 474 const char *scf_strerror(scf_error_t);
451 475
452 476 ssize_t scf_limit(uint32_t code);
453 477 #define SCF_LIMIT_MAX_NAME_LENGTH -2000U
454 478 #define SCF_LIMIT_MAX_VALUE_LENGTH -2001U
455 479 #define SCF_LIMIT_MAX_PG_TYPE_LENGTH -2002U
456 480 #define SCF_LIMIT_MAX_FMRI_LENGTH -2003U
457 481
458 482 scf_handle_t *scf_handle_create(scf_version_t);
459 483
460 484 int scf_handle_decorate(scf_handle_t *, const char *, scf_value_t *);
461 485 #define SCF_DECORATE_CLEAR ((scf_value_t *)0)
462 486
463 487 int scf_handle_bind(scf_handle_t *);
464 488 int scf_handle_unbind(scf_handle_t *);
465 489 void scf_handle_destroy(scf_handle_t *);
466 490
467 491 int scf_type_base_type(scf_type_t type, scf_type_t *out);
468 492 const char *scf_type_to_string(scf_type_t);
469 493 scf_type_t scf_string_to_type(const char *);
470 494
471 495 /* values */
472 496 scf_value_t *scf_value_create(scf_handle_t *);
473 497 scf_handle_t *scf_value_handle(const scf_value_t *);
474 498 void scf_value_destroy(scf_value_t *);
475 499
476 500 scf_type_t scf_value_base_type(const scf_value_t *);
477 501 scf_type_t scf_value_type(const scf_value_t *);
478 502 int scf_value_is_type(const scf_value_t *, scf_type_t);
479 503
480 504 void scf_value_reset(scf_value_t *);
481 505
482 506 int scf_value_get_boolean(const scf_value_t *, uint8_t *);
483 507 int scf_value_get_count(const scf_value_t *, uint64_t *);
484 508 int scf_value_get_integer(const scf_value_t *, int64_t *);
485 509 int scf_value_get_time(const scf_value_t *, int64_t *, int32_t *);
486 510 ssize_t scf_value_get_astring(const scf_value_t *, char *, size_t);
487 511 ssize_t scf_value_get_ustring(const scf_value_t *, char *, size_t);
488 512 ssize_t scf_value_get_opaque(const scf_value_t *, void *, size_t);
489 513
490 514 void scf_value_set_boolean(scf_value_t *, uint8_t);
491 515 void scf_value_set_count(scf_value_t *, uint64_t);
492 516 void scf_value_set_integer(scf_value_t *, int64_t);
493 517 int scf_value_set_time(scf_value_t *, int64_t, int32_t);
494 518 int scf_value_set_astring(scf_value_t *, const char *);
495 519 int scf_value_set_ustring(scf_value_t *, const char *);
496 520 int scf_value_set_opaque(scf_value_t *, const void *, size_t);
497 521
498 522 ssize_t scf_value_get_as_string(const scf_value_t *, char *, size_t);
499 523 ssize_t scf_value_get_as_string_typed(const scf_value_t *, scf_type_t,
500 524 char *, size_t);
501 525 int scf_value_set_from_string(scf_value_t *, scf_type_t, const char *);
502 526
503 527 scf_iter_t *scf_iter_create(scf_handle_t *);
504 528 scf_handle_t *scf_iter_handle(const scf_iter_t *);
505 529 void scf_iter_reset(scf_iter_t *);
506 530 void scf_iter_destroy(scf_iter_t *);
507 531
508 532 int scf_iter_handle_scopes(scf_iter_t *, const scf_handle_t *);
509 533 int scf_iter_scope_services(scf_iter_t *, const scf_scope_t *);
510 534 int scf_iter_service_instances(scf_iter_t *, const scf_service_t *);
511 535 int scf_iter_service_pgs(scf_iter_t *, const scf_service_t *);
512 536 int scf_iter_instance_pgs(scf_iter_t *, const scf_instance_t *);
513 537 int scf_iter_instance_pgs_composed(scf_iter_t *, const scf_instance_t *,
514 538 const scf_snapshot_t *);
515 539 int scf_iter_service_pgs_typed(scf_iter_t *, const scf_service_t *,
516 540 const char *);
517 541 int scf_iter_instance_pgs_typed(scf_iter_t *, const scf_instance_t *,
518 542 const char *);
519 543 int scf_iter_instance_pgs_typed_composed(scf_iter_t *, const scf_instance_t *,
520 544 const scf_snapshot_t *, const char *);
521 545 int scf_iter_snaplevel_pgs(scf_iter_t *, const scf_snaplevel_t *);
522 546 int scf_iter_snaplevel_pgs_typed(scf_iter_t *, const scf_snaplevel_t *,
523 547 const char *);
524 548 int scf_iter_instance_snapshots(scf_iter_t *, const scf_instance_t *);
525 549 int scf_iter_pg_properties(scf_iter_t *, const scf_propertygroup_t *);
526 550 int scf_iter_property_values(scf_iter_t *, const scf_property_t *);
527 551
528 552 int scf_iter_next_scope(scf_iter_t *, scf_scope_t *);
529 553 int scf_iter_next_service(scf_iter_t *, scf_service_t *);
530 554 int scf_iter_next_instance(scf_iter_t *, scf_instance_t *);
531 555 int scf_iter_next_pg(scf_iter_t *, scf_propertygroup_t *);
532 556 int scf_iter_next_property(scf_iter_t *, scf_property_t *);
533 557 int scf_iter_next_snapshot(scf_iter_t *, scf_snapshot_t *);
534 558 int scf_iter_next_value(scf_iter_t *, scf_value_t *);
535 559
536 560 scf_scope_t *scf_scope_create(scf_handle_t *);
537 561 scf_handle_t *scf_scope_handle(const scf_scope_t *);
538 562
539 563 /* XXX eventually remove this */
540 564 #define scf_handle_get_local_scope(h, s) \
541 565 scf_handle_get_scope((h), SCF_SCOPE_LOCAL, (s))
542 566
543 567 int scf_handle_get_scope(scf_handle_t *, const char *, scf_scope_t *);
544 568 void scf_scope_destroy(scf_scope_t *);
545 569 ssize_t scf_scope_get_name(const scf_scope_t *, char *, size_t);
546 570
547 571 ssize_t scf_scope_to_fmri(const scf_scope_t *, char *, size_t);
548 572
549 573 scf_service_t *scf_service_create(scf_handle_t *);
550 574 scf_handle_t *scf_service_handle(const scf_service_t *);
551 575 void scf_service_destroy(scf_service_t *);
552 576 int scf_scope_get_parent(const scf_scope_t *, scf_scope_t *);
553 577 ssize_t scf_service_get_name(const scf_service_t *, char *, size_t);
554 578 ssize_t scf_service_to_fmri(const scf_service_t *, char *, size_t);
555 579 int scf_service_get_parent(const scf_service_t *, scf_scope_t *);
556 580 int scf_scope_get_service(const scf_scope_t *, const char *, scf_service_t *);
557 581 int scf_scope_add_service(const scf_scope_t *, const char *, scf_service_t *);
558 582 int scf_service_delete(scf_service_t *);
559 583
560 584 scf_instance_t *scf_instance_create(scf_handle_t *);
561 585 scf_handle_t *scf_instance_handle(const scf_instance_t *);
562 586 void scf_instance_destroy(scf_instance_t *);
563 587 ssize_t scf_instance_get_name(const scf_instance_t *, char *, size_t);
564 588 ssize_t scf_instance_to_fmri(const scf_instance_t *, char *, size_t);
565 589 int scf_service_get_instance(const scf_service_t *, const char *,
566 590 scf_instance_t *);
567 591 int scf_service_add_instance(const scf_service_t *, const char *,
568 592 scf_instance_t *);
569 593 int scf_instance_delete(scf_instance_t *);
570 594
571 595 scf_snapshot_t *scf_snapshot_create(scf_handle_t *);
572 596 scf_handle_t *scf_snapshot_handle(const scf_snapshot_t *);
573 597 void scf_snapshot_destroy(scf_snapshot_t *);
574 598 ssize_t scf_snapshot_get_name(const scf_snapshot_t *, char *, size_t);
575 599 int scf_snapshot_get_parent(const scf_snapshot_t *, scf_instance_t *);
576 600 int scf_instance_get_snapshot(const scf_instance_t *, const char *,
577 601 scf_snapshot_t *);
578 602 int scf_snapshot_update(scf_snapshot_t *);
579 603
580 604 scf_snaplevel_t *scf_snaplevel_create(scf_handle_t *);
581 605 scf_handle_t *scf_snaplevel_handle(const scf_snaplevel_t *);
582 606 void scf_snaplevel_destroy(scf_snaplevel_t *);
583 607 int scf_snaplevel_get_parent(const scf_snaplevel_t *, scf_snapshot_t *);
584 608 ssize_t scf_snaplevel_get_scope_name(const scf_snaplevel_t *, char *, size_t);
585 609 ssize_t scf_snaplevel_get_service_name(const scf_snaplevel_t *, char *, size_t);
586 610 ssize_t scf_snaplevel_get_instance_name(const scf_snaplevel_t *, char *,
587 611 size_t);
588 612 int scf_snaplevel_get_pg(const scf_snaplevel_t *, const char *,
589 613 scf_propertygroup_t *pg);
590 614 int scf_snapshot_get_base_snaplevel(const scf_snapshot_t *, scf_snaplevel_t *);
591 615 int scf_snaplevel_get_next_snaplevel(const scf_snaplevel_t *,
592 616 scf_snaplevel_t *);
593 617
594 618 scf_propertygroup_t *scf_pg_create(scf_handle_t *);
595 619 scf_handle_t *scf_pg_handle(const scf_propertygroup_t *);
596 620 void scf_pg_destroy(scf_propertygroup_t *);
597 621 ssize_t scf_pg_to_fmri(const scf_propertygroup_t *, char *, size_t);
598 622 ssize_t scf_pg_get_name(const scf_propertygroup_t *, char *, size_t);
599 623 ssize_t scf_pg_get_type(const scf_propertygroup_t *, char *, size_t);
600 624 int scf_pg_get_flags(const scf_propertygroup_t *, uint32_t *);
601 625 int scf_pg_get_parent_service(const scf_propertygroup_t *, scf_service_t *);
602 626 int scf_pg_get_parent_instance(const scf_propertygroup_t *, scf_instance_t *);
603 627 int scf_pg_get_parent_snaplevel(const scf_propertygroup_t *, scf_snaplevel_t *);
604 628 int scf_service_get_pg(const scf_service_t *, const char *,
605 629 scf_propertygroup_t *);
606 630 int scf_instance_get_pg(const scf_instance_t *, const char *,
607 631 scf_propertygroup_t *);
608 632 int scf_instance_get_pg_composed(const scf_instance_t *, const scf_snapshot_t *,
609 633 const char *, scf_propertygroup_t *);
610 634 int scf_service_add_pg(const scf_service_t *, const char *, const char *,
611 635 uint32_t, scf_propertygroup_t *);
612 636 int scf_instance_add_pg(const scf_instance_t *, const char *, const char *,
613 637 uint32_t, scf_propertygroup_t *);
614 638 int scf_pg_delete(scf_propertygroup_t *);
615 639
616 640 int scf_pg_get_underlying_pg(const scf_propertygroup_t *,
617 641 scf_propertygroup_t *);
618 642 int scf_instance_get_parent(const scf_instance_t *, scf_service_t *);
619 643
620 644 int scf_pg_update(scf_propertygroup_t *);
621 645
622 646 scf_property_t *scf_property_create(scf_handle_t *);
623 647 scf_handle_t *scf_property_handle(const scf_property_t *);
624 648 void scf_property_destroy(scf_property_t *);
625 649 int scf_property_is_type(const scf_property_t *, scf_type_t);
626 650 int scf_property_type(const scf_property_t *, scf_type_t *);
627 651 ssize_t scf_property_get_name(const scf_property_t *, char *, size_t);
628 652 int scf_property_get_value(const scf_property_t *, scf_value_t *);
629 653 ssize_t scf_property_to_fmri(const scf_property_t *, char *, size_t);
630 654 int scf_pg_get_property(const scf_propertygroup_t *, const char *,
631 655 scf_property_t *);
632 656
633 657 scf_transaction_t *scf_transaction_create(scf_handle_t *);
634 658 scf_handle_t *scf_transaction_handle(const scf_transaction_t *);
635 659 int scf_transaction_start(scf_transaction_t *, scf_propertygroup_t *);
636 660 void scf_transaction_destroy(scf_transaction_t *);
637 661 void scf_transaction_destroy_children(scf_transaction_t *);
638 662
639 663 void scf_transaction_reset(scf_transaction_t *);
640 664 void scf_transaction_reset_all(scf_transaction_t *);
641 665
642 666 int scf_transaction_commit(scf_transaction_t *);
643 667
644 668 scf_transaction_entry_t *scf_entry_create(scf_handle_t *);
645 669 scf_handle_t *scf_entry_handle(const scf_transaction_entry_t *);
646 670 void scf_entry_reset(scf_transaction_entry_t *);
647 671 void scf_entry_destroy(scf_transaction_entry_t *);
648 672 void scf_entry_destroy_children(scf_transaction_entry_t *);
649 673
650 674 int scf_transaction_property_change(scf_transaction_t *,
651 675 scf_transaction_entry_t *, const char *, scf_type_t);
652 676 int scf_transaction_property_delete(scf_transaction_t *,
653 677 scf_transaction_entry_t *, const char *);
654 678 int scf_transaction_property_new(scf_transaction_t *,
655 679 scf_transaction_entry_t *, const char *, scf_type_t);
656 680 int scf_transaction_property_change_type(scf_transaction_t *,
657 681 scf_transaction_entry_t *, const char *, scf_type_t);
658 682
659 683 int scf_entry_add_value(scf_transaction_entry_t *, scf_value_t *);
660 684
661 685 int scf_handle_decode_fmri(scf_handle_t *, const char *, scf_scope_t *,
662 686 scf_service_t *, scf_instance_t *, scf_propertygroup_t *, scf_property_t *,
663 687 int);
664 688 #define SCF_DECODE_FMRI_EXACT 0x00000001
665 689 #define SCF_DECODE_FMRI_TRUNCATE 0x00000002
666 690 #define SCF_DECODE_FMRI_REQUIRE_INSTANCE 0x00000004
667 691 #define SCF_DECODE_FMRI_REQUIRE_NO_INSTANCE 0x00000008
668 692
669 693 ssize_t scf_myname(scf_handle_t *, char *, size_t);
670 694
671 695 /*
672 696 * Property group template interfaces.
673 697 */
674 698 scf_pg_tmpl_t *scf_tmpl_pg_create(scf_handle_t *);
675 699 void scf_tmpl_pg_destroy(scf_pg_tmpl_t *);
676 700 void scf_tmpl_pg_reset(scf_pg_tmpl_t *);
677 701 int scf_tmpl_get_by_pg(scf_propertygroup_t *, scf_pg_tmpl_t *, int);
678 702 int scf_tmpl_get_by_pg_name(const char *, const char *,
679 703 const char *, const char *, scf_pg_tmpl_t *, int);
680 704 int scf_tmpl_iter_pgs(scf_pg_tmpl_t *, const char *, const char *,
681 705 const char *, int);
682 706 #define SCF_PG_TMPL_FLAG_REQUIRED 0x1
683 707 #define SCF_PG_TMPL_FLAG_EXACT 0x2
684 708 #define SCF_PG_TMPL_FLAG_CURRENT 0x4
685 709
686 710 ssize_t scf_tmpl_pg_name(const scf_pg_tmpl_t *, char **);
687 711 ssize_t scf_tmpl_pg_common_name(const scf_pg_tmpl_t *, const char *, char **);
688 712 ssize_t scf_tmpl_pg_description(const scf_pg_tmpl_t *, const char *, char **);
689 713 ssize_t scf_tmpl_pg_type(const scf_pg_tmpl_t *, char **);
690 714
691 715 ssize_t scf_tmpl_pg_target(const scf_pg_tmpl_t *, char **);
692 716 #define SCF_TM_TARGET_ALL ((const char *)"all")
693 717 #define SCF_TM_TARGET_DELEGATE ((const char *)"delegate")
694 718 #define SCF_TM_TARGET_INSTANCE ((const char *)"instance")
695 719 #define SCF_TM_TARGET_THIS ((const char *)"this")
696 720
697 721 int scf_tmpl_pg_required(const scf_pg_tmpl_t *, uint8_t *);
698 722
699 723 /*
700 724 * Property template interfaces.
701 725 */
702 726 scf_prop_tmpl_t *scf_tmpl_prop_create(scf_handle_t *);
703 727 void scf_tmpl_prop_destroy(scf_prop_tmpl_t *);
704 728 void scf_tmpl_prop_reset(scf_prop_tmpl_t *);
705 729 int scf_tmpl_get_by_prop(scf_pg_tmpl_t *, const char *,
706 730 scf_prop_tmpl_t *, int);
707 731 int scf_tmpl_iter_props(scf_pg_tmpl_t *, scf_prop_tmpl_t *, int);
708 732 #define SCF_PROP_TMPL_FLAG_REQUIRED 0x1
709 733
710 734 ssize_t scf_tmpl_prop_name(const scf_prop_tmpl_t *, char **);
711 735 int scf_tmpl_prop_type(const scf_prop_tmpl_t *, scf_type_t *);
712 736 int scf_tmpl_prop_required(const scf_prop_tmpl_t *, uint8_t *);
713 737 ssize_t scf_tmpl_prop_common_name(const scf_prop_tmpl_t *, const char *,
714 738 char **);
715 739 ssize_t scf_tmpl_prop_description(const scf_prop_tmpl_t *, const char *,
716 740 char **);
717 741 ssize_t scf_tmpl_prop_units(const scf_prop_tmpl_t *, const char *, char **);
718 742 int scf_tmpl_prop_cardinality(const scf_prop_tmpl_t *prop, uint64_t *,
719 743 uint64_t *);
720 744 int scf_tmpl_prop_internal_seps(const scf_prop_tmpl_t *, scf_values_t *);
721 745
722 746 int scf_tmpl_prop_visibility(const scf_prop_tmpl_t *, uint8_t *);
723 747 #define SCF_TMPL_VISIBILITY_HIDDEN 1
724 748 #define SCF_TMPL_VISIBILITY_READONLY 2
725 749 #define SCF_TMPL_VISIBILITY_READWRITE 3
726 750
727 751 const char *scf_tmpl_visibility_to_string(uint8_t);
728 752 #define SCF_TM_VISIBILITY_HIDDEN ((const char *)"hidden")
729 753 #define SCF_TM_VISIBILITY_READONLY ((const char *)"readonly")
730 754 #define SCF_TM_VISIBILITY_READWRITE ((const char *)"readwrite")
731 755
732 756 int scf_tmpl_value_name_constraints(const scf_prop_tmpl_t *prop,
733 757 scf_values_t *vals);
734 758 void scf_count_ranges_destroy(scf_count_ranges_t *);
735 759 void scf_int_ranges_destroy(scf_int_ranges_t *);
736 760 int scf_tmpl_value_count_range_constraints(const scf_prop_tmpl_t *,
737 761 scf_count_ranges_t *);
738 762 int scf_tmpl_value_int_range_constraints(const scf_prop_tmpl_t *,
739 763 scf_int_ranges_t *);
740 764 int scf_tmpl_value_count_range_choices(const scf_prop_tmpl_t *,
741 765 scf_count_ranges_t *);
742 766 int scf_tmpl_value_int_range_choices(const scf_prop_tmpl_t *,
743 767 scf_int_ranges_t *);
744 768 int scf_tmpl_value_name_choices(const scf_prop_tmpl_t *prop,
745 769 scf_values_t *vals);
746 770
747 771 void scf_values_destroy(scf_values_t *);
748 772
749 773 ssize_t scf_tmpl_value_common_name(const scf_prop_tmpl_t *, const char *,
750 774 const char *, char **);
751 775 ssize_t scf_tmpl_value_description(const scf_prop_tmpl_t *, const char *,
752 776 const char *, char **);
753 777
754 778 int scf_tmpl_value_in_constraint(const scf_prop_tmpl_t *pt, scf_value_t *value,
755 779 scf_tmpl_errors_t **errs);
756 780
757 781 /*
758 782 * Template validation interfaces
759 783 */
760 784 int scf_tmpl_validate_fmri(scf_handle_t *, const char *,
761 785 const char *, scf_tmpl_errors_t **, int);
762 786 #define SCF_TMPL_VALIDATE_FLAG_CURRENT 0x1
763 787
764 788 void scf_tmpl_errors_destroy(scf_tmpl_errors_t *errs);
765 789 scf_tmpl_error_t *scf_tmpl_next_error(scf_tmpl_errors_t *);
766 790 void scf_tmpl_reset_errors(scf_tmpl_errors_t *errs);
767 791 int scf_tmpl_strerror(scf_tmpl_error_t *err, char *s, size_t n, int flag);
768 792 int scf_tmpl_error_source_fmri(const scf_tmpl_error_t *, char **);
769 793 int scf_tmpl_error_type(const scf_tmpl_error_t *, scf_tmpl_error_type_t *);
770 794 int scf_tmpl_error_pg_tmpl(const scf_tmpl_error_t *, char **, char **);
771 795 int scf_tmpl_error_pg(const scf_tmpl_error_t *, char **, char **);
772 796 int scf_tmpl_error_prop_tmpl(const scf_tmpl_error_t *, char **, char **);
773 797 int scf_tmpl_error_prop(const scf_tmpl_error_t *, char **, char **);
774 798 int scf_tmpl_error_value(const scf_tmpl_error_t *, char **);
775 799
776 800 /*
777 801 * Simplified calls
778 802 */
779 803 int smf_enable_instance(const char *, int);
780 804 int smf_disable_instance(const char *, int);
781 805 int smf_refresh_instance(const char *);
782 806 int smf_restart_instance(const char *);
783 807 int smf_maintain_instance(const char *, int);
784 808 int smf_degrade_instance(const char *, int);
785 809 int smf_restore_instance(const char *);
786 810 char *smf_get_state(const char *);
787 811
788 812 int scf_simple_walk_instances(uint_t, void *,
789 813 int (*inst_callback)(scf_handle_t *, scf_instance_t *, void *));
790 814
791 815 scf_simple_prop_t *scf_simple_prop_get(scf_handle_t *, const char *,
792 816 const char *, const char *);
793 817 void scf_simple_prop_free(scf_simple_prop_t *);
794 818 scf_simple_app_props_t *scf_simple_app_props_get(scf_handle_t *, const char *);
795 819 void scf_simple_app_props_free(scf_simple_app_props_t *);
796 820 const scf_simple_prop_t *scf_simple_app_props_next(
797 821 const scf_simple_app_props_t *, scf_simple_prop_t *);
798 822 const scf_simple_prop_t *scf_simple_app_props_search(
799 823 const scf_simple_app_props_t *, const char *, const char *);
800 824 ssize_t scf_simple_prop_numvalues(const scf_simple_prop_t *);
801 825 scf_type_t scf_simple_prop_type(const scf_simple_prop_t *);
802 826 char *scf_simple_prop_name(const scf_simple_prop_t *);
803 827 char *scf_simple_prop_pgname(const scf_simple_prop_t *);
804 828 uint8_t *scf_simple_prop_next_boolean(scf_simple_prop_t *);
805 829 uint64_t *scf_simple_prop_next_count(scf_simple_prop_t *);
806 830 int64_t *scf_simple_prop_next_integer(scf_simple_prop_t *);
807 831 int64_t *scf_simple_prop_next_time(scf_simple_prop_t *, int32_t *);
808 832 char *scf_simple_prop_next_astring(scf_simple_prop_t *);
809 833 char *scf_simple_prop_next_ustring(scf_simple_prop_t *);
810 834 void *scf_simple_prop_next_opaque(scf_simple_prop_t *, size_t *);
811 835 void scf_simple_prop_next_reset(scf_simple_prop_t *);
812 836
813 837 /*
814 838 * smf_state_from_string()
815 839 * return SCF_STATE_* value for the input
816 840 * -1 on error. String "all" maps to SCF_STATE_ALL macro
817 841 */
818 842 int32_t smf_state_from_string(const char *);
819 843
820 844 /*
821 845 * smf_state_to_string()
822 846 * return SCF_STATE_STRING* value for the input
823 847 * NULL on error.
824 848 */
825 849 const char *smf_state_to_string(int32_t);
826 850
827 851 /*
828 852 * Notification interfaces
829 853 */
830 854 int smf_notify_set_params(const char *, nvlist_t *);
831 855 int smf_notify_get_params(nvlist_t **, nvlist_t *);
832 856 int smf_notify_del_params(const char *, const char *, int32_t);
833 857
834 858 /*
835 859 * SMF exit status definitions
836 860 */
837 861 #define SMF_EXIT_OK 0
838 862 #define SMF_EXIT_ERR_FATAL 95
839 863 #define SMF_EXIT_ERR_CONFIG 96
840 864 #define SMF_EXIT_MON_DEGRADE 97
841 865 #define SMF_EXIT_MON_OFFLINE 98
842 866 #define SMF_EXIT_ERR_NOSMF 99
843 867 #define SMF_EXIT_ERR_PERM 100
844 868
845 869 #ifdef __cplusplus
846 870 }
847 871 #endif
848 872
849 873 #endif /* _LIBSCF_H */
↓ open down ↓ |
640 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX