smf-1 - API for Service Management Facility
#include <rad/client/1/smf.h> cc [ flag... ] file... -lsmf1_client [ library... ] interface Entity const char * fmri ; (ro) const char * scope ; (ro) const char * service ; (ro) smf_Dependency_t ** dependencies ; (ro) smf_Manpage_t ** manpages ; (ro) smf_Doclink_t ** doclinks ; (ro) smf_PropertyGroup_t ** pgs ; (ro) smf_Decoration_t ** decorations ; (ro) rc_err_t smf_Entity_delete(rc_instance_t *inst, smf_SmfError_t **error); rc_err_t smf_Entity_deleteCust(rc_instance_t *inst, smf_SmfError_t **error); rc_err_t smf_Entity_createPG(rc_instance_t *inst, const char *pg_name, const char *pg_type, unsigned int pg_flags, smf_SmfError_t **error); rc_err_t smf_Entity_deletePG(rc_instance_t *inst, const char *pg_name, smf_SmfError_t **error); rc_err_t smf_Entity_readPGDecorations(rc_instance_t *inst, const char *pg_name, smf_Decoration_t ***result, int *result_cnt, smf_SmfError_t **error); rc_err_t smf_Entity_deletePGCust(rc_instance_t *inst, const char *pg_name, smf_SmfError_t **error); rc_err_t smf_Entity_readProperties(rc_instance_t *inst, const char **pg_names, int pg_names_count, smf_Property_t ***result, int *result_cnt, smf_SmfError_t **error); rc_err_t smf_Entity_writeProperties(rc_instance_t *inst, smf_PropChange_t **props, int props_count, smf_SmfError_t **error); rc_err_t smf_Entity_readProperty(rc_instance_t *inst, const char *prop_name, smf_Property_t **result, smf_SmfError_t **error); rc_err_t smf_Entity_writeProperty(rc_instance_t *inst, const char *prop_name, smf_PropertyType_t prop_type, const char **values, int values_count, smf_SmfError_t **error); rc_err_t smf_Entity_deleteProperty(rc_instance_t *inst, const char *prop_name, smf_SmfError_t **error); rc_err_t smf_Entity_readPropertyDecorations(rc_instance_t *inst, const char *prop_name, smf_Decoration_t ***result, int *result_cnt, smf_SmfError_t **error); rc_err_t smf_Entity_deletePropertyCust(rc_instance_t *inst, const char *prop_name, smf_SmfError_t **error); rc_err_t smf_Entity_getCommonName(rc_instance_t *inst, const char *locale, char **result, smf_SmfError_t **error); rc_err_t smf_Entity_getDescription(rc_instance_t *inst, const char *locale, char **result, smf_SmfError_t **error); rc_err_t smf_Entity_getPGTemplates(rc_instance_t *inst, const char *locale, smf_PGTemplate_t ***result, int *result_cnt, smf_SmfError_t **error); rc_err_t smf_Entity_getPropTemplates(rc_instance_t *inst, const char *pg_name, const char *pg_type, const char *locale, smf_PropTemplate_t ***result, int *result_cnt, smf_SmfError_t **error); interface Service inherits interface Entity const char ** instances ; (ro) interface Instance inherits interface Entity const char * instance ; (ro) const char * restarter ; (ro) boolean_t enabled ; (ro) smf_SMFState_t state ; (ro) smf_ExtendedState_t * ex_state ; (ro) const char ** snapshots ; (ro) rc_err_t smf_Instance_readSnapshotPGs(rc_instance_t *inst, const char *snap_name, smf_PropertyGroup_t ***result, int *result_cnt, smf_SmfError_t **error); rc_err_t smf_Instance_readSnapshotProperties(rc_instance_t *inst, const char **pg_names, int pg_names_count, const char *snap_name, smf_Property_t ***result, int *result_cnt, smf_SmfError_t **error); rc_err_t smf_Instance_readSnapshotProperty(rc_instance_t *inst, const char *prop_name, const char *snap_name, smf_Property_t **result, smf_SmfError_t **error); rc_err_t smf_Instance_clear(rc_instance_t *inst, smf_SmfError_t **error); rc_err_t smf_Instance_restart(rc_instance_t *inst, smf_SmfError_t **error); rc_err_t smf_Instance_refresh(rc_instance_t *inst, smf_SmfError_t **error); rc_err_t smf_Instance_maintain(rc_instance_t *inst, boolean_t immediate, boolean_t temporary, smf_SmfError_t **error); rc_err_t smf_Instance_enable(rc_instance_t *inst, boolean_t temporary, smf_SmfError_t **error); rc_err_t smf_Instance_disable(rc_instance_t *inst, boolean_t temporary, smf_SmfError_t **error); rc_err_t smf_Instance_getLogInfo(rc_instance_t *inst, int max_size, smf_LogInfo_t **result, smf_SmfError_t **error); interface Master smf_StructService_t ** services ; (ro) smf_StructInstance_t ** instances ; (ro) typedef void (*smf_Master_statechange_cb_f)(rc_instance_t *inst, smf_StateChange_t *payload, struct timespec ts, void *arg); rc_err_t smf_Master_subscribe_statechange(rc_instance_t *inst, smf_Master_statechange_cb_f cb, void *arg); rc_err_t smf_Master_unsubscribe_statechange(rc_instance_t *inst, void **arg); typedef void (*smf_Master_additions_cb_f)(rc_instance_t *inst, smf_Addition_t *payload, struct timespec ts, void *arg); rc_err_t smf_Master_subscribe_additions(rc_instance_t *inst, smf_Master_additions_cb_f cb, void *arg); rc_err_t smf_Master_unsubscribe_additions(rc_instance_t *inst, void **arg); typedef void (*smf_Master_removals_cb_f)(rc_instance_t *inst, smf_Removal_t *payload, struct timespec ts, void *arg); rc_err_t smf_Master_subscribe_removals(rc_instance_t *inst, smf_Master_removals_cb_f cb, void *arg); rc_err_t smf_Master_unsubscribe_removals(rc_instance_t *inst, void **arg); Enumerated Types enum DepGrouping typedef enum smf_DepGrouping { SDG_REQUIRE_ALL = 0, SDG_REQUIRE_ANY = 1, SDG_EXCLUDE_ALL = 2, SDG_OPTIONAL_ALL = 3, } smf_DepGrouping_t; enum DepRestart typedef enum smf_DepRestart { SDR_ERROR = 0, SDR_RESTART = 1, SDR_REFRESH = 2, SDR_NONE = 3, } smf_DepRestart_t; enum PropertyType typedef enum smf_PropertyType { SPT_UNKNOWN = 0, SPT_BOOLEAN = 1, SPT_COUNT = 2, SPT_INTEGER = 3, SPT_TIME = 4, SPT_ASTRING = 5, SPT_OPAQUE = 6, SPT_USTRING = 100, SPT_URI = 200, SPT_FMRI = 201, SPT_HOST = 300, SPT_HOSTNAME = 301, SPT_NET_ADDRESS_V4 = 302, SPT_NET_ADDRESS_V6 = 303, SPT_NET_ADDRESS = 304, } smf_PropertyType_t; enum PropertyVisibility typedef enum smf_PropertyVisibility { SPV_HIDDEN = 0, SPV_READONLY = 1, SPV_READWRITE = 2, } smf_PropertyVisibility_t; enum ErrorCode typedef enum smf_ErrorCode { SEC_INTERNAL = 0, SEC_DENIED = 1, SEC_READONLY = 2, SEC_NOTFOUND = 3, SEC_EXISTS = 4, SEC_BADVALUE = 5, SEC_BADSTATE = 6, SEC_INVALID = 7, } smf_ErrorCode_t; enum ErrorTarget typedef enum smf_ErrorTarget { SET_NONE = 0, SET_SNAPSHOT = 1, SET_PROPERTYGROUP = 2, SET_PROPERTY = 3, SET_VALUE = 4, } smf_ErrorTarget_t; enum SMFState typedef enum smf_SMFState { SSMFS_NONE = 0, SSMFS_UNINIT = 1, SSMFS_MAINT = 2, SSMFS_OFFLINE = 3, SSMFS_DISABLED = 4, SSMFS_ONLINE = 5, SSMFS_DEGRADED = 6, SSMFS_LEGACY = 7, } smf_SMFState_t; Structured Types struct Dependency typedef struct smf_Dependency smf_Dependency_t; struct smf_Dependency { char *sd_name; char **sd_target; int sd_target_count; smf_DepGrouping_t sd_grouping; smf_DepRestart_t sd_restartOn; }; void smf_Dependency_free(smf_Dependency_t *in); struct Property typedef struct smf_Property smf_Property_t; struct smf_Property { char *sp_name; smf_PropertyType_t sp_type; char **sp_values; int sp_values_count; }; void smf_Property_free(smf_Property_t *in); struct Manpage typedef struct smf_Manpage smf_Manpage_t; struct smf_Manpage { char *sm_title; char *sm_section; char *sm_path; }; void smf_Manpage_free(smf_Manpage_t *in); struct Doclink typedef struct smf_Doclink smf_Doclink_t; struct smf_Doclink { char *sd_name; char *sd_uri; }; void smf_Doclink_free(smf_Doclink_t *in); struct PropertyGroup typedef struct smf_PropertyGroup smf_PropertyGroup_t; struct smf_PropertyGroup { char *spg_name; char *spg_type; unsigned int spg_flags; }; void smf_PropertyGroup_free(smf_PropertyGroup_t *in); struct PGTemplate typedef struct smf_PGTemplate smf_PGTemplate_t; struct smf_PGTemplate { char *spgt_pgname; char *spgt_pgtype; boolean_t spgt_required; char *spgt_name; char *spgt_description; }; void smf_PGTemplate_free(smf_PGTemplate_t *in); struct PropTemplate typedef struct smf_PropTemplate smf_PropTemplate_t; struct smf_PropTemplate { char *spt_propname; smf_PropertyType_t spt_proptype; boolean_t spt_required; char *spt_name; char *spt_description; char *spt_units; smf_PropertyVisibility_t spt_visibility; unsigned long long spt_cardinality_min; unsigned long long spt_cardinality_max; char **spt_separators; int spt_separators_count; }; void smf_PropTemplate_free(smf_PropTemplate_t *in); struct PropChange typedef struct smf_PropChange smf_PropChange_t; struct smf_PropChange { char *spc_name; smf_PropertyType_t spc_type; char **spc_values; int spc_values_count; }; void smf_PropChange_free(smf_PropChange_t *in); struct Decoration typedef struct smf_Decoration smf_Decoration_t; struct smf_Decoration { char *sd_layer; char *sd_bundle; struct timespec sd_modtime; char *sd_type; char **sd_values; int sd_values_count; }; void smf_Decoration_free(smf_Decoration_t *in); struct SmfError typedef struct smf_SmfError smf_SmfError_t; struct smf_SmfError { smf_ErrorCode_t sse_error; smf_ErrorTarget_t sse_target; char *sse_aux; char *sse_message; }; void smf_SmfError_free(smf_SmfError_t *in); struct ExtendedState typedef struct smf_ExtendedState smf_ExtendedState_t; struct smf_ExtendedState { smf_SMFState_t ses_state; smf_SMFState_t ses_nextState; char *ses_auxstate; struct timespec ses_stime; int ses_contractid; boolean_t ses_enabled_state; boolean_t ses_enabled_temp; }; void smf_ExtendedState_free(smf_ExtendedState_t *in); struct LogInfo typedef struct smf_LogInfo smf_LogInfo_t; struct smf_LogInfo { char *sli_name; int sli_size; struct timespec sli_MTime; rc_opaque_t *sli_contents; }; void smf_LogInfo_free(smf_LogInfo_t *in); struct StructService typedef struct smf_StructService smf_StructService_t; struct smf_StructService { char *sss_fmri; adr_name_t *sss_objectName; char **sss_instances; int sss_instances_count; }; void smf_StructService_free(smf_StructService_t *in); struct StructInstance typedef struct smf_StructInstance smf_StructInstance_t; struct smf_StructInstance { char *ssi_fmri; adr_name_t *ssi_objectName; struct timespec ssi_stime; smf_SMFState_t ssi_state; }; void smf_StructInstance_free(smf_StructInstance_t *in); struct StateChange typedef struct smf_StateChange smf_StateChange_t; struct smf_StateChange { adr_name_t *ssc_source; smf_SMFState_t ssc_state; smf_SMFState_t ssc_nextState; char *ssc_auxState; struct timespec ssc_stateTime; char *ssc_reason; }; void smf_StateChange_free(smf_StateChange_t *in); struct Addition typedef struct smf_Addition smf_Addition_t; struct smf_Addition { adr_name_t *sa_name; char *sa_frmi; smf_StructInstance_t *sa_instance; smf_StructService_t *sa_service; }; void smf_Addition_free(smf_Addition_t *in); struct Removal typedef struct smf_Removal smf_Removal_t; struct smf_Removal { char *sr_fmri; }; void smf_Removal_free(smf_Removal_t *in);
SMF-1(3rad) RAD Module Definitions SMF-1(3rad) NAME smf - API for Service Management Facility SYNOPSIS #include <rad/client/1/smf.h> cc [ flag... ] file... -lsmf1_client [ library... ] interface Entity const char * fmri ; (ro) const char * scope ; (ro) const char * service ; (ro) smf_Dependency_t ** dependencies ; (ro) smf_Manpage_t ** manpages ; (ro) smf_Doclink_t ** doclinks ; (ro) smf_PropertyGroup_t ** pgs ; (ro) smf_Decoration_t ** decorations ; (ro) rc_err_t smf_Entity_delete(rc_instance_t *inst, smf_SmfError_t **error); rc_err_t smf_Entity_deleteCust(rc_instance_t *inst, smf_SmfError_t **error); rc_err_t smf_Entity_createPG(rc_instance_t *inst, const char *pg_name, const char *pg_type, unsigned int pg_flags, smf_SmfError_t **error); rc_err_t smf_Entity_deletePG(rc_instance_t *inst, const char *pg_name, smf_SmfError_t **error); rc_err_t smf_Entity_readPGDecorations(rc_instance_t *inst, const char *pg_name, smf_Decoration_t ***result, int *result_cnt, smf_SmfError_t **error); rc_err_t smf_Entity_deletePGCust(rc_instance_t *inst, const char *pg_name, smf_SmfError_t **error); rc_err_t smf_Entity_readProperties(rc_instance_t *inst, const char **pg_names, int pg_names_count, smf_Property_t ***result, int *result_cnt, smf_SmfError_t **error); rc_err_t smf_Entity_writeProperties(rc_instance_t *inst, smf_PropChange_t **props, int props_count, smf_SmfError_t **error); rc_err_t smf_Entity_readProperty(rc_instance_t *inst, const char *prop_name, smf_Property_t **result, smf_SmfError_t **error); rc_err_t smf_Entity_writeProperty(rc_instance_t *inst, const char *prop_name, smf_PropertyType_t prop_type, const char **values, int values_count, smf_SmfError_t **error); rc_err_t smf_Entity_deleteProperty(rc_instance_t *inst, const char *prop_name, smf_SmfError_t **error); rc_err_t smf_Entity_readPropertyDecorations(rc_instance_t *inst, const char *prop_name, smf_Decoration_t ***result, int *result_cnt, smf_SmfError_t **error); rc_err_t smf_Entity_deletePropertyCust(rc_instance_t *inst, const char *prop_name, smf_SmfError_t **error); rc_err_t smf_Entity_getCommonName(rc_instance_t *inst, const char *locale, char **result, smf_SmfError_t **error); rc_err_t smf_Entity_getDescription(rc_instance_t *inst, const char *locale, char **result, smf_SmfError_t **error); rc_err_t smf_Entity_getPGTemplates(rc_instance_t *inst, const char *locale, smf_PGTemplate_t ***result, int *result_cnt, smf_SmfError_t **error); rc_err_t smf_Entity_getPropTemplates(rc_instance_t *inst, const char *pg_name, const char *pg_type, const char *locale, smf_PropTemplate_t ***result, int *result_cnt, smf_SmfError_t **error); interface Service inherits interface Entity const char ** instances ; (ro) interface Instance inherits interface Entity const char * instance ; (ro) const char * restarter ; (ro) boolean_t enabled ; (ro) smf_SMFState_t state ; (ro) smf_ExtendedState_t * ex_state ; (ro) const char ** snapshots ; (ro) rc_err_t smf_Instance_readSnapshotPGs(rc_instance_t *inst, const char *snap_name, smf_PropertyGroup_t ***result, int *result_cnt, smf_SmfError_t **error); rc_err_t smf_Instance_readSnapshotProperties(rc_instance_t *inst, const char **pg_names, int pg_names_count, const char *snap_name, smf_Property_t ***result, int *result_cnt, smf_SmfError_t **error); rc_err_t smf_Instance_readSnapshotProperty(rc_instance_t *inst, const char *prop_name, const char *snap_name, smf_Property_t **result, smf_SmfError_t **error); rc_err_t smf_Instance_clear(rc_instance_t *inst, smf_SmfError_t **error); rc_err_t smf_Instance_restart(rc_instance_t *inst, smf_SmfError_t **error); rc_err_t smf_Instance_refresh(rc_instance_t *inst, smf_SmfError_t **error); rc_err_t smf_Instance_maintain(rc_instance_t *inst, boolean_t immediate, boolean_t temporary, smf_SmfError_t **error); rc_err_t smf_Instance_enable(rc_instance_t *inst, boolean_t temporary, smf_SmfError_t **error); rc_err_t smf_Instance_disable(rc_instance_t *inst, boolean_t temporary, smf_SmfError_t **error); rc_err_t smf_Instance_getLogInfo(rc_instance_t *inst, int max_size, smf_LogInfo_t **result, smf_SmfError_t **error); interface Master smf_StructService_t ** services ; (ro) smf_StructInstance_t ** instances ; (ro) typedef void (*smf_Master_statechange_cb_f)(rc_instance_t *inst, smf_StateChange_t *payload, struct timespec ts, void *arg); rc_err_t smf_Master_subscribe_statechange(rc_instance_t *inst, smf_Master_statechange_cb_f cb, void *arg); rc_err_t smf_Master_unsubscribe_statechange(rc_instance_t *inst, void **arg); typedef void (*smf_Master_additions_cb_f)(rc_instance_t *inst, smf_Addition_t *payload, struct timespec ts, void *arg); rc_err_t smf_Master_subscribe_additions(rc_instance_t *inst, smf_Master_additions_cb_f cb, void *arg); rc_err_t smf_Master_unsubscribe_additions(rc_instance_t *inst, void **arg); typedef void (*smf_Master_removals_cb_f)(rc_instance_t *inst, smf_Removal_t *payload, struct timespec ts, void *arg); rc_err_t smf_Master_subscribe_removals(rc_instance_t *inst, smf_Master_removals_cb_f cb, void *arg); rc_err_t smf_Master_unsubscribe_removals(rc_instance_t *inst, void **arg); Enumerated Types enum DepGrouping typedef enum smf_DepGrouping { SDG_REQUIRE_ALL = 0, SDG_REQUIRE_ANY = 1, SDG_EXCLUDE_ALL = 2, SDG_OPTIONAL_ALL = 3, } smf_DepGrouping_t; enum DepRestart typedef enum smf_DepRestart { SDR_ERROR = 0, SDR_RESTART = 1, SDR_REFRESH = 2, SDR_NONE = 3, } smf_DepRestart_t; enum PropertyType typedef enum smf_PropertyType { SPT_UNKNOWN = 0, SPT_BOOLEAN = 1, SPT_COUNT = 2, SPT_INTEGER = 3, SPT_TIME = 4, SPT_ASTRING = 5, SPT_OPAQUE = 6, SPT_USTRING = 100, SPT_URI = 200, SPT_FMRI = 201, SPT_HOST = 300, SPT_HOSTNAME = 301, SPT_NET_ADDRESS_V4 = 302, SPT_NET_ADDRESS_V6 = 303, SPT_NET_ADDRESS = 304, } smf_PropertyType_t; enum PropertyVisibility typedef enum smf_PropertyVisibility { SPV_HIDDEN = 0, SPV_READONLY = 1, SPV_READWRITE = 2, } smf_PropertyVisibility_t; enum ErrorCode typedef enum smf_ErrorCode { SEC_INTERNAL = 0, SEC_DENIED = 1, SEC_READONLY = 2, SEC_NOTFOUND = 3, SEC_EXISTS = 4, SEC_BADVALUE = 5, SEC_BADSTATE = 6, SEC_INVALID = 7, } smf_ErrorCode_t; enum ErrorTarget typedef enum smf_ErrorTarget { SET_NONE = 0, SET_SNAPSHOT = 1, SET_PROPERTYGROUP = 2, SET_PROPERTY = 3, SET_VALUE = 4, } smf_ErrorTarget_t; enum SMFState typedef enum smf_SMFState { SSMFS_NONE = 0, SSMFS_UNINIT = 1, SSMFS_MAINT = 2, SSMFS_OFFLINE = 3, SSMFS_DISABLED = 4, SSMFS_ONLINE = 5, SSMFS_DEGRADED = 6, SSMFS_LEGACY = 7, } smf_SMFState_t; Structured Types struct Dependency typedef struct smf_Dependency smf_Dependency_t; struct smf_Dependency { char *sd_name; char **sd_target; int sd_target_count; smf_DepGrouping_t sd_grouping; smf_DepRestart_t sd_restartOn; }; void smf_Dependency_free(smf_Dependency_t *in); struct Property typedef struct smf_Property smf_Property_t; struct smf_Property { char *sp_name; smf_PropertyType_t sp_type; char **sp_values; int sp_values_count; }; void smf_Property_free(smf_Property_t *in); struct Manpage typedef struct smf_Manpage smf_Manpage_t; struct smf_Manpage { char *sm_title; char *sm_section; char *sm_path; }; void smf_Manpage_free(smf_Manpage_t *in); struct Doclink typedef struct smf_Doclink smf_Doclink_t; struct smf_Doclink { char *sd_name; char *sd_uri; }; void smf_Doclink_free(smf_Doclink_t *in); struct PropertyGroup typedef struct smf_PropertyGroup smf_PropertyGroup_t; struct smf_PropertyGroup { char *spg_name; char *spg_type; unsigned int spg_flags; }; void smf_PropertyGroup_free(smf_PropertyGroup_t *in); struct PGTemplate typedef struct smf_PGTemplate smf_PGTemplate_t; struct smf_PGTemplate { char *spgt_pgname; char *spgt_pgtype; boolean_t spgt_required; char *spgt_name; char *spgt_description; }; void smf_PGTemplate_free(smf_PGTemplate_t *in); struct PropTemplate typedef struct smf_PropTemplate smf_PropTemplate_t; struct smf_PropTemplate { char *spt_propname; smf_PropertyType_t spt_proptype; boolean_t spt_required; char *spt_name; char *spt_description; char *spt_units; smf_PropertyVisibility_t spt_visibility; unsigned long long spt_cardinality_min; unsigned long long spt_cardinality_max; char **spt_separators; int spt_separators_count; }; void smf_PropTemplate_free(smf_PropTemplate_t *in); struct PropChange typedef struct smf_PropChange smf_PropChange_t; struct smf_PropChange { char *spc_name; smf_PropertyType_t spc_type; char **spc_values; int spc_values_count; }; void smf_PropChange_free(smf_PropChange_t *in); struct Decoration typedef struct smf_Decoration smf_Decoration_t; struct smf_Decoration { char *sd_layer; char *sd_bundle; struct timespec sd_modtime; char *sd_type; char **sd_values; int sd_values_count; }; void smf_Decoration_free(smf_Decoration_t *in); struct SmfError typedef struct smf_SmfError smf_SmfError_t; struct smf_SmfError { smf_ErrorCode_t sse_error; smf_ErrorTarget_t sse_target; char *sse_aux; char *sse_message; }; void smf_SmfError_free(smf_SmfError_t *in); struct ExtendedState typedef struct smf_ExtendedState smf_ExtendedState_t; struct smf_ExtendedState { smf_SMFState_t ses_state; smf_SMFState_t ses_nextState; char *ses_auxstate; struct timespec ses_stime; int ses_contractid; boolean_t ses_enabled_state; boolean_t ses_enabled_temp; }; void smf_ExtendedState_free(smf_ExtendedState_t *in); struct LogInfo typedef struct smf_LogInfo smf_LogInfo_t; struct smf_LogInfo { char *sli_name; int sli_size; struct timespec sli_MTime; rc_opaque_t *sli_contents; }; void smf_LogInfo_free(smf_LogInfo_t *in); struct StructService typedef struct smf_StructService smf_StructService_t; struct smf_StructService { char *sss_fmri; adr_name_t *sss_objectName; char **sss_instances; int sss_instances_count; }; void smf_StructService_free(smf_StructService_t *in); struct StructInstance typedef struct smf_StructInstance smf_StructInstance_t; struct smf_StructInstance { char *ssi_fmri; adr_name_t *ssi_objectName; struct timespec ssi_stime; smf_SMFState_t ssi_state; }; void smf_StructInstance_free(smf_StructInstance_t *in); struct StateChange typedef struct smf_StateChange smf_StateChange_t; struct smf_StateChange { adr_name_t *ssc_source; smf_SMFState_t ssc_state; smf_SMFState_t ssc_nextState; char *ssc_auxState; struct timespec ssc_stateTime; char *ssc_reason; }; void smf_StateChange_free(smf_StateChange_t *in); struct Addition typedef struct smf_Addition smf_Addition_t; struct smf_Addition { adr_name_t *sa_name; char *sa_frmi; smf_StructInstance_t *sa_instance; smf_StructService_t *sa_service; }; void smf_Addition_free(smf_Addition_t *in); struct Removal typedef struct smf_Removal smf_Removal_t; struct smf_Removal { char *sr_fmri; }; void smf_Removal_free(smf_Removal_t *in); DESCRIPTION API com.oracle.solaris.rad.smf [1] This API exposes common SMF configuration, actions, and state to rad(8) clients. Three core interfaces are provided: 1. Master - a top-level object providing access to all services and instances on the system 2. Service - an object that represents an SMF service 3. Instance - an object that represents an SMF instance The latter two interfaces, Service and Instance, are derived from a common Entity interface. INTERFACES interface Entity functionality common to services and instances Entity Properties const char * fmri (read-only) -- the service/instance's FMRI rc_err_t smf_Entity_get_fmri(rc_instance_t *inst, char **result); Get property value. Arguments: inst -- RAD instance result -- Property value returned const char * scope (read-only) -- the service/instance's scope rc_err_t smf_Entity_get_scope(rc_instance_t *inst, char **result); Get property value. Arguments: inst -- RAD instance result -- Property value returned const char * service (read-only) -- the service name of the service/instance rc_err_t smf_Entity_get_service(rc_instance_t *inst, char **result); Get property value. Arguments: inst -- RAD instance result -- Property value returned smf_Dependency_t ** dependencies (read-only) -- the service/instance's dependencies A list of dependency objects describing the full nature of each dependency. An empty list is returned if there are no dependencies. rc_err_t smf_Entity_get_dependencies(rc_instance_t *inst, smf_Dependency_t ***result, int *result_cnt, smf_SmfError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned result_cnt -- Number of items in result array error -- An internal SMF error occurred. Read Error: smf_SmfError_t ** -- An internal SMF error occurred. smf_Manpage_t ** manpages (read-only) -- the service/instance's manual pages A list of manual page objects describing the name, section, and path of each relevant manual page. An empty list is returned if no manual pages are defined. rc_err_t smf_Entity_get_manpages(rc_instance_t *inst, smf_Manpage_t ***result, int *result_cnt, smf_SmfError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned result_cnt -- Number of items in result array error -- An internal SMF error occurred. Read Error: smf_SmfError_t ** -- An internal SMF error occurred. smf_Doclink_t ** doclinks (read-only) -- documentation links A list of links to on-line documentation for the service/instance. An empty list is returned if no on-line documents are defined. rc_err_t smf_Entity_get_doclinks(rc_instance_t *inst, smf_Doclink_t ***result, int *result_cnt, smf_SmfError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned result_cnt -- Number of items in result array error -- An internal SMF error occurred. Read Error: smf_SmfError_t ** -- An internal SMF error occurred. smf_PropertyGroup_t ** pgs (read-only) -- directly-attached property groups A list of all directly-attached property groups, including name, type and flags for each. rc_err_t smf_Entity_get_pgs(rc_instance_t *inst, smf_PropertyGroup_t ***result, int *result_cnt, smf_SmfError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned result_cnt -- Number of items in result array error -- An internal SMF error occurred. Read Error: smf_SmfError_t ** -- An internal SMF error occurred. smf_Decoration_t ** decorations (read-only) -- list of decorations A list of decorations associated with the service/instance. rc_err_t smf_Entity_get_decorations(rc_instance_t *inst, smf_Decoration_t ***result, int *result_cnt, smf_SmfError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned result_cnt -- Number of items in result array error -- An internal SMF error occurred. Read Error: smf_SmfError_t ** -- An internal SMF error occurred. Entity Methods rc_err_t smf_Entity_delete(rc_instance_t *inst, smf_SmfError_t **error); delete the service/instance Delete the service or instance. Arguments: inst -- RAD instance error Failed to delete the service or instance. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only o EXISTS - delete was called on a service and the service still had instances rc_err_t smf_Entity_deleteCust(rc_instance_t *inst, smf_SmfError_t **error); delete administrative customizations Delete all administrative customizations applied to a service/instance and its children, if any exist. Arguments: inst -- RAD instance error Failed to delete the administrative customizations applied to a service or instance. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only rc_err_t smf_Entity_createPG(rc_instance_t *inst, const char *pg_name, const char *pg_type, unsigned int pg_flags, smf_SmfError_t **error); create a property group Create a property group on the service/instance. Arguments: inst -- RAD instance pg_name -- the name of the new property group pg_type -- the type of the new property group pg_flags -- the property group flags error Failed to create the property group. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only o EXISTS - the propery group already exists o BADVALUE - an invalid property group name or type was specified rc_err_t smf_Entity_deletePG(rc_instance_t *inst, const char *pg_name, smf_SmfError_t **error); delete a property group Delete a directly-attached property group and all its properties from the service/instance. Arguments: inst -- RAD instance pg_name -- the name of the property group error Failed to delete the property group. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only o NOTFOUND - the property group doesn't exist rc_err_t smf_Entity_readPGDecorations(rc_instance_t *inst, const char *pg_name, smf_Decoration_t ***result, int *result_cnt, smf_SmfError_t **error); obtain a list of decorations Obtain all the decorations associated with this property group. Arguments: inst -- RAD instance pg_name -- the name of the property group result -- list of available decorations result_cnt -- Number of items in result array error Failed to read the property group decorations. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o NOTFOUND - the property group doesn't exist (see target) rc_err_t smf_Entity_deletePGCust(rc_instance_t *inst, const char *pg_name, smf_SmfError_t **error); delete administrative customizations Delete all administrative customizations applied to a property group and its children, if any exist. Arguments: inst -- RAD instance pg_name -- the name of the property group error Failed to delete the administrative customizations applied to a property group. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only o NOTFOUND - the property group doesn't exist rc_err_t smf_Entity_readProperties(rc_instance_t *inst, const char **pg_names, int pg_names_count, smf_Property_t ***result, int *result_cnt, smf_SmfError_t **error); reads all properties in a set of directly-attached property groups. Read all properties in the specified directly-attached property group. The name, type, and values of each property are included. Arguments: inst -- RAD instance pg_names (nullable) -- The names of the property groups. If this value is Null, all property groups will be read. pg_names_count -- Number of items in pg_names array result -- a list of properties in the specified directly-attached property group result_cnt -- Number of items in result array error Failed to read properties from the property group. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o NOTFOUND - the property group doesn't exist rc_err_t smf_Entity_writeProperties(rc_instance_t *inst, smf_PropChange_t **props, int props_count, smf_SmfError_t **error); commit a list of property changes to a property group Commit a set of property changes to the specified property group. Each property change specifies a property, type, and optional set of values. If the property specified by a property change doesn't exist prior to the call, it will be created by the call. If the property specified by a property change exists prior to the call but has a different type, its type will be set to the type specified by the call. If the call succeeds, all the requested property changes were made. If the call fails, none of the requested changes were made. Arguments: inst -- RAD instance props -- the set of changes to apply props_count -- Number of items in props array error Failed to make all the requested property changes. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only o NOTFOUND - the property group doesn't exist (see target) o BADVALUE - a property had an invalid name, or a value couldn't be converted to the requested type (see target, aux) o INVALID - the same property was referenced by two PropertyChanges. When an invidual property is the cause of the error, its name will be returned in aux. rc_err_t smf_Entity_readProperty(rc_instance_t *inst, const char *prop_name, smf_Property_t **result, smf_SmfError_t **error); read a single directly-attached property's values Read a single property from the specified directly-attached property group. The result includes the name, type, and values of the property. Arguments: inst -- RAD instance prop_name -- the name of the property result -- the specified property error Failed to read the specified property. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o NOTFOUND - the property or property group doesn't exist (see target) rc_err_t smf_Entity_writeProperty(rc_instance_t *inst, const char *prop_name, smf_PropertyType_t prop_type, const char **values, int values_count, smf_SmfError_t **error); writes a list of values to a property Change the specified property. If the property doesn't exist prior to the call, it will be created by the call. If the property exists prior to the call but has a different type, its type will be set to the type specified by the call. Arguments: inst -- RAD instance prop_name -- the name of the property prop_type -- the type of the property values -- the new values for the property values_count -- Number of items in values array error Failed to make the requested property change. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only o NOTFOUND - the property group doesn't exist (see target) o BADVALUE - the property had an invalid name, or a value couldn't be converted to the requested type (see target) rc_err_t smf_Entity_deleteProperty(rc_instance_t *inst, const char *prop_name, smf_SmfError_t **error); delete a property Delete a property from the service/instance. Arguments: inst -- RAD instance prop_name -- the name of the property error Failed to delete the property. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only o NOTFOUND - the property group doesn't exist, or the property to be deleted doesn't exist (see target) o BADVALUE - the property had an invalid name or type (see target) o INVALID - the property cannot be deleted while in use (see target) rc_err_t smf_Entity_readPropertyDecorations(rc_instance_t *inst, const char *prop_name, smf_Decoration_t ***result, int *result_cnt, smf_SmfError_t **error); obtain a list of decorations Obtain all the decorations associated with this property. Arguments: inst -- RAD instance prop_name -- the name of the property result -- list of available decorations result_cnt -- Number of items in result array error Failed to read the property decorations. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o NOTFOUND - the property or property group doesn't exist (see target) rc_err_t smf_Entity_deletePropertyCust(rc_instance_t *inst, const char *prop_name, smf_SmfError_t **error); delete administrative customizations Delete all administrative customizations applied to this property. Arguments: inst -- RAD instance prop_name -- the name of the property error Failed to delete the administrative customizations applied to this property. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only o NOTFOUND - the property group, or property doesn't exist (see target) rc_err_t smf_Entity_getCommonName(rc_instance_t *inst, const char *locale, char **result, smf_SmfError_t **error); obtain the service/instance's localized common name Obtain the localized common name for the service/instance, if one exists. If a common name doesn't exist for the specified locale, attempts to return the common name for the "C" locale instead. Arguments: inst -- RAD instance locale -- the desired locale result -- the common name if available, or null error -- An internal error occurred. rc_err_t smf_Entity_getDescription(rc_instance_t *inst, const char *locale, char **result, smf_SmfError_t **error); obtain the service/instance's localized description Obtain the localized description for the service/instance, if one exists. If a description doesn't exist for the specified locale, attempts to return the description for the "C" locale instead. Arguments: inst -- RAD instance locale -- the desired locale result -- the description if available, or null error -- An internal error occurred. rc_err_t smf_Entity_getPGTemplates(rc_instance_t *inst, const char *locale, smf_PGTemplate_t ***result, int *result_cnt, smf_SmfError_t **error); obtain all property group templates Obtain all property group templates for this service/instance. If templates aren't provided for the specified locale, attempts to return the templates for the "C" locale instead. Arguments: inst -- RAD instance locale -- the desired locale result -- all available property group templates result_cnt -- Number of items in result array error -- An internal error occurred. rc_err_t smf_Entity_getPropTemplates(rc_instance_t *inst, const char *pg_name, const char *pg_type, const char *locale, smf_PropTemplate_t ***result, int *result_cnt, smf_SmfError_t **error); obtain all property templates for a property group Obtain all property templates for the specified property group of this service/instance. If property templates aren't provided for the specified locale, attempts to return the templates for the "C" locale instead. If no templates exist for properties of the specified property group, an empty list is returned. Arguments: inst -- RAD instance pg_name -- the name of the property group pg_type -- the type of the property group locale -- the desired locale result -- all available property templates result_cnt -- Number of items in result array error -- An internal error occurred. Entity Retrieve rc_err_t smf_Entity__rad_get_name(adr_name_t **result, int n, ...); Obtain RAD name of a Entity object. Arguments: result -- RAD name n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t smf_Entity__rad_lookup(rc_conn_t *c, boolean_t strict, rc_instance_t **result, int n, ...); Lookup a Entity instance. Construct a RAD name for the interface based on the provided key-value pairs and perform a lookup. If successful, instance reference is returned in the result. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning result -- RAD instance n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t smf_Entity__rad_list(rc_conn_t *c, boolean_t strict, adr_pattern_scheme_t scheme, adr_name_t ***result, int *result_count, int n, ...); List RAD names of a available Entity instances. Returns an array and array size of matching object names. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning scheme -- Apply glob (NS_GLOB) or regex (NS_REGEX) matching result -- Array of RAD names result_count -- Number of names in result array n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key interface Service an SMF service object Inheritance Hierarchy. .-> interface Entity | interface Service The Service interface is an Entity that represents an SMF service. Handles to this type of object can be retrieved from the RAD server using an object name built with: 1. the "com.oracle.solaris.rad.smf" domain name 2. a key named "type" paired with a value of "Service" 3. a key named "service" paired with the service portion of an SMF FMRI Object names for services can be pulled from the Services exposed by the Master.services property. Or, they can be built directly: Service Properties const char ** instances (read-only) -- the list of instances of this service The list of instances of this service. An empty list if the service has no instances. rc_err_t smf_Service_get_instances(rc_instance_t *inst, char ***result, int *result_cnt, smf_SmfError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned result_cnt -- Number of items in result array error -- An internal SMF error occurred. Read Error: smf_SmfError_t ** -- An internal SMF error occurred. Inherited Properties (Entity): fmri, scope, service, dependencies, manpages, doclinks, pgs, decorations Service Methods Inherited Methods (Entity): delete, deleteCust, createPG, deletePG, readPGDecorations, deletePGCust, readProperties, writeProperties, readProperty, writeProperty, deleteProperty, readPropertyDecorations, deletePropertyCust, getCommonName, getDescription, getPGTemplates, getPropTemplates Service Retrieve rc_err_t smf_Service__rad_get_name(adr_name_t **result, int n, ...); Obtain RAD name of a Service object. Arguments: result -- RAD name n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t smf_Service__rad_lookup(rc_conn_t *c, boolean_t strict, rc_instance_t **result, int n, ...); Lookup a Service instance. Construct a RAD name for the interface based on the provided key-value pairs and perform a lookup. If successful, instance reference is returned in the result. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning result -- RAD instance n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t smf_Service__rad_list(rc_conn_t *c, boolean_t strict, adr_pattern_scheme_t scheme, adr_name_t ***result, int *result_count, int n, ...); List RAD names of a available Service instances. Returns an array and array size of matching object names. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning scheme -- Apply glob (NS_GLOB) or regex (NS_REGEX) matching result -- Array of RAD names result_count -- Number of names in result array n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key interface Instance an SMF instance object Inheritance Hierarchy. .-> interface Entity | interface Instance The Instance interface is an Entity that represents an SMF instance. Handles to this type of object can be retrieved from the RAD server using an object name built with: 1. the "com.oracle.solaris.rad.smf" domain name 2. a key named "type" paired with a value of "Instance" 3. a key named "service" paired with the service portion of an SMF FMRI 4. a key named "instance" paired with the instance portion of an SMF FMRI Object names for instances can be pulled from the Instances exposed by the Master.instances property. Or, they can be built directly: Instance Properties const char * instance (read-only) -- the name of the instance rc_err_t smf_Instance_get_instance(rc_instance_t *inst, char **result); Get property value. Arguments: inst -- RAD instance result -- Property value returned const char * restarter (read-only) -- the fmri of the instance's restarter rc_err_t smf_Instance_get_restarter(rc_instance_t *inst, char **result, smf_SmfError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned error -- An internal SMF error occurred. Read Error: smf_SmfError_t ** -- An internal SMF error occurred. boolean_t enabled (read-only) -- is the instance effectively enabled? rc_err_t smf_Instance_get_enabled(rc_instance_t *inst, boolean_t *result, smf_SmfError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned error -- An internal SMF error occurred. Read Error: smf_SmfError_t ** -- An internal SMF error occurred. smf_SMFState_t state (read-only) -- the current state of the instance rc_err_t smf_Instance_get_state(rc_instance_t *inst, smf_SMFState_t *result, smf_SmfError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned error -- An internal SMF error occurred. Read Error: smf_SmfError_t ** -- An internal SMF error occurred. smf_ExtendedState_t * ex_state (read-only) -- the extended state of the instance rc_err_t smf_Instance_get_ex_state(rc_instance_t *inst, smf_ExtendedState_t **result, smf_SmfError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned error -- An internal SMF error occurred. Read Error: smf_SmfError_t ** -- An internal SMF error occurred. const char ** snapshots (read-only) -- a list of the instance's snapshots rc_err_t smf_Instance_get_snapshots(rc_instance_t *inst, char ***result, int *result_cnt, smf_SmfError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned result_cnt -- Number of items in result array error -- An internal SMF error occurred. Read Error: smf_SmfError_t ** -- An internal SMF error occurred. Inherited Properties (Entity): fmri, scope, service, dependencies, manpages, doclinks, pgs, decorations Instance Methods rc_err_t smf_Instance_readSnapshotPGs(rc_instance_t *inst, const char *snap_name, smf_PropertyGroup_t ***result, int *result_cnt, smf_SmfError_t **error); read all property groups in the composed view of the specified snapshot Arguments: inst -- RAD instance snap_name (nullable) -- the name of the snapshot, or null for the running snapshot result result_cnt -- Number of items in result array error Failed to read the list of property groups. Cause: o INTERNAL - an internal error occurred o NOTFOUND - the snapshot doesn't exist rc_err_t smf_Instance_readSnapshotProperties(rc_instance_t *inst, const char **pg_names, int pg_names_count, const char *snap_name, smf_Property_t ***result, int *result_cnt, smf_SmfError_t **error); reads all properties in the composed view of the specified snapshot of a property group Arguments: inst -- RAD instance pg_names (nullable) -- the name of the property group pg_names_count -- Number of items in pg_names array snap_name (nullable) -- the name of the snapshot, or null for the running snapshot result result_cnt -- Number of items in result array error Failed to read properties from the snapshot's composed view of the specified property group. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o NOTFOUND - the property group or snapshot doesn't exist (see target) rc_err_t smf_Instance_readSnapshotProperty(rc_instance_t *inst, const char *prop_name, const char *snap_name, smf_Property_t **result, smf_SmfError_t **error); reads a property in the composed view of the specified snapshot Reads a single property from the composed view of the specified property group. The result includes the name, type, and values of the property. Arguments: inst -- RAD instance prop_name -- the name of the property snap_name (nullable) -- the name of the snapshot, or null for the running snapshot result error Failed to read the property. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o NOTFOUND - the snapshot, property group, or property doesn't exist (see target) rc_err_t smf_Instance_clear(rc_instance_t *inst, smf_SmfError_t **error); clear the instance if degraded or in maintenance Attempt to clear the maintenance or degraded state from the instance. This operation occurs asynchronously, and will return success even though the attempt could fail. Arguments: inst -- RAD instance error Was unable to attempt clearing the instance. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only o BADSTATE - the instance wasn't in the maintenance or degraded state rc_err_t smf_Instance_restart(rc_instance_t *inst, smf_SmfError_t **error); restarts the instance Attempt to restart the instance. This operation occurs asynchronously, and will return success even though the attempt could fail. Arguments: inst -- RAD instance error Was unable to attempt restarting the instance. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only rc_err_t smf_Instance_refresh(rc_instance_t *inst, smf_SmfError_t **error); refresh the instance Attempt to refresh the instance. This operation occurs asynchronously, and will return success even though the attempt could fail. Arguments: inst -- RAD instance error Was unable to attempt restarting the instance. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only rc_err_t smf_Instance_maintain(rc_instance_t *inst, boolean_t immediate, boolean_t temporary, smf_SmfError_t **error); place the instance in maintenance Attempt to place the instance in maintenance. This operation occurs asynchronously, and will return success even though the attempt could fail. Arguments: inst -- RAD instance immediate -- skip attempting a clean shutdown temporary -- maintenance doesn't persist after reboot error Was unable to attempt to place the instance in maintenance. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only rc_err_t smf_Instance_enable(rc_instance_t *inst, boolean_t temporary, smf_SmfError_t **error); enable the instance Enable the instance. This operation is idempotent; enabling an enabled instance has no effect. Arguments: inst -- RAD instance temporary -- enable doesn't persist after reboot error Was unable to enable the instance. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only rc_err_t smf_Instance_disable(rc_instance_t *inst, boolean_t temporary, smf_SmfError_t **error); disable the instance Disable the instance. This operation is idempotent; disabling a disabled instance has no effect. Arguments: inst -- RAD instance temporary -- disable doesn't persist after reboot error Was unable to disable the instance. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o READONLY - the repository is read-only rc_err_t smf_Instance_getLogInfo(rc_instance_t *inst, int max_size, smf_LogInfo_t **result, smf_SmfError_t **error); obtain instance log file data Obtain information from and about the instance's log file. Includes the name, size, modification time, and contents. Arguments: inst -- RAD instance max_size -- bytes of log file content to return result -- the requested log file data error Was unable to obtain log data. Cause: o INTERNAL - an internal error occurred o DENIED - insufficient authorization o NOTFOUND - no log file found Inherited Methods (Entity): delete, deleteCust, createPG, deletePG, readPGDecorations, deletePGCust, readProperties, writeProperties, readProperty, writeProperty, deleteProperty, readPropertyDecorations, deletePropertyCust, getCommonName, getDescription, getPGTemplates, getPropTemplates Instance Retrieve rc_err_t smf_Instance__rad_get_name(adr_name_t **result, int n, ...); Obtain RAD name of a Instance object. Arguments: result -- RAD name n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t smf_Instance__rad_lookup(rc_conn_t *c, boolean_t strict, rc_instance_t **result, int n, ...); Lookup a Instance instance. Construct a RAD name for the interface based on the provided key-value pairs and perform a lookup. If successful, instance reference is returned in the result. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning result -- RAD instance n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t smf_Instance__rad_list(rc_conn_t *c, boolean_t strict, adr_pattern_scheme_t scheme, adr_name_t ***result, int *result_count, int n, ...); List RAD names of a available Instance instances. Returns an array and array size of matching object names. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning scheme -- Apply glob (NS_GLOB) or regex (NS_REGEX) matching result -- Array of RAD names result_count -- Number of names in result array n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key interface Master a top-level object providing access to all services and instances on the system The Master interface provides an iterative entrypoint into the SMF subsystem. Handles to this type of object can be retrieved from the RAD server using an object name built with: 1. the "com.oracle.solaris.rad.smf" domain name 2. a key named "type" paired with a value of "Master" For example, to report the number of services in the ONLINE state: Master Properties smf_StructService_t ** services (read-only) rc_err_t smf_Master_get_services(rc_instance_t *inst, smf_StructService_t ***result, int *result_cnt, smf_SmfError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned result_cnt -- Number of items in result array error Read Error: smf_SmfError_t ** smf_StructInstance_t ** instances (read-only) rc_err_t smf_Master_get_instances(rc_instance_t *inst, smf_StructInstance_t ***result, int *result_cnt, smf_SmfError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned result_cnt -- Number of items in result array error Read Error: smf_SmfError_t ** Master Retrieve rc_err_t smf_Master__rad_get_name(adr_name_t **result, int n, ...); Obtain RAD name of a Master object. Arguments: result -- RAD name n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t smf_Master__rad_lookup(rc_conn_t *c, boolean_t strict, rc_instance_t **result, int n, ...); Lookup a Master instance. Construct a RAD name for the interface based on the provided key-value pairs and perform a lookup. If successful, instance reference is returned in the result. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning result -- RAD instance n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t smf_Master__rad_list(rc_conn_t *c, boolean_t strict, adr_pattern_scheme_t scheme, adr_name_t ***result, int *result_count, int n, ...); List RAD names of a available Master instances. Returns an array and array size of matching object names. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning scheme -- Apply glob (NS_GLOB) or regex (NS_REGEX) matching result -- Array of RAD names result_count -- Number of names in result array n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key Master Events statechange typedef void (*smf_Master_statechange_cb_f)(rc_instance_t *inst, smf_StateChange_t *payload, struct timespec ts, void *arg); Function invoked when event "statechange" occurs. Arguments: inst -- RAD instance that generated the event payload -- Event payload ts -- Time stamp arg -- User data: custom parameter to invoke the function with rc_err_t smf_Master_subscribe_statechange(rc_instance_t *inst, smf_Master_statechange_cb_f cb, void *arg); Subscribe to event "statechange". Arguments: inst -- RAD instance cb -- Event callback function arg -- User data: custom parameter to invoke the function with rc_err_t smf_Master_unsubscribe_statechange(rc_instance_t *inst, void **arg); Unsubscribe from event "statechange". Arguments: inst -- RAD instance arg -- User data returned additions typedef void (*smf_Master_additions_cb_f)(rc_instance_t *inst, smf_Addition_t *payload, struct timespec ts, void *arg); Function invoked when event "additions" occurs. Arguments: inst -- RAD instance that generated the event payload -- Event payload ts -- Time stamp arg -- User data: custom parameter to invoke the function with rc_err_t smf_Master_subscribe_additions(rc_instance_t *inst, smf_Master_additions_cb_f cb, void *arg); Subscribe to event "additions". Arguments: inst -- RAD instance cb -- Event callback function arg -- User data: custom parameter to invoke the function with rc_err_t smf_Master_unsubscribe_additions(rc_instance_t *inst, void **arg); Unsubscribe from event "additions". Arguments: inst -- RAD instance arg -- User data returned removals typedef void (*smf_Master_removals_cb_f)(rc_instance_t *inst, smf_Removal_t *payload, struct timespec ts, void *arg); Function invoked when event "removals" occurs. Arguments: inst -- RAD instance that generated the event payload -- Event payload ts -- Time stamp arg -- User data: custom parameter to invoke the function with rc_err_t smf_Master_subscribe_removals(rc_instance_t *inst, smf_Master_removals_cb_f cb, void *arg); Subscribe to event "removals". Arguments: inst -- RAD instance cb -- Event callback function arg -- User data: custom parameter to invoke the function with rc_err_t smf_Master_unsubscribe_removals(rc_instance_t *inst, void **arg); Unsubscribe from event "removals". Arguments: inst -- RAD instance arg -- User data returned ENUMERATED TYPES enum DepGrouping -- indicates how dependencies are evaluated typedef enum smf_DepGrouping { SDG_REQUIRE_ALL = 0, SDG_REQUIRE_ANY = 1, SDG_EXCLUDE_ALL = 2, SDG_OPTIONAL_ALL = 3, } smf_DepGrouping_t; SDG_REQUIRE_ALL (0) -- all dependencies must be satisfied SDG_REQUIRE_ANY (1) -- only one dependency must be satisfied SDG_EXCLUDE_ALL (2) -- no dependency may be satisfied SDG_OPTIONAL_ALL (3) -- all satisfiable dependencies must be satisfied enum DepRestart -- describes when the dependent should be restarted typedef enum smf_DepRestart { SDR_ERROR = 0, SDR_RESTART = 1, SDR_REFRESH = 2, SDR_NONE = 3, } smf_DepRestart_t; SDR_ERROR (0) -- restart when a dependency encounters an error SDR_RESTART (1) -- restart any time a dependency restarts SDR_REFRESH (2) -- restart when a dependency is refreshed SDR_NONE (3) -- only process dependencies when starting instance enum PropertyType -- an SMF property type typedef enum smf_PropertyType { SPT_UNKNOWN = 0, SPT_BOOLEAN = 1, SPT_COUNT = 2, SPT_INTEGER = 3, SPT_TIME = 4, SPT_ASTRING = 5, SPT_OPAQUE = 6, SPT_USTRING = 100, SPT_URI = 200, SPT_FMRI = 201, SPT_HOST = 300, SPT_HOSTNAME = 301, SPT_NET_ADDRESS_V4 = 302, SPT_NET_ADDRESS_V6 = 303, SPT_NET_ADDRESS = 304, } smf_PropertyType_t; SPT_UNKNOWN (0) SPT_BOOLEAN (1) SPT_COUNT (2) SPT_INTEGER (3) SPT_TIME (4) SPT_ASTRING (5) SPT_OPAQUE (6) SPT_USTRING (100) SPT_URI (200) SPT_FMRI (201) SPT_HOST (300) SPT_HOSTNAME (301) SPT_NET_ADDRESS_V4 (302) SPT_NET_ADDRESS_V6 (303) SPT_NET_ADDRESS (304) enum PropertyVisibility -- the recommended visibility of a property typedef enum smf_PropertyVisibility { SPV_HIDDEN = 0, SPV_READONLY = 1, SPV_READWRITE = 2, } smf_PropertyVisibility_t; SPV_HIDDEN (0) -- the property shouldn't be displayed SPV_READONLY (1) -- the property isn't intended to be modified SPV_READWRITE (2) -- the property is modifiable enum ErrorCode -- the general cause for failure typedef enum smf_ErrorCode { SEC_INTERNAL = 0, SEC_DENIED = 1, SEC_READONLY = 2, SEC_NOTFOUND = 3, SEC_EXISTS = 4, SEC_BADVALUE = 5, SEC_BADSTATE = 6, SEC_INVALID = 7, } smf_ErrorCode_t; Indicates the general cause for failure. Specific meanings are defined by the individual APIs. SEC_INTERNAL (0) -- an internal error occurred SEC_DENIED (1) -- access denied SEC_READONLY (2) -- configuration database is read only SEC_NOTFOUND (3) -- named object wasn't found SEC_EXISTS (4) -- name is already in use SEC_BADVALUE (5) -- an illegal value was supplied SEC_BADSTATE (6) -- system was in an invalid state SEC_INVALID (7) -- API was called incorrectly enum ErrorTarget typedef enum smf_ErrorTarget { SET_NONE = 0, SET_SNAPSHOT = 1, SET_PROPERTYGROUP = 2, SET_PROPERTY = 3, SET_VALUE = 4, } smf_ErrorTarget_t; SET_NONE (0) SET_SNAPSHOT (1) SET_PROPERTYGROUP (2) SET_PROPERTY (3) SET_VALUE (4) enum SMFState -- the state of an SMF instance typedef enum smf_SMFState { SSMFS_NONE = 0, SSMFS_UNINIT = 1, SSMFS_MAINT = 2, SSMFS_OFFLINE = 3, SSMFS_DISABLED = 4, SSMFS_ONLINE = 5, SSMFS_DEGRADED = 6, SSMFS_LEGACY = 7, } smf_SMFState_t; SSMFS_NONE (0) SSMFS_UNINIT (1) SSMFS_MAINT (2) SSMFS_OFFLINE (3) SSMFS_DISABLED (4) SSMFS_ONLINE (5) SSMFS_DEGRADED (6) SSMFS_LEGACY (7) STRUCTURED TYPES struct Dependency -- describes a dependency group typedef struct smf_Dependency smf_Dependency_t; struct smf_Dependency { char *sd_name; char **sd_target; int sd_target_count; smf_DepGrouping_t sd_grouping; smf_DepRestart_t sd_restartOn; }; void smf_Dependency_free(smf_Dependency_t *in); Fully describes a dependency group, including the FMRIs for the dependencies, the type of dependency, and when the dependency should be evaluated. Fields: sd_name -- the name of the dependency group sd_target -- the list of dependencies' FMRIs sd_target_count sd_grouping -- how the dependencies are evaluated sd_restartOn -- when the dependent should be restarted struct Property -- an SMF property and its values typedef struct smf_Property smf_Property_t; struct smf_Property { char *sp_name; smf_PropertyType_t sp_type; char **sp_values; int sp_values_count; }; void smf_Property_free(smf_Property_t *in); Describes a property, its type, and all its values. Fields: sp_name -- the name of the property sp_type -- the type of the property sp_values -- all the property's values A list of all the values held by the property. A single-valued property will have a list of length 1. A property with no values will have a list of length 0. sp_values_count struct Manpage -- a description of a man page typedef struct smf_Manpage smf_Manpage_t; struct smf_Manpage { char *sm_title; char *sm_section; char *sm_path; }; void smf_Manpage_free(smf_Manpage_t *in); Provides all the information needed to find a man page. The referenced man page can be displayed by running MANPATH=$path man -s $section $title. Fields: sm_title -- the man page name sm_section -- the section the man page is found in sm_path -- the path the man page is found in The colon-separated MANPATH the man page is found in. If this field has no value, the default MANPATH should to be used. struct Doclink -- an on-line documentation link typedef struct smf_Doclink smf_Doclink_t; struct smf_Doclink { char *sd_name; char *sd_uri; }; void smf_Doclink_free(smf_Doclink_t *in); Fields: sd_name -- an informative name for the document sd_uri -- the URI of the document struct PropertyGroup -- an SMF property group typedef struct smf_PropertyGroup smf_PropertyGroup_t; struct smf_PropertyGroup { char *spg_name; char *spg_type; unsigned int spg_flags; }; void smf_PropertyGroup_free(smf_PropertyGroup_t *in); Fields: spg_name -- the name of the property group spg_type -- the type of the property group spg_flags -- the property group flags struct PGTemplate -- template data for a property group typedef struct smf_PGTemplate smf_PGTemplate_t; struct smf_PGTemplate { char *spgt_pgname; char *spgt_pgtype; boolean_t spgt_required; char *spgt_name; char *spgt_description; }; void smf_PGTemplate_free(smf_PGTemplate_t *in); Fields: spgt_pgname -- the property group name spgt_pgtype -- the property group type spgt_required -- is the property group required? spgt_name -- a localized name spgt_description -- a localized description struct PropTemplate -- template data for a property typedef struct smf_PropTemplate smf_PropTemplate_t; struct smf_PropTemplate { char *spt_propname; smf_PropertyType_t spt_proptype; boolean_t spt_required; char *spt_name; char *spt_description; char *spt_units; smf_PropertyVisibility_t spt_visibility; unsigned long long spt_cardinality_min; unsigned long long spt_cardinality_max; char **spt_separators; int spt_separators_count; }; void smf_PropTemplate_free(smf_PropTemplate_t *in); Fields: spt_propname -- the name of the property spt_proptype -- the type of the property spt_required -- is the property required? spt_name -- a localized name spt_description -- a localized description spt_units -- a localized units label spt_visibility -- how the property should be presented spt_cardinality_min -- the minimum number of values spt_cardinality_max -- the maximum number of values spt_separators -- value separator characters Separator characters used to embed multiple values in a single property value. spt_separators_count struct PropChange -- a change to make to a property typedef struct smf_PropChange smf_PropChange_t; struct smf_PropChange { char *spc_name; smf_PropertyType_t spc_type; char **spc_values; int spc_values_count; }; void smf_PropChange_free(smf_PropChange_t *in); Fields: spc_name -- the property to change spc_type -- the type of the property to write spc_values -- a list of values spc_values_count struct Decoration -- an SMF entity decoration typedef struct smf_Decoration smf_Decoration_t; struct smf_Decoration { char *sd_layer; char *sd_bundle; struct timespec sd_modtime; char *sd_type; char **sd_values; int sd_values_count; }; void smf_Decoration_free(smf_Decoration_t *in); Fields: sd_layer -- the layer associated with this decoration sd_bundle -- the bundle associated with this decoration sd_modtime -- the last modification time sd_type -- the decoration value type sd_values -- a list of decoration values. This is only valid for property decorations. sd_values_count struct SmfError typedef struct smf_SmfError smf_SmfError_t; struct smf_SmfError { smf_ErrorCode_t sse_error; smf_ErrorTarget_t sse_target; char *sse_aux; char *sse_message; }; void smf_SmfError_free(smf_SmfError_t *in); Fields: sse_error sse_target sse_aux sse_message struct ExtendedState -- extended instance state information typedef struct smf_ExtendedState smf_ExtendedState_t; struct smf_ExtendedState { smf_SMFState_t ses_state; smf_SMFState_t ses_nextState; char *ses_auxstate; struct timespec ses_stime; int ses_contractid; boolean_t ses_enabled_state; boolean_t ses_enabled_temp; }; void smf_ExtendedState_free(smf_ExtendedState_t *in); Fields: ses_state -- the current state of the instance ses_nextState -- the next state of the instance ses_auxstate -- the auxiliary state of the instance ses_stime -- the time of last state change ses_contractid -- the contract ID, or -1 if none ses_enabled_state -- is the instance enabled or disabled? ses_enabled_temp -- is the instance enabled/disabled temporarily? Indicates if the instance's enabled/disabled state is temporary. struct LogInfo -- instance log data typedef struct smf_LogInfo smf_LogInfo_t; struct smf_LogInfo { char *sli_name; int sli_size; struct timespec sli_MTime; rc_opaque_t *sli_contents; }; void smf_LogInfo_free(smf_LogInfo_t *in); Fields: sli_name -- the log file's name sli_size -- the log file's size sli_MTime -- the log file's modification time sli_contents -- log file contents struct StructService typedef struct smf_StructService smf_StructService_t; struct smf_StructService { char *sss_fmri; adr_name_t *sss_objectName; char **sss_instances; int sss_instances_count; }; void smf_StructService_free(smf_StructService_t *in); Fields: sss_fmri sss_objectName sss_instances sss_instances_count struct StructInstance typedef struct smf_StructInstance smf_StructInstance_t; struct smf_StructInstance { char *ssi_fmri; adr_name_t *ssi_objectName; struct timespec ssi_stime; smf_SMFState_t ssi_state; }; void smf_StructInstance_free(smf_StructInstance_t *in); Fields: ssi_fmri ssi_objectName ssi_stime ssi_state struct StateChange typedef struct smf_StateChange smf_StateChange_t; struct smf_StateChange { adr_name_t *ssc_source; smf_SMFState_t ssc_state; smf_SMFState_t ssc_nextState; char *ssc_auxState; struct timespec ssc_stateTime; char *ssc_reason; }; void smf_StateChange_free(smf_StateChange_t *in); Fields: ssc_source ssc_state ssc_nextState ssc_auxState ssc_stateTime ssc_reason struct Addition typedef struct smf_Addition smf_Addition_t; struct smf_Addition { adr_name_t *sa_name; char *sa_frmi; smf_StructInstance_t *sa_instance; smf_StructService_t *sa_service; }; void smf_Addition_free(smf_Addition_t *in); Fields: sa_name sa_frmi sa_instance sa_service struct Removal typedef struct smf_Removal smf_Removal_t; struct smf_Removal { char *sr_fmri; }; void smf_Removal_free(smf_Removal_t *in); Fields: sr_fmri VERSION 1.0 ATTRIBUTES See attributes(7) for descriptions of the following attributes: +--------------------+--------------------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+--------------------------------------+ |Availability | system/management/rad/module/rad-smf | +--------------------+--------------------------------------+ |Interface Stability | Private | +--------------------+--------------------------------------+ SEE ALSO rad(8) NOTES 1. Accessing Python documentation for this module: $ pydoc rad.bindings.com.oracle.solaris.rad.smf_1 Solaris 11.4 2017-02-01 SMF-1(3rad)