5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2016 RackTop Systems.
25 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
26 */
27
28 #ifndef _LIBSCF_H
29 #define _LIBSCF_H
30
31
32 #include <stddef.h>
33 #include <libnvpair.h>
34
35 #ifndef NATIVE_BUILD
36 #include <sys/secflags.h>
37 #endif /* NATIVE_BUILD */
38 #include <sys/types.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 typedef unsigned long scf_version_t;
45 #define SCF_VERSION 1UL
309 #define SCF_PG_STARTD_PRIVATE "svc-startd-private"
310 #define SCF_PG_DEATHROW "deathrow"
311 #define SCF_PG_MANIFESTFILES "manifestfiles"
312
313 /*
314 * Template property group names and prefixes
315 */
316 #define SCF_PG_TM_COMMON_NAME "tm_common_name"
317 #define SCF_PG_TM_DESCRIPTION "tm_description"
318
319 #define SCF_PG_TM_MAN_PREFIX "tm_man_"
320 #define SCF_PG_TM_DOC_PREFIX "tm_doc_"
321
322 /*
323 * Standard property names
324 */
325 #define SCF_PROPERTY_ACTIVE_POSTFIX "active"
326 #define SCF_PROPERTY_AUX_STATE "auxiliary_state"
327 #define SCF_PROPERTY_AUX_FMRI "auxiliary_fmri"
328 #define SCF_PROPERTY_AUX_TTY "auxiliary_tty"
329 #define SCF_PROPERTY_CONTRACT "contract"
330 #define SCF_PROPERTY_COREFILE_PATTERN "corefile_pattern"
331 #define SCF_PROPERTY_DEGRADED "degraded"
332 #define SCF_PROPERTY_DEGRADE_IMMEDIATE "degrade_immediate"
333 #define SCF_PROPERTY_DODUMP "do_dump"
334 #define SCF_PROPERTY_DURATION "duration"
335 #define SCF_PROPERTY_ENABLED "enabled"
336 #define SCF_PROPERTY_DEATHROW "deathrow"
337 #define SCF_PROPERTY_ENTITY_STABILITY "entity_stability"
338 #define SCF_PROPERTY_ENTITIES "entities"
339 #define SCF_PROPERTY_EXEC "exec"
340 #define SCF_PROPERTY_GROUP "group"
341 #define SCF_PROPERTY_GROUPING "grouping"
342 #define SCF_PROPERTY_IGNORE "ignore_error"
343 #define SCF_PROPERTY_INTERNAL_SEPARATORS "internal_separators"
344 #define SCF_PROPERTY_LIMIT_PRIVILEGES "limit_privileges"
345 #define SCF_PROPERTY_MAINT_OFF "maint_off"
346 #define SCF_PROPERTY_MAINT_ON "maint_on"
347 #define SCF_PROPERTY_MAINT_ON_IMMEDIATE "maint_on_immediate"
348 #define SCF_PROPERTY_MAINT_ON_IMMTEMP "maint_on_immtemp"
468 #define SCF_STN_PREFIX_TO "to-"
469
470 #define SCF_PG_FLAG_NONPERSISTENT 0x1
471
472 #define SCF_TRACE_LIBRARY 0x1
473 #define SCF_TRACE_DAEMON 0x2
474
475 #define SMF_IMMEDIATE 0x1
476 #define SMF_TEMPORARY 0x2
477 #define SMF_AT_NEXT_BOOT 0x4
478
479 scf_error_t scf_error(void);
480 const char *scf_strerror(scf_error_t);
481
482 ssize_t scf_limit(uint32_t code);
483 #define SCF_LIMIT_MAX_NAME_LENGTH -2000U
484 #define SCF_LIMIT_MAX_VALUE_LENGTH -2001U
485 #define SCF_LIMIT_MAX_PG_TYPE_LENGTH -2002U
486 #define SCF_LIMIT_MAX_FMRI_LENGTH -2003U
487
488 scf_handle_t *scf_handle_create(scf_version_t);
489
490 int scf_handle_decorate(scf_handle_t *, const char *, scf_value_t *);
491 #define SCF_DECORATE_CLEAR ((scf_value_t *)0)
492
493 int scf_handle_bind(scf_handle_t *);
494 int scf_handle_unbind(scf_handle_t *);
495 void scf_handle_destroy(scf_handle_t *);
496
497 int scf_type_base_type(scf_type_t type, scf_type_t *out);
498 const char *scf_type_to_string(scf_type_t);
499 scf_type_t scf_string_to_type(const char *);
500
501 /* values */
502 scf_value_t *scf_value_create(scf_handle_t *);
503 scf_handle_t *scf_value_handle(const scf_value_t *);
504 void scf_value_destroy(scf_value_t *);
505
506 scf_type_t scf_value_base_type(const scf_value_t *);
507 scf_type_t scf_value_type(const scf_value_t *);
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2016 RackTop Systems.
25 * Copyright 2020 Joyent, Inc.
26 */
27
28 #ifndef _LIBSCF_H
29 #define _LIBSCF_H
30
31
32 #include <stddef.h>
33 #include <libnvpair.h>
34
35 #ifndef NATIVE_BUILD
36 #include <sys/secflags.h>
37 #endif /* NATIVE_BUILD */
38 #include <sys/types.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 typedef unsigned long scf_version_t;
45 #define SCF_VERSION 1UL
309 #define SCF_PG_STARTD_PRIVATE "svc-startd-private"
310 #define SCF_PG_DEATHROW "deathrow"
311 #define SCF_PG_MANIFESTFILES "manifestfiles"
312
313 /*
314 * Template property group names and prefixes
315 */
316 #define SCF_PG_TM_COMMON_NAME "tm_common_name"
317 #define SCF_PG_TM_DESCRIPTION "tm_description"
318
319 #define SCF_PG_TM_MAN_PREFIX "tm_man_"
320 #define SCF_PG_TM_DOC_PREFIX "tm_doc_"
321
322 /*
323 * Standard property names
324 */
325 #define SCF_PROPERTY_ACTIVE_POSTFIX "active"
326 #define SCF_PROPERTY_AUX_STATE "auxiliary_state"
327 #define SCF_PROPERTY_AUX_FMRI "auxiliary_fmri"
328 #define SCF_PROPERTY_AUX_TTY "auxiliary_tty"
329 #define SCF_PROPERTY_COMMENT "comment"
330 #define SCF_PROPERTY_CONTRACT "contract"
331 #define SCF_PROPERTY_COREFILE_PATTERN "corefile_pattern"
332 #define SCF_PROPERTY_DEGRADED "degraded"
333 #define SCF_PROPERTY_DEGRADE_IMMEDIATE "degrade_immediate"
334 #define SCF_PROPERTY_DODUMP "do_dump"
335 #define SCF_PROPERTY_DURATION "duration"
336 #define SCF_PROPERTY_ENABLED "enabled"
337 #define SCF_PROPERTY_DEATHROW "deathrow"
338 #define SCF_PROPERTY_ENTITY_STABILITY "entity_stability"
339 #define SCF_PROPERTY_ENTITIES "entities"
340 #define SCF_PROPERTY_EXEC "exec"
341 #define SCF_PROPERTY_GROUP "group"
342 #define SCF_PROPERTY_GROUPING "grouping"
343 #define SCF_PROPERTY_IGNORE "ignore_error"
344 #define SCF_PROPERTY_INTERNAL_SEPARATORS "internal_separators"
345 #define SCF_PROPERTY_LIMIT_PRIVILEGES "limit_privileges"
346 #define SCF_PROPERTY_MAINT_OFF "maint_off"
347 #define SCF_PROPERTY_MAINT_ON "maint_on"
348 #define SCF_PROPERTY_MAINT_ON_IMMEDIATE "maint_on_immediate"
349 #define SCF_PROPERTY_MAINT_ON_IMMTEMP "maint_on_immtemp"
469 #define SCF_STN_PREFIX_TO "to-"
470
471 #define SCF_PG_FLAG_NONPERSISTENT 0x1
472
473 #define SCF_TRACE_LIBRARY 0x1
474 #define SCF_TRACE_DAEMON 0x2
475
476 #define SMF_IMMEDIATE 0x1
477 #define SMF_TEMPORARY 0x2
478 #define SMF_AT_NEXT_BOOT 0x4
479
480 scf_error_t scf_error(void);
481 const char *scf_strerror(scf_error_t);
482
483 ssize_t scf_limit(uint32_t code);
484 #define SCF_LIMIT_MAX_NAME_LENGTH -2000U
485 #define SCF_LIMIT_MAX_VALUE_LENGTH -2001U
486 #define SCF_LIMIT_MAX_PG_TYPE_LENGTH -2002U
487 #define SCF_LIMIT_MAX_FMRI_LENGTH -2003U
488
489
490 #define SCF_COMMENT_MAX_LENGTH (1024)
491
492 scf_handle_t *scf_handle_create(scf_version_t);
493
494 int scf_handle_decorate(scf_handle_t *, const char *, scf_value_t *);
495 #define SCF_DECORATE_CLEAR ((scf_value_t *)0)
496
497 int scf_handle_bind(scf_handle_t *);
498 int scf_handle_unbind(scf_handle_t *);
499 void scf_handle_destroy(scf_handle_t *);
500
501 int scf_type_base_type(scf_type_t type, scf_type_t *out);
502 const char *scf_type_to_string(scf_type_t);
503 scf_type_t scf_string_to_type(const char *);
504
505 /* values */
506 scf_value_t *scf_value_create(scf_handle_t *);
507 scf_handle_t *scf_value_handle(const scf_value_t *);
508 void scf_value_destroy(scf_value_t *);
509
510 scf_type_t scf_value_base_type(const scf_value_t *);
511 scf_type_t scf_value_type(const scf_value_t *);
|