diff options
| author | Richard Lowe <richlowe@richlowe.net> | 2011-03-14 14:05:30 -0400 |
|---|---|---|
| committer | Richard Lowe <richlowe@richlowe.net> | 2011-03-14 14:05:30 -0400 |
| commit | c10c16dec587a0662068f6e2991c29ed3a9db943 (patch) | |
| tree | f414286f4bba41d75683ed4fbbaa6bfa4bf7fabd /usr/src/man/man3scf | |
| parent | 68caef18a23a498d9e3017b983562c0f4fd8ab23 (diff) | |
| download | illumos-joyent-c10c16dec587a0662068f6e2991c29ed3a9db943.tar.gz | |
243 system manual pages should live with the software
Reviewed by: garrett@nexenta.com
Reviewed by: gwr@nexenta.com
Reviewed by: trisk@opensolaris.org
Approved by: gwr@nexenta.com
--HG--
extra : rebase_source : 0c599d0bec0dc8865fbba67721a7a6cd6b1feefb
Diffstat (limited to 'usr/src/man/man3scf')
24 files changed, 10203 insertions, 0 deletions
diff --git a/usr/src/man/man3scf/Makefile b/usr/src/man/man3scf/Makefile new file mode 100644 index 0000000000..ec38062c62 --- /dev/null +++ b/usr/src/man/man3scf/Makefile @@ -0,0 +1,477 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet +# at http://www.illumos.org/license/CDDL. +# + +# Copyright 2011, Richard Lowe + +include ../../Makefile.master + +MANSECT = 3scf + +MANFILES = scf_entry_create.3scf \ + scf_error.3scf \ + scf_handle_create.3scf \ + scf_handle_decode_fmri.3scf \ + scf_instance_create.3scf \ + scf_iter_create.3scf \ + scf_limit.3scf \ + scf_pg_create.3scf \ + scf_property_create.3scf \ + scf_scope_create.3scf \ + scf_service_create.3scf \ + scf_simple_prop_get.3scf \ + scf_simple_walk_instances.3scf \ + scf_snaplevel_create.3scf \ + scf_snapshot_create.3scf \ + scf_tmpl_pg_create.3scf \ + scf_tmpl_pg_name.3scf \ + scf_tmpl_prop_create.3scf \ + scf_tmpl_prop_name.3scf \ + scf_tmpl_validate_fmri.3scf \ + scf_transaction_create.3scf \ + scf_value_create.3scf \ + smf_enable_instance.3scf + + +MANSOFILES = scf_count_ranges_destroy.3scf \ + scf_entry_add_value.3scf \ + scf_entry_destroy.3scf \ + scf_entry_destroy_children.3scf \ + scf_entry_handle.3scf \ + scf_entry_reset.3scf \ + scf_handle_bind.3scf \ + scf_handle_decorate.3scf \ + scf_handle_destroy.3scf \ + scf_handle_get_scope.3scf \ + scf_handle_unbind.3scf \ + scf_instance_add_pg.3scf \ + scf_instance_delete.3scf \ + scf_instance_destroy.3scf \ + scf_instance_get_name.3scf \ + scf_instance_get_parent.3scf \ + scf_instance_get_pg.3scf \ + scf_instance_get_pg_composed.3scf \ + scf_instance_get_snapshot.3scf \ + scf_instance_handle.3scf \ + scf_instance_to_fmri.3scf \ + scf_int_ranges_destroy.3scf \ + scf_iter_destroy.3scf \ + scf_iter_handle.3scf \ + scf_iter_handle_scopes.3scf \ + scf_iter_instance_pgs.3scf \ + scf_iter_instance_pgs_composed.3scf \ + scf_iter_instance_pgs_typed.3scf \ + scf_iter_instance_pgs_typed_composed.3scf \ + scf_iter_instance_snapshots.3scf \ + scf_iter_next_instance.3scf \ + scf_iter_next_pg.3scf \ + scf_iter_next_property.3scf \ + scf_iter_next_scope.3scf \ + scf_iter_next_service.3scf \ + scf_iter_next_snapshot.3scf \ + scf_iter_next_value.3scf \ + scf_iter_pg_properties.3scf \ + scf_iter_property_values.3scf \ + scf_iter_reset.3scf \ + scf_iter_scope_services.3scf \ + scf_iter_service_instances.3scf \ + scf_iter_service_pgs.3scf \ + scf_iter_service_pgs_typed.3scf \ + scf_iter_snaplevel_pgs.3scf \ + scf_iter_snaplevel_pgs_typed.3scf \ + scf_myname.3scf \ + scf_pg_delete.3scf \ + scf_pg_destroy.3scf \ + scf_pg_get_flags.3scf \ + scf_pg_get_name.3scf \ + scf_pg_get_parent_instance.3scf \ + scf_pg_get_parent_service.3scf \ + scf_pg_get_parent_snaplevel.3scf \ + scf_pg_get_property.3scf \ + scf_pg_get_type.3scf \ + scf_pg_get_underlying_pg.3scf \ + scf_pg_handle.3scf \ + scf_pg_to_fmri.3scf \ + scf_pg_update.3scf \ + scf_property_destroy.3scf \ + scf_property_get_name.3scf \ + scf_property_get_value.3scf \ + scf_property_handle.3scf \ + scf_property_is_type.3scf \ + scf_property_to_fmri.3scf \ + scf_property_type.3scf \ + scf_scope_add_service.3scf \ + scf_scope_destroy.3scf \ + scf_scope_get_name.3scf \ + scf_scope_get_service.3scf \ + scf_scope_handle.3scf \ + scf_scope_to_fmri.3scf \ + scf_service_add_instance.3scf \ + scf_service_add_pg.3scf \ + scf_service_delete.3scf \ + scf_service_destroy.3scf \ + scf_service_get_instance.3scf \ + scf_service_get_name.3scf \ + scf_service_get_parent.3scf \ + scf_service_get_pg.3scf \ + scf_service_handle.3scf \ + scf_service_to_fmri.3scf \ + scf_simple_app_props_free.3scf \ + scf_simple_app_props_get.3scf \ + scf_simple_app_props_next.3scf \ + scf_simple_app_props_search.3scf \ + scf_simple_prop_free.3scf \ + scf_simple_prop_name.3scf \ + scf_simple_prop_next_astring.3scf \ + scf_simple_prop_next_boolean.3scf \ + scf_simple_prop_next_count.3scf \ + scf_simple_prop_next_integer.3scf \ + scf_simple_prop_next_opaque.3scf \ + scf_simple_prop_next_reset.3scf \ + scf_simple_prop_next_time.3scf \ + scf_simple_prop_next_ustring.3scf \ + scf_simple_prop_numvalues.3scf \ + scf_simple_prop_pgname.3scf \ + scf_simple_prop_type.3scf \ + scf_snaplevel_destroy.3scf \ + scf_snaplevel_get_instance_name.3scf \ + scf_snaplevel_get_next_snaplevel.3scf \ + scf_snaplevel_get_parent.3scf \ + scf_snaplevel_get_pg.3scf \ + scf_snaplevel_get_scope_name.3scf \ + scf_snaplevel_get_service_name.3scf \ + scf_snaplevel_handle.3scf \ + scf_snapshot_destroy.3scf \ + scf_snapshot_get_base_snaplevel.3scf \ + scf_snapshot_get_name.3scf \ + scf_snapshot_get_parent.3scf \ + scf_snapshot_handle.3scf \ + scf_snapshot_update.3scf \ + scf_strerror.3scf \ + scf_string_to_type.3scf \ + scf_tmpl_error_pg.3scf \ + scf_tmpl_error_pg_tmpl.3scf \ + scf_tmpl_error_prop.3scf \ + scf_tmpl_error_prop_tmpl.3scf \ + scf_tmpl_error_source_fmri.3scf \ + scf_tmpl_error_type.3scf \ + scf_tmpl_error_value.3scf \ + scf_tmpl_errors_destroy.3scf \ + scf_tmpl_get_by_pg.3scf \ + scf_tmpl_get_by_pg_name.3scf \ + scf_tmpl_get_by_prop.3scf \ + scf_tmpl_iter_pgs.3scf \ + scf_tmpl_iter_props.3scf \ + scf_tmpl_next_error.3scf \ + scf_tmpl_pg_common_name.3scf \ + scf_tmpl_pg_description.3scf \ + scf_tmpl_pg_destroy.3scf \ + scf_tmpl_pg_required.3scf \ + scf_tmpl_pg_reset.3scf \ + scf_tmpl_pg_target.3scf \ + scf_tmpl_pg_type.3scf \ + scf_tmpl_prop_cardinality.3scf \ + scf_tmpl_prop_common_name.3scf \ + scf_tmpl_prop_description.3scf \ + scf_tmpl_prop_destroy.3scf \ + scf_tmpl_prop_internal_seps.3scf \ + scf_tmpl_prop_required.3scf \ + scf_tmpl_prop_reset.3scf \ + scf_tmpl_prop_type.3scf \ + scf_tmpl_prop_units.3scf \ + scf_tmpl_prop_visibility.3scf \ + scf_tmpl_reset_errors.3scf \ + scf_tmpl_strerror.3scf \ + scf_tmpl_value_common_name.3scf \ + scf_tmpl_value_count_range_choices.3scf \ + scf_tmpl_value_count_range_constraints.3scf \ + scf_tmpl_value_description.3scf \ + scf_tmpl_value_in_constraint.3scf \ + scf_tmpl_value_int_range_choices.3scf \ + scf_tmpl_value_int_range_constraints.3scf \ + scf_tmpl_value_name_choices.3scf \ + scf_tmpl_value_name_constraints.3scf \ + scf_tmpl_visibility_to_string.3scf \ + scf_transaction_commit.3scf \ + scf_transaction_destroy.3scf \ + scf_transaction_destroy_children.3scf \ + scf_transaction_handle.3scf \ + scf_transaction_property_change.3scf \ + scf_transaction_property_change_type.3scf \ + scf_transaction_property_delete.3scf \ + scf_transaction_property_new.3scf \ + scf_transaction_reset.3scf \ + scf_transaction_reset_all.3scf \ + scf_transaction_start.3scf \ + scf_type_base_type.3scf \ + scf_type_to_string.3scf \ + scf_value_base_type.3scf \ + scf_value_destroy.3scf \ + scf_value_get_as_string.3scf \ + scf_value_get_as_string_typed.3scf \ + scf_value_get_astring.3scf \ + scf_value_get_boolean.3scf \ + scf_value_get_count.3scf \ + scf_value_get_integer.3scf \ + scf_value_get_opaque.3scf \ + scf_value_get_time.3scf \ + scf_value_get_ustring.3scf \ + scf_value_handle.3scf \ + scf_value_is_type.3scf \ + scf_value_reset.3scf \ + scf_value_set_astring.3scf \ + scf_value_set_boolean.3scf \ + scf_value_set_count.3scf \ + scf_value_set_from_string.3scf \ + scf_value_set_integer.3scf \ + scf_value_set_opaque.3scf \ + scf_value_set_time.3scf \ + scf_value_set_ustring.3scf \ + scf_value_type.3scf \ + scf_values_destroy.3scf \ + smf_degrade_instance.3scf \ + smf_disable_instance.3scf \ + smf_get_state.3scf \ + smf_maintain_instance.3scf \ + smf_refresh_instance.3scf \ + smf_restart_instance.3scf \ + smf_restore_instance.3scf + +MANFILES += $(MANSOFILES) + +scf_entry_add_value.3scf := SOSRC = man3scf/scf_entry_create.3scf +scf_entry_destroy.3scf := SOSRC = man3scf/scf_entry_create.3scf +scf_entry_destroy_children.3scf := SOSRC = man3scf/scf_entry_create.3scf +scf_entry_handle.3scf := SOSRC = man3scf/scf_entry_create.3scf +scf_entry_reset.3scf := SOSRC = man3scf/scf_entry_create.3scf + +scf_strerror.3scf := SOSRC = man3scf/scf_error.3scf + +scf_handle_bind.3scf := SOSRC = man3scf/scf_handle_create.3scf +scf_handle_decorate.3scf := SOSRC = man3scf/scf_handle_create.3scf +scf_handle_destroy.3scf := SOSRC = man3scf/scf_handle_create.3scf +scf_handle_unbind.3scf := SOSRC = man3scf/scf_handle_create.3scf +scf_myname.3scf := SOSRC = man3scf/scf_handle_create.3scf + +scf_instance_to_fmri.3scf := SOSRC = man3scf/scf_handle_decode_fmri.3scf +scf_pg_to_fmri.3scf := SOSRC = man3scf/scf_handle_decode_fmri.3scf +scf_property_to_fmri.3scf := SOSRC = man3scf/scf_handle_decode_fmri.3scf +scf_scope_to_fmri.3scf := SOSRC = man3scf/scf_handle_decode_fmri.3scf +scf_service_to_fmri.3scf := SOSRC = man3scf/scf_handle_decode_fmri.3scf + +scf_instance_delete.3scf := SOSRC = man3scf/scf_instance_create.3scf +scf_instance_destroy.3scf := SOSRC = man3scf/scf_instance_create.3scf +scf_instance_get_name.3scf := SOSRC = man3scf/scf_instance_create.3scf +scf_instance_get_parent.3scf := SOSRC = man3scf/scf_instance_create.3scf +scf_instance_handle.3scf := SOSRC = man3scf/scf_instance_create.3scf +scf_service_add_instance.3scf := SOSRC = man3scf/scf_instance_create.3scf +scf_service_get_instance.3scf := SOSRC = man3scf/scf_instance_create.3scf + +scf_iter_destroy.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_handle.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_handle_scopes.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_instance_pgs.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_instance_pgs_composed.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_instance_pgs_typed.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_instance_pgs_typed_composed.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_instance_snapshots.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_next_instance.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_next_pg.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_next_property.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_next_scope.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_next_service.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_next_snapshot.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_next_value.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_pg_properties.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_property_values.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_reset.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_scope_services.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_service_instances.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_service_pgs.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_service_pgs_typed.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_snaplevel_pgs.3scf := SOSRC = man3scf/scf_iter_create.3scf +scf_iter_snaplevel_pgs_typed.3scf := SOSRC = man3scf/scf_iter_create.3scf + +scf_instance_add_pg.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_instance_get_pg.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_instance_get_pg_composed.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_pg_delete.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_pg_destroy.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_pg_get_flags.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_pg_get_name.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_pg_get_parent_instance.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_pg_get_parent_service.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_pg_get_parent_snaplevel.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_pg_get_type.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_pg_get_underlying_pg.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_pg_handle.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_pg_update.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_service_add_pg.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_service_get_pg.3scf := SOSRC = man3scf/scf_pg_create.3scf +scf_snaplevel_get_pg.3scf := SOSRC = man3scf/scf_pg_create.3scf + +scf_pg_get_property.3scf := SOSRC = man3scf/scf_property_create.3scf +scf_property_destroy.3scf := SOSRC = man3scf/scf_property_create.3scf +scf_property_get_name.3scf := SOSRC = man3scf/scf_property_create.3scf +scf_property_get_value.3scf := SOSRC = man3scf/scf_property_create.3scf +scf_property_handle.3scf := SOSRC = man3scf/scf_property_create.3scf +scf_property_is_type.3scf := SOSRC = man3scf/scf_property_create.3scf +scf_property_type.3scf := SOSRC = man3scf/scf_property_create.3scf +scf_string_to_type.3scf := SOSRC = man3scf/scf_property_create.3scf +scf_type_to_string.3scf := SOSRC = man3scf/scf_property_create.3scf + +scf_handle_get_scope.3scf := SOSRC = man3scf/scf_scope_create.3scf +scf_scope_destroy.3scf := SOSRC = man3scf/scf_scope_create.3scf +scf_scope_get_name.3scf := SOSRC = man3scf/scf_scope_create.3scf +scf_scope_handle.3scf := SOSRC = man3scf/scf_scope_create.3scf + +scf_scope_add_service.3scf := SOSRC = man3scf/scf_service_create.3scf +scf_scope_get_service.3scf := SOSRC = man3scf/scf_service_create.3scf +scf_service_delete.3scf := SOSRC = man3scf/scf_service_create.3scf +scf_service_destroy.3scf := SOSRC = man3scf/scf_service_create.3scf +scf_service_get_name.3scf := SOSRC = man3scf/scf_service_create.3scf +scf_service_get_parent.3scf := SOSRC = man3scf/scf_service_create.3scf +scf_service_handle.3scf := SOSRC = man3scf/scf_service_create.3scf + +scf_simple_app_props_free.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_app_props_get.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_app_props_next.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_app_props_search.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_prop_free.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_prop_name.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_prop_next_astring.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_prop_next_boolean.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_prop_next_count.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_prop_next_integer.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_prop_next_opaque.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_prop_next_reset.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_prop_next_time.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_prop_next_ustring.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_prop_numvalues.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_prop_pgname.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf +scf_simple_prop_type.3scf := SOSRC = man3scf/scf_simple_prop_get.3scf + +scf_snaplevel_destroy.3scf := SOSRC = man3scf/scf_snaplevel_create.3scf +scf_snaplevel_get_instance_name.3scf := SOSRC = man3scf/scf_snaplevel_create.3scf +scf_snaplevel_get_next_snaplevel.3scf := SOSRC = man3scf/scf_snaplevel_create.3scf +scf_snaplevel_get_parent.3scf := SOSRC = man3scf/scf_snaplevel_create.3scf +scf_snaplevel_get_scope_name.3scf := SOSRC = man3scf/scf_snaplevel_create.3scf +scf_snaplevel_get_service_name.3scf := SOSRC = man3scf/scf_snaplevel_create.3scf +scf_snaplevel_handle.3scf := SOSRC = man3scf/scf_snaplevel_create.3scf +scf_snapshot_get_base_snaplevel.3scf := SOSRC = man3scf/scf_snaplevel_create.3scf + +scf_instance_get_snapshot.3scf := SOSRC = man3scf/scf_snapshot_create.3scf +scf_snapshot_destroy.3scf := SOSRC = man3scf/scf_snapshot_create.3scf +scf_snapshot_get_name.3scf := SOSRC = man3scf/scf_snapshot_create.3scf +scf_snapshot_get_parent.3scf := SOSRC = man3scf/scf_snapshot_create.3scf +scf_snapshot_handle.3scf := SOSRC = man3scf/scf_snapshot_create.3scf +scf_snapshot_update.3scf := SOSRC = man3scf/scf_snapshot_create.3scf + +scf_tmpl_get_by_pg.3scf := SOSRC = man3scf/scf_tmpl_pg_create.3scf +scf_tmpl_get_by_pg_name.3scf := SOSRC = man3scf/scf_tmpl_pg_create.3scf +scf_tmpl_iter_pgs.3scf := SOSRC = man3scf/scf_tmpl_pg_create.3scf +scf_tmpl_pg_destroy.3scf := SOSRC = man3scf/scf_tmpl_pg_create.3scf +scf_tmpl_pg_reset.3scf := SOSRC = man3scf/scf_tmpl_pg_create.3scf + +scf_tmpl_pg_common_name.3scf := SOSRC = man3scf/scf_tmpl_pg_name.3scf +scf_tmpl_pg_description.3scf := SOSRC = man3scf/scf_tmpl_pg_name.3scf +scf_tmpl_pg_required.3scf := SOSRC = man3scf/scf_tmpl_pg_name.3scf +scf_tmpl_pg_target.3scf := SOSRC = man3scf/scf_tmpl_pg_name.3scf +scf_tmpl_pg_type.3scf := SOSRC = man3scf/scf_tmpl_pg_name.3scf + +scf_tmpl_get_by_prop.3scf := SOSRC = man3scf/scf_tmpl_prop_create.3scf +scf_tmpl_iter_props.3scf := SOSRC = man3scf/scf_tmpl_prop_create.3scf +scf_tmpl_prop_destroy.3scf := SOSRC = man3scf/scf_tmpl_prop_create.3scf +scf_tmpl_prop_reset.3scf := SOSRC = man3scf/scf_tmpl_prop_create.3scf + +scf_count_ranges_destroy.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_int_ranges_destroy.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_prop_cardinality.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_prop_common_name.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_prop_description.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_prop_internal_seps.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_prop_required.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_prop_type.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_prop_units.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_prop_visibility.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_value_common_name.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_value_count_range_choices.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_value_count_range_constraints.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_value_description.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_value_in_constraint.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_value_int_range_choices.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_value_int_range_constraints.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_value_name_choices.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_value_name_constraints.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_tmpl_visibility_to_string.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf +scf_values_destroy.3scf := SOSRC = man3scf/scf_tmpl_prop_name.3scf + +scf_tmpl_error_pg.3scf := SOSRC = man3scf/scf_tmpl_validate_fmri.3scf +scf_tmpl_error_pg_tmpl.3scf := SOSRC = man3scf/scf_tmpl_validate_fmri.3scf +scf_tmpl_error_prop.3scf := SOSRC = man3scf/scf_tmpl_validate_fmri.3scf +scf_tmpl_error_prop_tmpl.3scf := SOSRC = man3scf/scf_tmpl_validate_fmri.3scf +scf_tmpl_error_source_fmri.3scf := SOSRC = man3scf/scf_tmpl_validate_fmri.3scf +scf_tmpl_error_type.3scf := SOSRC = man3scf/scf_tmpl_validate_fmri.3scf +scf_tmpl_error_value.3scf := SOSRC = man3scf/scf_tmpl_validate_fmri.3scf +scf_tmpl_errors_destroy.3scf := SOSRC = man3scf/scf_tmpl_validate_fmri.3scf +scf_tmpl_next_error.3scf := SOSRC = man3scf/scf_tmpl_validate_fmri.3scf +scf_tmpl_reset_errors.3scf := SOSRC = man3scf/scf_tmpl_validate_fmri.3scf +scf_tmpl_strerror.3scf := SOSRC = man3scf/scf_tmpl_validate_fmri.3scf + +scf_transaction_commit.3scf := SOSRC = man3scf/scf_transaction_create.3scf +scf_transaction_destroy.3scf := SOSRC = man3scf/scf_transaction_create.3scf +scf_transaction_destroy_children.3scf := SOSRC = man3scf/scf_transaction_create.3scf +scf_transaction_handle.3scf := SOSRC = man3scf/scf_transaction_create.3scf +scf_transaction_property_change.3scf := SOSRC = man3scf/scf_transaction_create.3scf +scf_transaction_property_change_type.3scf := SOSRC = man3scf/scf_transaction_create.3scf +scf_transaction_property_delete.3scf := SOSRC = man3scf/scf_transaction_create.3scf +scf_transaction_property_new.3scf := SOSRC = man3scf/scf_transaction_create.3scf +scf_transaction_reset.3scf := SOSRC = man3scf/scf_transaction_create.3scf +scf_transaction_reset_all.3scf := SOSRC = man3scf/scf_transaction_create.3scf +scf_transaction_start.3scf := SOSRC = man3scf/scf_transaction_create.3scf + +scf_type_base_type.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_base_type.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_destroy.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_get_as_string.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_get_as_string_typed.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_get_astring.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_get_boolean.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_get_count.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_get_integer.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_get_opaque.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_get_time.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_get_ustring.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_handle.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_is_type.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_reset.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_set_astring.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_set_boolean.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_set_count.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_set_from_string.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_set_integer.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_set_opaque.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_set_time.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_set_ustring.3scf := SOSRC = man3scf/scf_value_create.3scf +scf_value_type.3scf := SOSRC = man3scf/scf_value_create.3scf + +smf_degrade_instance.3scf := SOSRC = man3scf/smf_enable_instance.3scf +smf_disable_instance.3scf := SOSRC = man3scf/smf_enable_instance.3scf +smf_get_state.3scf := SOSRC = man3scf/smf_enable_instance.3scf +smf_maintain_instance.3scf := SOSRC = man3scf/smf_enable_instance.3scf +smf_refresh_instance.3scf := SOSRC = man3scf/smf_enable_instance.3scf +smf_restart_instance.3scf := SOSRC = man3scf/smf_enable_instance.3scf +smf_restore_instance.3scf := SOSRC = man3scf/smf_enable_instance.3scf + +.KEEP_STATE: + +include ../Makefile.man + +install: $(ROOTMANFILES) diff --git a/usr/src/man/man3scf/scf_entry_create.3scf b/usr/src/man/man3scf/scf_entry_create.3scf new file mode 100644 index 0000000000..fa77fb3c20 --- /dev/null +++ b/usr/src/man/man3scf/scf_entry_create.3scf @@ -0,0 +1,232 @@ +'\" te +.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_entry_create 3SCF "17 Jul 2008" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_entry_create, scf_entry_handle, scf_entry_destroy, +scf_entry_destroy_children, scf_entry_reset, scf_entry_add_value \- create and +manipulate transaction in the Service Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_transaction_entry_t *\fR\fBscf_entry_create\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBscf_handle_t *\fR\fBscf_entry_handle\fR(\fBscf_transaction_entry_t *\fR\fIentry\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_entry_destroy\fR(\fBscf_transaction_entry_t *\fR\fIentry\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_entry_destroy_children\fR(\fBscf_transaction_entry_t *\fR\fIentry\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_entry_reset\fR(\fBscf_transaction_entry_t *\fR\fIentry\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_entry_add_value\fR(\fBscf_transaction_entry_t *\fR\fIentry\fR, + \fBscf_value_t *\fR\fIvalue\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBscf_entry_create()\fR function allocates a new transaction entry handle. +The \fBscf_entry_destroy()\fR function destroys the transaction entry handle. +.sp +.LP +The \fBscf_entry_handle()\fR function retrieves the handle associated with +\fIentry\fR. +.sp +.LP +A transaction entry represents a single action on a property in a property +group. If an entry is added to a transaction using +\fBscf_transaction_property_new\fR(3SCF), +\fBscf_transaction_property_change\fR(3SCF), or +\fBscf_transaction_property_change_type\fR(3SCF), \fBscf_entry_add_value()\fR +can be called zero or more times to set up the set of values for that property. +Each value must be set and of a compatible type to the type associated with the +entry. When later retrieved from the property, the values will have the type of +the entry. If the values are committed successfully with +\fBscf_transaction_commit\fR(3SCF), they will be set in the order in which they +were added with \fBscf_entry_add_value()\fR. +.sp +.LP +The \fBscf_entry_reset()\fR function resets a transaction entry, disassociating +it from any transaction it is a part of (invalidating the transaction in the +process), and disassociating any values that were added to it. +.sp +.LP +The \fBscf_entry_destroy_children()\fR function destroys all values associated +with the transaction entry. The entry itself is not destroyed. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_entry_create()\fR returns a new +\fBscf_transaction_entry_t\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_entry_handle()\fR returns the handle +associated with the transaction entry. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_entry_add_value()\fR returns 0. Otherwise, +it returns -1. +.SH ERRORS +.sp +.LP +The \fBscf_entry_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The \fIhandle\fR argument is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.RS 30n +.rt +There is not enough memory to allocate an \fBscf_transaction_entry_t\fR. +.RE + +.sp +.LP +The \fBscf_entry_handle()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.RS 30n +.rt +The handle associated with entry has been destroyed. +.RE + +.sp +.LP +The \fBscf_entry_add_value()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.RS 30n +.rt +The \fIvalue\fR and \fIentry\fR arguments are not derived from the same handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_IN_USE\fR\fR +.ad +.RS 30n +.rt +The value has been added to another entry. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.RS 30n +.rt +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The \fIvalue\fR argument is not set, or the entry was added to the transaction +using \fBscf_transaction_property_delete\fR(3SCF). +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.RS 30n +.rt +The transaction entry is not associated with a transaction. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_TYPE_MISMATCH\fR\fR +.ad +.RS 30n +.rt +The type of the \fIvalue\fR argument does not match the type that was set using +\fBscf_transaction_property_new()\fR, \fBscf_transaction_property_change()\fR, +or \fBscf_transaction_property_change_type()\fR. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), \fBscf_transaction_commit\fR(3SCF), +\fBscf_transaction_property_change\fR(3SCF), +\fBscf_transaction_property_change_type\fR(3SCF), +\fBscf_transaction_property_delete\fR(3SCF), +\fBscf_transaction_property_new\fR(3SCF), \fBscf_transaction_reset\fR(3SCF), +\fBattributes\fR(5) diff --git a/usr/src/man/man3scf/scf_error.3scf b/usr/src/man/man3scf/scf_error.3scf new file mode 100644 index 0000000000..848363b04f --- /dev/null +++ b/usr/src/man/man3scf/scf_error.3scf @@ -0,0 +1,304 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_error 3SCF "20 Aug 2007" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_error, scf_strerror \- error interface to Service Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_error_t\fR \fBscf_error\fR(\fBvoid\fR); +.fi + +.LP +.nf +\fBconst char *\fR\fBscf_strerror\fR(\fBscf_error_t\fR \fIerror\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBscf_error()\fR function returns the current \fBlibscf\fR(3LIB) error +value for the current thread. If the immediately previous call to a +\fBlibscf\fR function failed, the error value will reflect the reason for that +failure. +.sp +.LP +The \fBscf_strerror()\fR function takes an error code previously returned by +\fBscf_error()\fR and returns a human-readable, localized description of the +error. +.sp +.LP +The error values are as follows: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) chose +for the operation denied access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_READONLY\fR\fR +.ad +.sp .6 +.RS 4n +The storage mechanism that the repository server (\fBsvc.configd\fR) chose for +the operation is read-only. For the local filesystem storage mechanism +(currently \fB/etc/svc/repository.db\fR), this usually occurs because the +filesystem that contains it is mounted read-only. See \fBmount\fR(1M) +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to repository is broken. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONSTRAINT_VIOLATED\fR\fR +.ad +.sp .6 +.RS 4n +A required constraint was not met. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +Object was deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_EXISTS\fR\fR +.ad +.sp .6 +.RS 4n +The object already exists. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.sp .6 +.RS 4n +An object was bound to a destroyed handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +Objects from different SCF handles were used. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_IN_USE\fR\fR +.ad +.sp .6 +.RS 4n +The object is currently in use. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +An argument is invalid. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.sp .6 +.RS 4n +No memory is available. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The repository server is out of resources. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_SERVER\fR\fR +.ad +.sp .6 +.RS 4n +The repository server is unavailable. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NONE\fR\fR +.ad +.sp .6 +.RS 4n +No error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +Nothing of that name was found. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +Cannot use unset value. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The user lacks sufficient authority to conduct the requested operation. See +\fBsmf_security\fR(5). +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_TYPE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The type does not match value. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_VERSION_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The SCF version is incompatible. +.RE + +.SH RETURN VALUES +.sp +.LP +The \fBscf_error()\fR function returns \fBSCF_ERROR_NONE\fR if there have been +no calls from \fBlibscf\fR functions from the current thread. The return value +is undefined if the immediately previous call to a \fBlibscf\fR function did +not fail. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelMT-Safe +.TE + +.SH SEE ALSO +.sp +.LP +\fBsvc.configd\fR(1M), \fBlibscf\fR(3LIB), \fBattributes\fR(5), +\fBsvc.configd\fR(1M) diff --git a/usr/src/man/man3scf/scf_handle_create.3scf b/usr/src/man/man3scf/scf_handle_create.3scf new file mode 100644 index 0000000000..7e1831ad84 --- /dev/null +++ b/usr/src/man/man3scf/scf_handle_create.3scf @@ -0,0 +1,319 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_handle_create 3SCF "17 Aug 2007" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_handle_create, scf_handle_destroy, scf_handle_decorate, scf_handle_bind, +scf_handle_unbind, scf_myname \- Service Configuration Facility handle +functions +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_handle_t *\fR\fBscf_handle_create\fR(\fBscf_version_t\fR \fIversion\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_handle_destroy\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_handle_decorate\fR(\fBscf_handle_t *\fR\fIhandle\fR, \fBconst char *\fR\fIparam\fR, + \fBscf_value_t *\fR\fIvalue\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_handle_bind\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_handle_unbind\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_myname\fR(\fBscf_handle_t *\fR\fIhandle\fR, \fBchar *\fR\fIout\fR, \fBsize_t\fR \fIsz\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBscf_handle_create()\fR function creates a new Service Configuration +Facility handle that is used as the base for all communication with the +configuration repository. The version argument must be \fBSCF_VERSION\fR. +.sp +.LP +The \fBscf_handle_decorate()\fR function sets a single connection-level +parameter, \fIparam\fR, to the supplied value. If \fIvalue\fR is +\fBSCF_DECORATE_CLEAR\fR, \fIparam\fR is reset to its default state. Values +passed to \fBscf_handle_decorate()\fR can be reset, reused, or destroyed. The +values set do not take effect until \fBscf_handle_bind()\fR is called. Any +invalid values will not cause errors prior to the call to +\fBscf_handle_bind()\fR. The only available decorations is: +.sp +.ne 2 +.mk +.na +\fBdebug\fR +.ad +.RS 9n +.rt +(count) Set the debugging flags. +.RE + +.sp +.LP +The \fBscf_handle_bind()\fR function binds the handle to a running +\fBsvc.configd\fR(1M) daemon, using the current decorations to modify the +connection. All states derived from the handle are reset immediately after a +successful binding. +.sp +.LP +The \fBscf_handle_unbind()\fR function severs an existing repository connection +or clears the in-client state for a broken connection. +.sp +.LP +The \fBscf_handle_destroy()\fR function destroys and frees an SCF handle. It is +illegal to use the handle after calling \fBscf_handle_destroy()\fR. Actions on +subordinate objects act as if the handle is unbound. +.sp +.LP +The \fBscf_myname()\fR function retrieves the FMRI for the service of which the +connecting process is a part. If the full FMRI does not fit in the provided +buffer, it is truncated and, if \fIsz\fR > 0, zero-terminated. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_handle_create()\fR returns the new handle. +Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_handle_decorate()\fR, +\fBscf_handle_bind()\fR, and \fBscf_handle_unbind()\fR return 0. Otherwise, +they return -1. +.sp +.LP +The \fBscf_myname()\fR function returns the length of the full FMRI. Otherwise, +it returns -1. +.SH ERRORS +.sp +.LP +The \fBscf_handle_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.RS 30n +.rt +There is no memory available. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_VERSION_MISMATCH\fR\fR +.ad +.RS 30n +.rt +The version is invalid, or the application was compiled against a version of +the library that is more recent than the one on the system. +.RE + +.sp +.LP +The \fBscf_handle_decorate()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The \fIparam\fR argument is not a recognized parameter. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_TYPE_MISMATCH\fR\fR +.ad +.RS 30n +.rt +The \fIvalue\fR argument does not match the expected type for param. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.RS 30n +.rt +The \fIvalue\fR argument is not set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_IN_USE\fR\fR +.ad +.RS 30n +.rt +The handle is currently bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.RS 30n +.rt +The \fIvalue\fR argument is not derived from \fIhandle\fR. +.RE + +.sp +.LP +The \fBscf_handle_bind()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +One of the decorations was invalid. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_SERVER\fR\fR +.ad +.RS 30n +.rt +The repository server is not running. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.RS 30n +.rt +The server does not have adequate resources for a new connection. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_IN_USE\fR\fR +.ad +.RS 30n +.rt +The handle is already bound. +.RE + +.sp +.LP +The \fBscf_handle_unbind()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.RS 23n +.rt +The handle is not bound. +.RE + +.sp +.LP +The \fBscf_handle_myname()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +This process is not marked as a SMF service. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSee below. +.TE + +.sp +.LP +Operations on a single handle (and the objects associated with it) are Safe. +Operations on different handles are MT-Safe. Objects associated with different +handles cannot be mixed, as this will lead to an +\fBSCF_ERROR_HANDLE_MISMATCH\fR error. +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), \fBattributes\fR(5) diff --git a/usr/src/man/man3scf/scf_handle_decode_fmri.3scf b/usr/src/man/man3scf/scf_handle_decode_fmri.3scf new file mode 100644 index 0000000000..19eb56aeb3 --- /dev/null +++ b/usr/src/man/man3scf/scf_handle_decode_fmri.3scf @@ -0,0 +1,304 @@ +'\" te +.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_handle_decode_fmri 3SCF "4 Jun 2009" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_handle_decode_fmri, scf_scope_to_fmri, scf_service_to_fmri, +scf_instance_to_fmri, scf_pg_to_fmri, scf_property_to_fmri \- convert between +objects and FMRIs in the Service Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBint\fR \fBscf_handle_decode_fmri\fR(\fBscf_handle_t *\fR\fIhandle\fR, \fBconst char *\fR\fIfmri\fR, + \fBscf_scope_t *\fR\fIscope\fR, \fBscf_service_t *\fR\fIservice\fR, + \fBscf_instance_t *\fR\fIinstance\fR, \fBscf_propertygroup_t *\fR\fIpg\fR, + \fBscf_property_t *\fR\fIproperty\fR, \fBint\fR \fIflag\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_scope_to_fmri\fR(\fBconst scf_scope_t *\fR\fIobject\fR, + \fBchar *\fR\fIbuffer\fR, \fBsize_t\fR \fIsz\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_service_to_fmri\fR(\fBconst scf_scope_t *\fR\fIobject\fR, + \fBchar *\fR\fIbuffer\fR, \fBsize_t\fR \fIsz\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_instance_to_fmri\fR(\fBconst scf_instance_t *\fR\fIinst\fR, + \fBchar *\fR\fIbuffer\fR, \fBsize_t\fR \fIsz\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_pg_to_fmri\fR(\fBconst scf_propertygroup_t *\fR\fIpg\fR, \fBchar *\fR\fIout\fR, + \fBsize_t\fR \fIsz\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_property_to_fmri\fR(\fBconst scf_scope_t *\fR\fIobject\fR, + \fBchar *\fR\fIbuffer\fR, \fBsize_t\fR \fIsz\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBscf_handle_decode_fmri()\fR function decodes an FMRI string into a set +of repository entries. Any number of the entity handles can be \fINULL\fR. The +validation and decoding of the FMRI are determined by the \fIflags\fR argument +and by those arguments that are \fINULL\fR. +.sp +.LP +If \fIflags\fR == 0, any FMRI is accepted as long as it is well-formed and +exists in the repository. +.sp +.LP +If \fBSCF_DECODE_FMRI_EXACT\fR is set in \fIflags\fR, the last part of the FMRI +must match the last non-null entity handle. For example, if property is +\fINULL\fR and \fIpg\fR is non-null, the FMRI must be a property group FMRI. +.sp +.LP +If \fBSCF_DECODE_FMRI_TRUNCATE\fR is set in \fIflags\fR, there is no check for +the existence of any objects specified in the FMRI that follow the last +non-null entity handle. For example, if property is \fINULL\fR, \fIpg\fR is +non-null, and a property FMRI is passed in, \fBscf_handle_decode_fmri()\fR +succeeds as long as the property group exists, even if the referenced property +does not exist. +.sp +.LP +If \fBSCF_DECODE_FMRI_REQUIRE_INSTANCE\fR (or +\fBSCF_FMRI_REQUIRE_NO_INSTANCE\fR) is set in \fIflags\fR, then the FMRI must +(or must not) specify an instance. +.sp +.LP +If an error occurs, all of the entity handles that were passed to the function +are reset. +.sp +.LP +The \fBscf_scope_to_fmri()\fR, \fBscf_service_to_fmri()\fR, +\fBscf_instance_to_fmri()\fR, \fBscf_pg_to_fmri()\fR, and +\fBscf_property_to_fmri()\fR functions convert an entity handle to an FMRI. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_handle_decode_fmri()\fR returns 0. +Otherwise, it returns -1. +.sp +.LP +Upon successful completion, \fBscf_scope_to_fmri()\fR, +\fBscf_service_to_fmri()\fR, \fBscf_instance_to_fmri()\fR, +\fBscf_pg_to_fmri()\fR, and \fBscf_property_to_fmri()\fR return the length of +the FMRI. The buffer will be null-terminated if \fIsz\fR > 0, similar to +strlcpy(3C). Otherwise, they return -1 and the contents of buffer are +undefined. +.SH ERRORS +.sp +.LP +The \fBscf_handle_decode_fmri()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) +chose for the operation denied access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONSTRAINT_VIOLATED\fR\fR +.ad +.sp .6 +.RS 4n +The FMRI does not meet the restrictions requested in the flag argument. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The object argument refers to an object that has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +One or more of the entity handles was not derived from handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The \fIfmri\fR argument is not a valid FMRI. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have adequate resources to complete the request. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not currently bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +The FMRI is well-formed but there is no object in the repository matching it. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +Cannot use unset value. +.RE + +.sp +.LP +The \fBscf_scope_to_fmri()\fR, \fBscf_service_to_fmri()\fR, +\fBscf_instance_to_fmri()\fR, \fBscf_pg_to_fmri()\fR, and +\fBscf_property_to_fmri()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The \fIobject\fR argument is not currently set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The object argument refers to an object that has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not currently bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), \fBattributes\fR(5) diff --git a/usr/src/man/man3scf/scf_instance_create.3scf b/usr/src/man/man3scf/scf_instance_create.3scf new file mode 100644 index 0000000000..2c098bb688 --- /dev/null +++ b/usr/src/man/man3scf/scf_instance_create.3scf @@ -0,0 +1,538 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_instance_create 3SCF "24 Sep 2007" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_instance_create, scf_instance_handle, scf_instance_destroy, +scf_instance_get_parent, scf_instance_get_name, scf_service_get_instance, +scf_service_add_instance, scf_instance_delete \- create and manipulate instance +handles and instances in the Service Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_instance_t *\fR\fBscf_instance_create\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBscf_handle_t *\fR\fBscf_instance_handle\fR(\fBscf_instance_t *\fR\fIinst\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_instance_destroy\fR(\fBscf_instance_t *\fR\fIinst\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_instance_get_parent\fR(\fBconst scf_instance_t *\fR\fIinst\fR, + \fBscf_service_t *\fR\fIsvc\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_instance_get_name\fR(\fBconst scf_instance_t *\fR\fIinst\fR, + \fBchar *\fR\fIname\fR, \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_service_get_instance\fR(\fBconst scf_service_t *\fR\fIsvc\fR, + \fBconst char *\fR\fIname\fR, \fBscf_instance_t *\fR\fIinst\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_service_add_instance\fR(\fBconst scf_service_t *\fR\fIsvc\fR, + \fBconst char *\fR\fIname\fR, \fBscf_instance_t *\fR\fIinst\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_instance_delete\fR(\fBscf_instance_t *\fR\fIinst\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +Instances form the bottom layer of the Service Configuration Facility +repository tree. An instance is the child of a service and has two sets of +children: +.sp +.ne 2 +.mk +.na +\fBProperty Groups\fR +.ad +.RS 19n +.rt +These hold configuration information specific to this instance. See +\fBscf_pg_create\fR(3SCF), \fBscf_iter_instance_pgs\fR(3SCF), and +\fBscf_iter_instance_pgs_typed\fR(3SCF). +.RE + +.sp +.ne 2 +.mk +.na +\fBSnapshots\fR +.ad +.RS 19n +.rt +These are complete configuration snapshots that hold unchanging copies of all +of the property groups necessary to run the instance. See +\fBscf_snapshot_create\fR(3SCF) and \fBscf_iter_instance_snapshots\fR(3SCF). +.RE + +.sp +.LP +See \fBsmf\fR(5) for information about instances. +.sp +.LP +An \fBscf_instance_t\fR is an opaque handle that can be set to a single +instance at any given time. The \fBscf_instance_create()\fR function allocates +and initializes a new \fBscf_instance_t\fR bound to \fIhandle\fR. The +\fBscf_instance_destroy()\fR function destroys and frees \fIinst\fR. +.sp +.LP +The \fBscf_instance_handle()\fR function retrieves the handle to which +\fIinst\fR is bound. +.sp +.LP +The \fBscf_inst_get_parent()\fR function sets \fIsvc\fR to the service that is +the parent of \fIinst\fR. +.sp +.LP +The \fBscf_instance_get_name()\fR function retrieves the name of the instance +to which \fIinst\fR is set. +.sp +.LP +The \fBscf_service_get_instance()\fR function sets \fIinst\fR to the child +instance of the service \fIsvc\fR specified by \fIname\fR. +.sp +.LP +The \fBscf_service_add_instance()\fR function sets \fIinst\fR to a new child +instance of the service \fIsvc\fR specified by \fIname\fR. +.sp +.LP +The \fBscf_instance_delete()\fR function deletes the instance to which +\fIinst\fR is set, as well all of the children of the instance. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_instance_create()\fR returns a new +\fBscf_instance_t\fR. Otherwise it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_instance_handle()\fR returns the handle to +which \fIinst\fR is bound. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_instance_get_name()\fR returns the length of +the string written, not including the terminating null character. Otherwise it +returns -1. +.sp +.LP +Upon successful completion, \fBscf_instance_get_parent()\fR, +\fBscf_service_get_instance()\fR, \fBscf_service_add_instance()\fR, and +\fBscf_instance_delete()\fR functions return 0. Otherwise, they return -1. +.SH ERRORS +.sp +.LP +The \fBscf_instance_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.sp .6 +.RS 4n +An object was bound to a destroyed handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The \fIhandle\fR argument is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.sp .6 +.RS 4n +There is not enough memory to allocate an \fBscf_instance_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have adequate resources for a new instance handle. +.RE + +.sp +.LP +The \fBscf_instance_handle()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.sp .6 +.RS 4n +The handle associated with \fIinst\fR has been destroyed. +.RE + +.sp +.LP +The \fBscf_instance_get_name()\fR, \fBscf_instance_get_parent()\fR, and +\fBscf_instance_delete()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The instance has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The instance is not set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The repository handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.LP +The \fBscf_service_add_instance()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_EXISTS\fR\fR +.ad +.sp .6 +.RS 4n +An instance named \fIname\fR already exists. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have the resources to complete the request. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.LP +The \fBscf_service_get_instance()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.RS 28n +.rt +The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) +chose for the operation denied access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.RS 28n +.rt +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.RS 28n +.rt +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.RS 28n +.rt +No instance specified by \fIname\fR was found. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.RS 28n +.rt +The repository server is out of resources. +.RE + +.sp +.LP +The \fBscf_service_add_instance()\fR and \fBscf_service_get_instance()\fR +functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The service is not set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The service has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The \fIname\fR argument is not a valid instance name. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The service and instance are not derived from the same handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.LP +The \fBscf_instance_get_parent()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The \fIservice\fR and \fIinstance\fR arguments are not derived from the same +handle. +.RE + +.sp +.LP +The \fBscf_service_add_instance()\fR and \fBscf_instance_delete()\fR functions +will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The user does not have sufficient privileges to create or delete an instance. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_READONLY\fR\fR +.ad +.sp .6 +.RS 4n +The repository backend is read-only. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The repository backend refused the modification. +.RE + +.sp +.LP +The \fBscf_instance_delete()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.RS 26n +.rt +The server does not have adequate resources for a new instance handle. +.RE + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), \fBscf_iter_instance_pgs\fR(3SCF), +\fBscf_iter_instance_pgs_typed\fR(3SCF), +\fBscf_iter_instance_snapshots\fR(3SCF), \fBscf_pg_create\fR(3SCF), +\fBscf_snapshot_create\fR(3SCF), \fBattributes\fR(5), \fBsmf\fR(5) +.SH NOTES +.sp +.LP +Instance names are of the form: +.sp +.in +2 +.nf +[\fIdomain\fR,]\fIidentifier\fR +.fi +.in -2 +.sp + +.sp +.LP +where \fIdomain\fR is either a stock ticker symbol such as SUNW or a Java-style +reversed domain name such as \fBcom.sun\fR. Identifiers begin with a letter or +underscore and contain only letters, digits, underscores, and dashes. diff --git a/usr/src/man/man3scf/scf_iter_create.3scf b/usr/src/man/man3scf/scf_iter_create.3scf new file mode 100644 index 0000000000..aa87f4b602 --- /dev/null +++ b/usr/src/man/man3scf/scf_iter_create.3scf @@ -0,0 +1,587 @@ +'\" te +.\" Copyright (c) 2008, Sun Microsystems, Inc. +.\" All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_iter_create 3SCF "4 Dec 2008" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_iter_create, scf_iter_handle, scf_iter_destroy, scf_iter_reset, +scf_iter_handle_scopes, scf_iter_scope_services, scf_iter_service_instances, +scf_iter_service_pgs, scf_iter_service_pgs_typed, scf_iter_instance_snapshots, +scf_iter_snaplevel_pgs, scf_iter_snaplevel_pgs_typed, scf_iter_instance_pgs, +scf_iter_instance_pgs_typed, scf_iter_instance_pgs_composed, +scf_iter_instance_pgs_typed_composed, scf_iter_pg_properties, +scf_iter_property_values, scf_iter_next_scope, scf_iter_next_service, +scf_iter_next_instance, scf_iter_next_snapshot, scf_iter_next_pg, +scf_iter_next_property, scf_iter_next_value \- iterate through the Service +Configuration Facility repository +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_iter_t *\fR\fBscf_iter_create\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBscf_handle_t *\fR\fBscf_iter_handle\fR(\fBscf_iter_t *\fR\fIiter\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_iter_destroy\fR(\fBscf_iter_t *\fR\fIiter\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_iter_reset\fR(\fBscf_iter_t *\fR\fIiter\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_handle_scopes\fR(\fBscf_iter_t *\fR\fIiter\fR, \fBconst scf_handle_t *\fR\fIh\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_scope_services\fR(\fBscf_iter_t *\fR\fIiter\fR, \fBconst scf_scope_t *\fR\fIparent\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_service_instances\fR(\fBscf_iter_t *\fR\fIiter\fR, + \fBconst scf_service_t *\fR\fIparent\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_service_pgs\fR(\fBscf_iter_t *\fR\fIiter\fR, \fBconst scf_service_t *\fR\fIparent\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_service_pgs_typed\fR(\fBscf_iter_t *\fR\fIiter\fR, + \fBconst scf_service_t *\fR\fIparent\fR, \fBconst char *\fR\fIpgtype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_instance_snapshots\fR(\fBscf_iter_t *\fR\fIiter\fR, + \fBconst scf_instance_t *\fR\fIparent\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_snaplevel_pgs\fR(\fBscf_iter_t *\fR\fIiter\fR, + \fBconst scf_snaplevel_t *\fR\fIparent\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_snaplevel_pgs_typed\fR(\fBscf_iter_t *\fR\fIiter\fR, + \fBconst scf_snaplevel_t *\fR\fIparent\fR, \fBconst char *\fR\fIpgtype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_instance_pgs\fR(\fBscf_iter_t *\fR\fIiter\fR, \fBscf_instance_t *\fR\fIparent\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_instance_pgs_typed\fR(\fBscf_iter_t *\fR\fIiter\fR, + \fBscf_instance_t *\fR\fIparent\fR, \fBconst char *\fR\fIpgtype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_instance_pgs_composed\fR(\fBscf_iter_t *\fR\fIiter\fR, + \fBconst scf_instance_t *\fR\fIinstance\fR, \fBconst scf_snapshot_t *\fR\fIsnapshot\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_instance_pgs_typed_composed\fR(\fBscf_iter_t *\fR\fIiter\fR, + \fBconst scf_instance_t *\fR\fIinstance\fR, \fBconst scf_snapshot_t *\fR\fIsnapshot\fR, + \fBconst char *\fR\fIpgtype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_pg_properties\fR(\fBscf_iter_t *\fR\fIiter\fR, + \fBconst scf_propertygroup_t *\fR\fIparent\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_property_values\fR(\fBscf_iter_t *\fR\fIiter\fR, + \fBconst scf_property_t *\fR\fIparent\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_next_scope\fR(\fBscf_iter_t *\fR\fIiter\fR, \fBscf_scope_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_next_service\fR(\fBscf_iter_t *\fR\fIiter\fR, \fBscf_service_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_next_instance\fR(\fBscf_iter_t *\fR\fIiter\fR, \fBscf_instance_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_next_snapshot\fR(\fBscf_iter_t *\fR\fIiter\fR, \fBscf_snapshot_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_next_pg\fR(\fBscf_iter_t *\fR\fIiter\fR, \fBscf_propertygroup_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_next_property\fR(\fBscf_iter_t *\fR\fIiter\fR, \fBscf_property_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_iter_next_value\fR(\fBscf_iter_t *\fR\fIiter\fR, \fBscf_value_t *\fR\fIout\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBscf_iter_create()\fR function creates a new iterator associated with +\fIhandle\fR. The \fBscf_iter_destroy()\fR function destroys an iteration. +.sp +.LP +The \fBscf_iter_reset()\fR function releases any resources involved with an +active iteration and returns the iterator to its initial state. +.sp +.LP +The \fBscf_iter_handle_scopes()\fR, \fBscf_iter_scope_services()\fR, +\fBscf_iter_service_instances()\fR, \fBscf_iter_instance_snapshots()\fR, +\fBscf_iter_service_pgs()\fR, \fBscf_iter_instance_pgs()\fR, +\fBscf_iter_snaplevel_pgs()\fR, \fBscf_iter_pg_properties()\fR, and +\fBscf_iter_property_values()\fR functions set up a new iteration of all the +children \fIparent\fR of a particular type. The +\fBscf_iter_property_values()\fR function will iterate over values in the order +in which they were specified with \fBscf_entry_add_value\fR(3SCF). +.sp +.LP +The \fBscf_iter_service_pgs_typed()\fR, \fBscf_iter_instance_pgs_typed()\fR, +and \fBscf_iter_snaplevel_pgs_typed()\fR functions iterate over the child +property groups of \fIparent\fR, but restrict them to a particular property +group type. +.sp +.LP +The \fBscf_iter_instance_pgs_composed()\fR function sets up a new iteration of +the composed view of instance's children at the time \fIsnapshot\fR was taken. +If \fIsnapshot\fR is \fINULL\fR, the current properties are used. The composed +view of an instance's properties is the union of the properties of the instance +and its ancestors. Properties of the instance take precedence over properties +of the service with the same name, including property group name. Property +groups retrieved with this iterator might not have \fIinstance\fR as their +parent and properties retrieved from such property groups might not have the +indicated property group as their parent. If \fIinstance\fR and its parent have +property groups with the same name but different types, the properties in the +property group of the parent are excluded. The +\fBscf_iter_instance_pgs_typed_composed()\fR function behaves as +\fBscf_iter_instance_pgs_composed()\fR, except the property groups of the type +\fIpgtype\fR are returned. +.sp +.LP +The \fBscf_iter_next_scope()\fR, \fBscf_iter_next_service()\fR, +\fBscf_iter_next_instance()\fR, \fBscf_iter_next_snapshot()\fR, +\fBscf_iter_next_pg()\fR, \fBscf_iter_next_property()\fR, and +\fBscf_iter_next_value()\fR functions retrieve the next element of the +iteration. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_iter_create()\fR returns a pointer to a new +iterator. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_iter_handle()\fR returns the handle +associated with \fIiter\fR. Otherwise it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_iter_handle_scopes()\fR, +\fBscf_iter_scope_services()\fR, \fBscf_iter_service_instances()\fR, +\fBscf_iter_instance_snapshots()\fR, \fBscf_iter_service_pgs()\fR, +\fBscf_iter_instance_pgs()\fR, \fBscf_iter_snaplevel_pgs()\fR, +\fBscf_iter_pg_properties()\fR, \fBscf_iter_property_values()\fR, +\fBscf_iter_service_pgs_typed()\fR, \fBscf_iter_instance_pgs_composed()\fR, +\fBscf_iter_instance_pgs_typed()\fR, +\fBscf_iter_instance_pgs_typed_composed()\fR, and +\fBscf_iter_snaplevel_pgs_typed()\fR return 0. Otherwise, they return -1. +.sp +.LP +Upon successful completion, \fBscf_iter_next_scope()\fR, +\fBscf_iter_next_service()\fR, \fBscf_iter_next_instance()\fR, +\fBscf_iter_next_snapshot()\fR, \fBscf_iter_next_pg()\fR, +\fBscf_iter_next_property()\fR, and \fBscf_iter_next_value()\fR return 1. If +the iterator is complete, they return 0. Otherwise, they return -1. +.SH ERRORS +.sp +.LP +The \fBscf_iter_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The handle argument is NULL. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.RS 30n +.rt +There is no memory available. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.RS 30n +.rt +The server does not have adequate resources for a new iteration. +.RE + +.sp +.LP +The \fBscf_iter_handle()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.RS 30n +.rt +The handle associated with \fIiter\fR has been destroyed. +.RE + +.sp +.LP +The \fBscf_iter_next_value()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The value could not be read due to access restrictions. +.RE + +.sp +.LP +The \fBscf_iter_handle_scopes()\fR, \fBscf_iter_scope_services()\fR, +\fBscf_iter_service_instances()\fR, \fBscf_iter_instance_snapshots()\fR, +\fBscf_iter_service_pgs()\fR, \fBscf_iter_instance_pgs()\fR, +\fBscf_iter_instance_pgs_composed()\fR, \fBscf_iter_snaplevel_pgs()\fR, +\fBscf_iter_pg_properties()\fR, \fBscf_iter_property_values()\fR, +\fBscf_iter_service_pgs_typed()\fR, \fBscf_iter_instance_pgs_typed()\fR, +\fBscf_iter_instance_pgs_typed_composed()\fR, and +\fBscf_iter_snaplevel_pgs_typed()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The parent has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The parent is not set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The \fIiter\fR and \fIparent\fR arguments are not derived from the same handle. +.RE + +.sp +.LP +The \fBscf_iter_service_pgs_typed()\fR, \fBscf_iter_instance_pgs_typed()\fR, +\fBscf_iter_instance_pgs_typed_composed()\fR, and +\fBscf_iter_snaplevel_pgs_typed()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The \fIpgtype\fR argument is not a valid property group type. +.RE + +.sp +.LP +The \fBscf_iter_next_service()\fR, \fBscf_iter_next_instance()\fR, +\fBscf_iter_next_snapshot()\fR, \fBscf_iter_next_pg()\fR, +\fBscf_iter_next_property()\fR, and \fBscf_iter_next_value()\fR functions will +fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.RS 21n +.rt +The parent the iterator is attached to has been deleted. +.RE + +.sp +.LP +The \fBscf_iter_next_scope()\fR, \fBscf_iter_next_service()\fR, +\fBscf_iter_next_instance()\fR, \fBscf_iter_next_snapshot()\fR, +\fBscf_iter_next_pg()\fR,\fBscf_iter_next_property()\fR, and +\fBscf_iter_next_value()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The iterator is not set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The requested object type does not match the type the iterator is walking. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The \fIiter\fR and \fIparent\fR arguments are not derived from the same handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.LP +The \fBscf_iter_scope_services()\fR, \fBscf_iter_service_instances()\fR, +\fBscf_iter_service_pgs()\fR, \fBscf_iter_instance_snapshots()\fR, +\fBscf_iter_instance_pgs()\fR, \fBscf_iter_instance_pgs_composed()\fR, +\fBscf_iter_snaplevel_pgs()\fR, \fBscf_iter_pg_properties()\fR, +\fBscf_iter_property_values()\fR, \fBscf_iter_service_pgs_typed()\fR, +\fBscf_iter_instance_pgs_typed()\fR, +\fBscf_iter_instance_pgs_typed_composed()\fR, +\fBscf_iter_snaplevel_pgs_typed()\fR, \fBscf_iter_next_service()\fR, +\fBscf_iter_next_instance()\fR, \fBscf_iter_next_snapshot()\fR, +\fBscf_iter_next_pg()\fR, and \fBscf_iter_next_property()\fR functions will +fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.RS 26n +.rt +The server does not have the resources to complete the request. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH EXAMPLES +.LP +\fBExample 1 \fRIterate over all instances under a service. +.sp +.in +2 +.nf +scf_iter_t *iter = scf_iter_create(handle); + +if (iter == NULL || scf_iter_service_instances(iter, parent) == -1) { + /* failure */ +} +while ((r = scf_iter_next_instance(iter, child)) > 0) { + /* process child */ +} +if (r < 0) { + /* failure */ +} +scf_iter_destroy(iter); +.fi +.in -2 + +.LP +\fBExample 2 \fRConnect to the repository, walk all services and instances and +print their FMRIs. +.sp +.in +2 +.nf +scf_handle_t *handle = scf_handle_create(SCF_VERSION); +scf_scope_t *scope = scf_scope_create(handle); +scf_service_t *svc = scf_service_create(handle); +scf_instance_t *inst = scf_instance_create(handle); +scf_iter_t *svc_iter = scf_iter_create(handle); +scf_iter_t *inst_iter = scf_iter_create(handle); + +size_t sz = scf_limit(SCF_LIMIT_MAX_FMRI_LENGTH) + 1; +char *fmri = malloc(sz + 1); + +int r; + +if (handle == NULL || scope == NULL || svc == NULL || + inst == NULL || svc_iter == NULL || inst_iter == NULL || + fmri == NULL) { + /* failure */ +} +if (scf_handle_bind(handle) == -1 || + scf_handle_get_scope(handle, SCF_SCOPE_LOCAL, scope) == -1 || + scf_iter_scope_services(svc_iter, scope) == -1) { + /* failure */ +} +while ((r = scf_iter_next_service(svc_iter, svc)) > 0) { + if (scf_service_to_fmri(svc, fmri, sz) < 0) { + /* failure */ + } + puts(fmri); + if (scf_iter_service_instances(inst_iter, svc) < 0) { + /* failure */ + } + while ((r = scf_iter_next_instance(inst_iter, inst)) > 0) { + if (scf_instance_to_fmri(inst, fmri, sz) < 0) { + /* failure */ + } + puts(fmri); + } + if (r < 0) + break; +} +if (r < 0) { + /* failure */ +} + +scf_handle_destroy(handle); +scf_scope_destroy(scope); +scf_service_destroy(svc); +scf_instance_destroy(inst); +scf_iter_destroy(svc_iter); +scf_iter_destroy(inst_iter); +.fi +.in -2 + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_entry_add_value\fR(3SCF), \fBscf_error\fR(3SCF), +\fBscf_handle_create\fR(3SCF), \fBattributes\fR(5) diff --git a/usr/src/man/man3scf/scf_limit.3scf b/usr/src/man/man3scf/scf_limit.3scf new file mode 100644 index 0000000000..4181752aea --- /dev/null +++ b/usr/src/man/man3scf/scf_limit.3scf @@ -0,0 +1,124 @@ +'\" te +.\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_limit 3SCF "17 Aug 2004" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_limit \- limit information for Service Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBssize_t\fR \fBscf_limit\fR(\fBuint32_t\fR \fIname\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBscf_limit()\fR function returns information about implementation-defined +limits in the service configuration facility. These limits are generally +maximum lengths for various strings. The values returned do not change during +the execution of a program, but they should not be cached between executions. +.sp +.LP +The available values for \fIname\fR are: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_LIMIT_MAX_FMRI_LENGTH\fR\fR +.ad +.sp .6 +.RS 4n +Return the maximum length of an FMRI the service configuration facility +accepts. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_LIMIT_MAX_PG_TYPE_LENGTH\fR\fR +.ad +.sp .6 +.RS 4n +Return the maximum length for property group types in the service configuration +facility. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_LIMIT_MAX_NAME_LENGTH\fR\fR +.ad +.sp .6 +.RS 4n +Return the maximum length for names in the service configuration facility. This +value does not include space for the required terminating null byte. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_LIMIT_MAX_VALUE_LENGTH\fR\fR +.ad +.sp .6 +.RS 4n +Return the maximum string length a scf_value_t can hold, not including the +terminating null byte. +.RE + +.sp +.LP +Lengths do not include space for the required terminating null byte. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_limit()\fR returns the requested value. +Otherwise, it returns -1. +.SH ERRORS +.sp +.LP +The \fBscf_limit()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The \fIname\fR argument is not a recognized request. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityEvolving +_ +MT-LevelMT-Safe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), \fBattributes\fR(5) diff --git a/usr/src/man/man3scf/scf_pg_create.3scf b/usr/src/man/man3scf/scf_pg_create.3scf new file mode 100644 index 0000000000..65a0b698f9 --- /dev/null +++ b/usr/src/man/man3scf/scf_pg_create.3scf @@ -0,0 +1,854 @@ +'\" te +.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with +.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_pg_create 3SCF "29 Jun 2009" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_pg_create, scf_pg_handle, scf_pg_destroy, scf_pg_get_parent_service, +scf_pg_get_parent_instance, scf_pg_get_parent_snaplevel, scf_pg_get_name, +scf_pg_get_type, scf_pg_get_flags, scf_pg_update, scf_service_get_pg, +scf_service_add_pg, scf_instance_get_pg, scf_instance_get_pg_composed, +scf_instance_add_pg, scf_snaplevel_get_pg, scf_pg_delete, +scf_pg_get_underlying_pg \- create and manipulate property group handles and +property groups in the Service Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_propertygroup_t *\fR\fBscf_pg_create\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBscf_handle_t *\fR\fBscf_pg_handle\fR(\fBscf_propertygroup_t *\fR\fIpg\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_pg_destroy\fR(\fBscf_propertygroup_t *\fR\fIpg\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_pg_get_parent_service\fR(\fBconst scf_propertygroup_t *\fR\fIpg\fR, + \fBscf_service_t *\fR\fIsvc\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_pg_get_parent_instance\fR(\fBconst scf_propertygroup_t *\fR\fIpg\fR, + \fBscf_instance_t *\fR\fIinst\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_pg_get_parent_snaplevel\fR(\fBconst scf_propertygroup_t *\fR\fIpg\fR, + \fBscf_snaplevel_t *\fR\fIlevel\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_pg_get_name\fR(\fBconst scf_propertygroup_t *\fR\fIpg\fR, \fBchar *\fR\fIbuf\fR, + \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_pg_get_type\fR(\fBconst scf_propertygroup_t *\fR\fIpg\fR, \fBchar *\fR\fIbuf\fR, + \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_pg_get_flags\fR(\fBconst scf_propertygroup_t *\fR\fIpg\fR, \fBuint32_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_pg_update\fR(\fBconst scf_propertygroup_t *\fR\fIpg\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_service_get_pg\fR(\fBconst scf_service_t *\fR\fIsvc\fR, \fBconst char *\fR\fIname\fR, + \fBscf_propertygroup_t *\fR\fIpg\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_service_add_pg\fR(\fBconst scf_service_t *\fR\fIsvc\fR, + \fBconst char *\fR\fIname\fR, \fBconst char *\fR\fIgroup_type\fR, + \fBuint32_t\fR \fIflags\fR, \fBscf_propertygroup_t *\fR\fIpg\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_instance_get_pg\fR(\fBconst scf_instance_t *\fR\fIinst\fR, + \fBconst char *\fR\fIname\fR, \fBscf_propertygroup_t *\fR\fIpg\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_instance_get_pg_composed\fR(\fBconst scf_instance_t *\fR\fIinst\fR, + \fBconst scf_snapshot_t *\fR\fIsnapshot\fR, \fBconst char *\fR\fIname\fR, + \fBscf_propertygroup_t *\fR\fIpg\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_instance_add_pg\fR(\fBconst scf_instance_t *\fR\fIinst\fR, + \fBconst char *\fR\fIname\fR, \fBconst char *\fR\fIgroup_type\fR, \fBuint32_t\fR \fIflags\fR, + \fBscf_propertygroup_t *\fR\fIpg\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_snaplevel_get_pg\fR(\fBconst scf_snaplevel_t *\fR\fIlevel\fR, + \fBconst char *\fR\fIname\fR, \fBscf_propertygroup_t *\fR\fIpg\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_pg_delete\fR(\fBscf_propertygroup_t *\fR\fIpg\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_pg_get_underlying_pg\fR(\fBconst scf_propertygroup_t *\fR\fIpg\fR, + \fBscf_propertygroup_t *\fR\fIout\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +Property groups are an atomically-updated group of typed properties. Property +groups of services (see \fBscf_service_create\fR(3SCF)) or instances (see +\fBscf_instance_create\fR(3SCF)) are modifiable. Property groups of snaplevels +(see \fBscf_snaplevel_create\fR(3SCF)) are not modifiable. +.sp +.LP +An \fBscf_propertygroup_t\fR is an opaque handle that can be set to a single +property group at any given time. When an \fBscf_propertygroup_t\fR is set, it +references a frozen-in-time version of the property group to which it is set. +Updates to the property group will not be visible until either +\fBscf_pg_update()\fR is called or the property group is set again. +.sp +.LP +This static view is propagated to the \fBscf_property_t\fRs set to children of +the property group. They will not see updates, even if the +\fBscf_propertygroup_t\fR is updated. +.sp +.LP +The \fBscf_pg_create()\fR function allocates and initializes a new +\fBscf_propertygroup_t\fR bound to \fIhandle\fR. The \fBscf_pg_destroy()\fR +function destroys and frees \fIpg\fR. +.sp +.LP +The \fBscf_pg_handle()\fR function retrieves the handle to which \fIpg\fR is +bound. +.sp +.LP +The \fBscf_pg_get_parent_service()\fR, \fBscf_pg_get_parent_instance()\fR, and +\fBscf_pg_get_parent_snaplevel()\fR functions retrieve the property group's +parent, if it is of the requested type. +.sp +.LP +The \fBscf_pg_get_name()\fR and \fBscf_pg_get_type()\fR functions retrieve the +name and type, respectively, of the property group to which \fIpg\fR is set. +.sp +.LP +The \fBscf_pg_get_flags()\fR function retrieves the flags for the property +group to which \fIpg\fR is set. If \fBSCF_PG_FLAG_NONPERSISTENT\fR is set, the +property group is not included in snapshots and will lose its contents upon +system shutdown or reboot. Non-persistent property groups are mainly used for +smf-internal state. See \fBsmf\fR(5). +.sp +.LP +The \fBscf_pg_update()\fR function ensures that \fIpg\fR is attached to the +most recent version of the \fIpg\fR to which it is set. +.sp +.LP +The \fBscf_service_get_pg()\fR, \fBscf_instance_get_pg()\fR, and +\fBscf_snaplevel_get_pg()\fR functions set \fIpg\fR to the property group +specified by \fIname\fR in the service specified by \fIsvc\fR, the instance +specified by \fIinst\fR, or the snaplevel specified by \fIlevel\fR, +respectively. +.sp +.LP +The \fBscf_instance_get_pg_composed()\fR function sets \fIpg\fR to the property +group specified by \fIname\fR in the composed view of \fIinst\fR at the time +\fIsnapshot\fR was taken. If \fIsnapshot\fR is \fINULL\fR, the current +properties are used. The composed view of an instance's properties is the union +of the properties of the instance and its ancestors. Properties of the instance +take precedence over properties of the service with the same name (including +the property group name). After a successful call to +\fBscf_instance_get_pg_composed()\fR, the parent of \fIpg\fR might not be +\fIinst\fR, and the parents of properties obtained from \fIpg\fR might not be +\fIpg\fR. If \fIinst\fR and its parent have property groups with the same name +but different types, the properties in the property group of the parent are +excluded. +.sp +.LP +The \fBscf_service_add_pg()\fR and \fBscf_instance_add_pg()\fR functions create +a new property group specified by \fIname\fR whose type is \fIgroup_type\fR, +and attach the \fIpg\fR handle (if non-null) to the new object. The \fIflags\fR +argument must be either 0 or \fBSCF_PG_FLAG_NONPERSISTENT\fR. +.sp +.LP +The \fBscf_pg_delete()\fR function deletes the property group. Versions of the +property group in snapshots are not affected. +.sp +.LP +The \fBscf_pg_get_underlying_pg()\fR function gets the first existing +underlying property group. If the property group specified by \fIpg\fR is an +instance property group, \fIout\fR is set to the property group of the same +name in the instance's parent. +.sp +.LP +Applications can use a transaction to modify a property group. See +\fBscf_transaction_create\fR(3SCF). +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_pg_create()\fR returns a new +\fBscf_propertygroup_t\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_pg_handle()\fR returns a pointer to the +handle to which \fIpg\fR is bound. Otherwise, it returns NULL. +.sp +.LP +Upon successful completion, \fBscf_instance_handle()\fR returns the handle +instance with which it is associated. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_pg_get_name()\fR and \fBscf_pg_get_type()\fR +return the length of the string written, not including the terminating null +byte. Otherwise, they return -1. +.sp +.LP +The \fBscf_pg_update()\fR function returns 1 if the object was updated, 0 if +the object was already up to date, and -1 on failure. +.sp +.LP +Upon successful completion, \fBscf_pg_get_parent_service()\fR, +\fBscf_pg_get_parent_snaplevel()\fR, \fBscf_pg_get_flags()\fR, +\fBscf_service_get_pg()\fR, \fBscf_service_add_pg()\fR, +\fBscf_pg_get_parent_instance()\fR, \fBscf_instance_get_pg()\fR, +\fBscf_instance_get_pg_composed()\fR, \fBscf_instance_add_pg()\fR, +\fBscf_snaplevel_get_pg()\fR, \fBscf_pg_delete()\fR, and +\fBscf_pg_get_underlying_pg()\fR return 0. Otherwise, they return -1. +.SH ERRORS +.sp +.LP +The \fBscf_pg_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The \fIhandle\fR argument is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.sp .6 +.RS 4n +There is not enough memory to allocate an \fBscf_propertygroup_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have adequate resources for a new property group handle. +.RE + +.sp +.LP +The \fBscf_pg_handle()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.sp .6 +.RS 4n +The handle associated with \fIpg\fR has been destroyed. +.RE + +.sp +.LP +The \fBscf_pg_update()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +An ancestor of the property group specified by \fIpg\fR has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. This can happen if \fIpg\fR has been corrupted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The \fIpg\fR argument refers to an invalid \fBscf_propertygroup_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The property group specified by \fIpg\fR is not set. +.RE + +.sp +.LP +The \fBscf_service_get_pg()\fR, \fBscf_instance_get_pg()\fR, +\fBscf_instance_get_pg_composed()\fR, \fBscf_snaplevel_get_pg()\fR, and +\fBscf_pg_get_underlying_pg()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) +chose for the operation denied access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have the resources to complete the request. +.RE + +.sp +.LP +The \fBscf_pg_get_name()\fR, \fBscf_pg_get_type()\fR, \fBscf_pg_get_flags()\fR, +\fBscf_pg_get_parent_service()\fR, \fBscf_pg_get_parent_snaplevel()\fR, and +\fBscf_pg_get_parent_instance()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The property group specified by \fIpg\fR has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The property group specified by \fIpg\fR is not set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.LP +The \fBscf_pg_get_parent_service()\fR, \fBscf_pg_get_parent_snaplevel()\fR, and +\fBscf_pg_get_parent_instance()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONSTRAINT_VIOLATED\fR\fR +.ad +.sp .6 +.RS 4n +The requested parent type does not match the actual type of the parent of the +property group specified by \fIpg\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The property group and either the instance, the service, or the snaplevel are +not derived from the same handle. +.RE + +.sp +.LP +The \fBscf_instance_get_pg()\fR, \fBscf_instance_get_pg_composed()\fR, +\fBscf_service_get_pg()\fR, \fBscf_pg_get_underlying_pg()\fR, and +\fBscf_snaplevel_get_pg()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +The property group specified by \fIname\fR was not found. +.RE + +.sp +.LP +The \fBscf_service_add_pg()\fR, \fBscf_service_get_pg()\fR, +\fBscf_instance_add_pg()\fR, \fBscf_instance_get_pg()\fR, +\fBscf_instance_get_pg_composed()\fR, and \fBscf_snaplevel_get_pg()\fR +functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The service or instance has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The instance is not set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The value of the \fIname\fR argument is not a valid property group name. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The property group and either the instance, the service, or the level are not +derived from the same handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.LP +The \fBscf_service_add_pg()\fR and \fBscf_instance_add_pg()\fR functions will +fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The caller does not have permission to create the requested property group. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_READONLY\fR\fR +.ad +.sp .6 +.RS 4n +The repository backend is read-only. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The repository backend refused the modification. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_EXISTS\fR\fR +.ad +.sp .6 +.RS 4n +A {service,instance,property group} named \fIname\fR already exists. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have the resources to complete the request. +.RE + +.sp +.LP +The \fBscf_pg_delete()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The repository backend refused the modification. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_READONLY\fR\fR +.ad +.sp .6 +.RS 4n +The repository backend is read-only. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The property group has been deleted by someone else. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have adequate resources for a new property group handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The property group has not been set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The caller does not have permission to delete this property group. +.RE + +.sp +.LP +The \fBscf_pg_get_underlying_pg()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONSTRAINT_VIOLATED\fR\fR +.ad +.sp .6 +.RS 4n +A required constraint was not met. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The property group has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The property group and \fIout\fR are not derived from the same handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +An argument is invalid. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The property group has not been set. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH EXAMPLES +.LP +\fBExample 1 \fRPerform a layered lookup of \fIname\fR in \fIpg\fR. +.sp +.in +2 +.nf +int layered_lookup(scf_propertygroup_t *pg, const char *name, +scf_property_t *out) { + scf_handle_t *handle = scf_pg_handle(out); + scf_propertygroup_t *new_pg; + scf_propertygroup_t *cur, *other; + int state = 0; + + if (handle == NULL) { + return (-1); + } + new_pg = scf_pg_create(handle); + if (new_pg == NULL) { + return (-1); + } + for (;;) { + cur = state ? pg : new_pg; + other = state ? new_pg : pg; + state = !state; + + if (scf_pg_get_property(cur, name, out) != -1) { + scf_pg_destroy(new_pg); + return (SUCCESS); + } + if (scf_pg_get_underlying_pg(cur, other) == -1) + break; + } + scf_pg_destroy(new_pg); + return (NOT_FOUND); +} +.fi +.in -2 + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), \fBscf_handle_decode_fmri\fR(3SCF), +\fBscf_instance_create\fR(3SCF), \fBscf_pg_to_fmri\fR(3SCF), +\fBscf_service_create\fR(3SCF), \fBscf_snaplevel_create\fR(3SCF), +\fBscf_transaction_create\fR(3SCF), \fBattributes\fR(5), \fBsmf\fR(5) diff --git a/usr/src/man/man3scf/scf_property_create.3scf b/usr/src/man/man3scf/scf_property_create.3scf new file mode 100644 index 0000000000..f82e84a869 --- /dev/null +++ b/usr/src/man/man3scf/scf_property_create.3scf @@ -0,0 +1,458 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_property_create 3SCF "28 Oct 2008" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_property_create, scf_property_handle, scf_property_destroy, +scf_property_get_name, scf_property_type, scf_property_is_type, +scf_type_to_string, scf_string_to_type, scf_property_get_value, +scf_pg_get_property \- create and manipulate property handles in the Service +Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_property_t *\fR\fBscf_property_create\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBscf_handle_t *\fR\fBscf_property_handle\fR(\fBscf_property_t *\fR\fIprop\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_property_destroy\fR(\fBscf_property_t *\fR\fIprop\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_property_get_name\fR(\fBconst scf_property_t *\fR\fIprop\fR, + \fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_property_type\fR(\fBconst scf_property_t *\fR\fIprop\fR, + \fBscf_type_t *\fR\fItype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_property_is_type\fR(\fBconst scf_property_t *\fR\fIprop\fR, + \fBscf_type_t\fR \fItype\fR); +.fi + +.LP +.nf +\fBconst char *\fR\fBscf_type_to_string\fR(\fBscf_type_t\fR \fItype\fR); +.fi + +.LP +.nf +\fBscf_type_t\fR \fBscf_string_to_type\fR(\fBconst char *\fR\fItype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_property_get_value\fR(\fBconst scf_property_t *\fR\fIprop\fR, + \fBscf_value_t *\fR\fIvalue\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_pg_get_property\fR(\fBconst scf_property_t *\fR\fIpg\fR, + \fBconst char *\fR\fIname\fR, \fBscf_property_t *\fR\fIprop\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +Properties are named sets of values of one type. They are grouped into property +groups (see \fBscf_pg_create\fR(3SCF)) that are updated atomically using +transactions (see \fBscf_transaction_create\fR(3SCF)). +.sp +.LP +An \fBscf_property_t\fR is an opaque handle that can be set to a single +property at any given time. When set, it inherits the point-in-time from the +source \fBscf_propertygroup_t\fR and does not change until reset. +.sp +.LP +The \fBscf_property_create()\fR function allocates and initializes a new +\fBscf_property_t\fR bound to \fIhandle\fR. The \fBscf_property_destroy()\fR +function destroys and frees \fIprop\fR. +.sp +.LP +The \fBscf_property_handle()\fR function returns the handle to which \fIprop\fR +is bound. +.sp +.LP +The \fBscf_property_type()\fR function retrieves the type of the property to +which \fIprop\fR is set. +.sp +.LP +The \fBscf_property_is_type()\fR function determines if the property is +compatible with type. See \fBscf_value_create\fR(3SCF). +.sp +.LP +The \fBscf_type_to_string()\fR function returns the string name of the type +supplied. If the type is invalid or unknown, it returns "unknown". +.sp +.LP +The \fBscf_string_to_type()\fR function returns the \fBscf_type_t\fR definition +of the string supplied. If the string does not translate to an existing type, +it returns \fBSCF_TYPE_INVALID\fR. +.sp +.LP +The \fBscf_property_get_value()\fR function retrieves the single value that the +property to which \fIprop\fR is set contains. If the property has more than one +value, the \fIvalue\fR argument is set to one of the values. To retrieve all +values associated with a property, see \fBscf_iter_property_values\fR(3SCF). +.sp +.LP +The \fBscf_pg_get_property()\fR function sets \fIprop\fR to the property +specified by \fIname\fR in the property group specified by \fIpg\fR. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_property_create()\fR returns a new +\fBscf_property_t\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_property_get_name()\fR function returns the +length of the string written, not including the terminating null byte. +Otherwise, it returns -1. +.sp +.LP +Upon successful completion, \fBscf_pg_get_property()\fR, +\fBscf_property_type()\fR, \fBscf_property_is_type()\fR, and +\fBscf_pg_get_value()\fR functions return 0. Otherwise, they return -1. +.sp +.LP +Upon successful completion, \fBscf_type_to_string()\fR returns a string of the +type supplied. +.sp +.LP +Upon successful completion, \fBscf_string_to_type()\fR returns the +\fBscf_type_t\fR definition of the string supplied +.SH ERRORS +.sp +.LP +The \fBscf_property_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The value of the \fIhandle\fR argument is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.RS 30n +.rt +There is not enough memory to allocate an \fBscf_property_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.RS 30n +.rt +The server does not have adequate resources for a new property handle. +.RE + +.sp +.LP +The \fBscf_property_handle()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.RS 30n +.rt +The handle associated with \fIprop\fR has been destroyed. +.RE + +.sp +.LP +The \fBscf_property_get_name()\fR, \fBscf_property_type()\fR, +\fBscf_property_is_type()\fR, and \fBscf_property_get_value()\fR functions will +fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The property's parent property group or an ancestor has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle was never bound or has been unbound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The property is not set. +.RE + +.sp +.LP +The \fBscf_property_is_type()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The \fItype\fR argument is not a valid type. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_TYPE_MISMATCH\fR\fR +.ad +.RS 30n +.rt +The \fIprop\fR argument is not of a type compatible with \fItype\fR. +.RE + +.sp +.LP +The \fBscf_pg_get_property()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) +chose for the operation denied access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The property group or an ancestor has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The property group and property are not derived from the same handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The value of the \fIname\fR argument is not a valid property name. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have the resources to complete the request. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle was never bound or has been unbound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +The property specified by \fIname\fR was not found. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The property group specified by \fIpg\fR is not set. +.RE + +.sp +.LP +The \fBscf_property_get_value()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONSTRAINT_VIOLATED\fR\fR +.ad +.sp .6 +.RS 4n +The property has more than one value associated with it. The \fIvalue\fR +argument will be set to one of the values. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The property and value are derived from different handles. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +The property has no values associated with it. The \fIvalue\fR argument will be +reset. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The value could not be read due to access restrictions. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), \fBscf_handle_decode_fmri\fR(3SCF), +\fBscf_iter_property_values\fR(3SCF), \fBscf_pg_create\fR(3SCF), +\fBscf_property_to_fmri\fR(3SCF), \fBscf_transaction_create\fR(3SCF), +\fBscf_value_create\fR(3SCF), \fBattributes\fR(5) diff --git a/usr/src/man/man3scf/scf_scope_create.3scf b/usr/src/man/man3scf/scf_scope_create.3scf new file mode 100644 index 0000000000..54508aa5fd --- /dev/null +++ b/usr/src/man/man3scf/scf_scope_create.3scf @@ -0,0 +1,263 @@ +'\" te +.\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_scope_create 3SCF "9 Sep 2004" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_scope_create, scf_scope_handle, scf_scope_destroy, scf_scope_get_name, +scf_handle_get_scope \- create and manipulate scope handles in the Service +Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_scope_t *\fR\fBscf_scope_create\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBscf_handle_t *\fR\fBscf_scope_handle\fR(\fBscf_scope_t *\fR\fIsc\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_scope_destroy\fR(\fBscf_scope_t *\fR\fIsc\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_scope_get_name\fR(\fBscf_scope_t *\fR\fIsc\fR, \fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_handle_get_scope\fR(\fBscf_handle_t *\fR\fIhandle\fR, \fBconst char *\fR\fIname\fR, + \fBscf_scope_t *\fR\fIout\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +Scopes are the top level of the Service Configuration Facility's repository +tree. The children of a scope are services (see \fBscf_service_create\fR(3SCF)) +and can be walked using \fBscf_iter_scope_services\fR(3SCF). +.sp +.LP +There is a distinguished scope with the name \fBSCF_SCOPE_LOCAL\fR that is the +root for all available services on the local machine. In the current +implementation, there are no other scopes. +.sp +.LP +An \fBscf_scope_t\fR is an opaque handle that can be set to a single scope at +any given time. The \fBscf_scope_create()\fR function allocates a new +\fBscf_scope_t\fR bound to \fIhandle\fR. The \fBscf_scope_destroy()\fR function +destroys and frees \fIsc\fR. +.sp +.LP +The \fBscf_scope_handle()\fR function retrieves the handle to which \fIsc\fR is +bound. +.sp +.LP +The \fBscf_scope_get_name()\fR function retrieves the name of the scope to +which \fIsc\fR is set. +.sp +.LP +The \fBscf_handle_get_scope()\fR function sets \fIout\fR to the scope specified +by \fIname\fR for the repository handle specified by \fIhandle\fR. The +\fBscf_iter_handle_scopes\fR(3SCF) and \fBscf_iter_next_scope\fR(3SCF) calls +can be used to iterate through all available scopes. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_scope_create()\fR returns a new +\fBscf_scope_t\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_scope_handle()\fR returns the handle to +which \fIsc\fR is bound. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_scope_get_name()\fR returns the length of +the string written, not including the terminating null byte. Otherwise, it +returns -1. +.sp +.LP +Upon successful completion, \fBscf_handle_get_scope()\fR returns 0. Otherwise, +it returns -1. +.SH ERRORS +.sp +.LP +The \fBscf_scope_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The value of the \fIhandle\fR argument is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.RS 30n +.rt +There is not enough memory to allocate an \fBscf_scope_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.RS 30n +.rt +The server does not have adequate resources for a new scope handle. +.RE + +.sp +.LP +The \fBscf_scope_handle()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.RS 30n +.rt +The handle associated with \fIsc\fR has been destroyed. +.RE + +.sp +.LP +The \fBscf_scope_get_name()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The scope is not set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.LP +The \fBscf_handle_get_scope()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +No scope named name was found. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The \fIname\fR argument is not a valid scope name. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The value of the \fIout\fR argument is not derived from handle. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityEvolving +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), \fBscf_handle_decode_fmri\fR(3SCF), +\fBscf_iter_handle_scopes\fR(3SCF), \fBscf_iter_next_scope\fR(3SCF), +\fBscf_iter_scope_services\fR(3SCF), \fBscf_scope_to_fmri\fR(3SCF), +\fBscf_service_create\fR(3SCF), \fBattributes\fR(5) diff --git a/usr/src/man/man3scf/scf_service_create.3scf b/usr/src/man/man3scf/scf_service_create.3scf new file mode 100644 index 0000000000..ea84428464 --- /dev/null +++ b/usr/src/man/man3scf/scf_service_create.3scf @@ -0,0 +1,464 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_service_create 3SCF "27 Aug 2007" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_service_create, scf_service_handle, scf_service_destroy, +scf_service_get_parent, scf_service_get_name, scf_scope_get_service, +scf_scope_add_service, scf_service_delete \- create and manipulate service +handles and services in the Service Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_service_t *\fR\fBscf_service_create\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBscf_handle_t *\fR\fBscf_service_handle\fR(\fBscf_service_t *\fR\fIsvc\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_service_destroy\fR(\fBscf_service_t *\fR\fIsvc\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_service_get_parent\fR(\fBscf_service_t *\fR\fIsvc\fR, \fBscf_scope_t *\fR\fIsc\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_service_get_name\fR(\fBconst scf_service_t *\fR\fIsvc\fR, \fBchar *\fR\fIbuf\fR, + \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_scope_get_service\fR(\fBconst scf_scope_t *\fR\fIsc\fR, \fBconst char *\fR\fIname\fR, + \fBscf_service_t *\fR\fIsvc\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_scope_add_service\fR(\fBconst scf_scope_t *\fR\fIsc\fR, \fBconst char *\fR\fIname\fR, + \fBscf_service_t *\fR\fIsvc\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_service_delete\fR(\fBscf_service_t *\fR\fIsvc\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +Services form the middle layer of the Service Configuration Facility repository +tree. Services are children of a scope (see \fBscf_scope_create\fR(3SCF)) and +have three sets of children: +.sp +.ne 2 +.mk +.na +\fBProperty groups\fR +.ad +.RS 19n +.rt +These hold configuration information shared by all of the instances of the +service. See \fBscf_pg_create\fR(3SCF), \fBscf_iter_service_pgs\fR(3SCF), and +\fBscf_iter_service_pgs_typed\fR(3SCF). +.RE + +.sp +.ne 2 +.mk +.na +\fBInstances\fR +.ad +.RS 19n +.rt +A particular instantiation of the service. See \fBscf_instance_create\fR(3SCF). +.RE + +.sp +.LP +A service groups one or more related instances and provides a shared +configuration for them. +.sp +.LP +An \fBscf_service_t\fR is an opaque handle that can be set to a single service +at any given time. The \fBscf_service_create()\fR function allocates and +initializes a new \fBscf_service_t\fR bound to \fIhandle\fR. The +\fBscf_service_destroy()\fR function destroys and frees svc. +.sp +.LP +The \fBscf_service_handle()\fR function retrieves the handle to which \fIsvc\fR +is bound. +.sp +.LP +The \fBscf_service_get_parent()\fR function sets \fIsc\fR to the scope that is +the parent of \fIsvc\fR. +.sp +.LP +The \fBscf_service_get_name()\fR function retrieves the name of the service to +which \fIsvc\fR is set. +.sp +.LP +The \fBscf_scope_get_service()\fR function sets \fIsvc\fR to the service +specified by \fIname\fR in the scope specified by \fIsc\fR. +.sp +.LP +The \fBscf_scope_add_service()\fR function sets \fIsvc\fR to a new service +specified by \fIname\fR in the scope specified by \fIsc\fR. +.sp +.LP +The \fBscf_service_delete()\fR function deletes the service to which \fIsvc\fR +is set, as well as all of its children. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_service_create()\fR returns a new +\fBscf_service_t\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_service_handle()\fR returns the handle to +which svc is bound. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_service_get_name()\fR returns the length of +the string written, not including the terminating null byte. Otherwise, it +returns -1. +.sp +.LP +Upon successful completion, \fBscf_service_get_parent()\fR, +\fBscf_scope_get_service()\fR, \fBscf_scope_add_service()\fR, and +\fBscf_service_delete()\fR return 0. Otherwise, it returns -1. +.SH ERRORS +.sp +.LP +The \fBscf_service_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The value of the \fIhandle\fR argument is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.RS 30n +.rt +There is not enough memory to allocate an \fBscf_service_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.RS 30n +.rt +The server does not have adequate resources for a new scope handle. +.RE + +.sp +.LP +The \fBscf_service_handle()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.RS 30n +.rt +The handle associated with \fIsvc\fR has been destroyed. +.RE + +.sp +.LP +The \fBscf_service_get_name()\fR, \fBscf_service_get_parent()\fR, and +\fBscf_service_delete()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The service has been deleted by someone else. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The service is not set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.LP +The \fBscf_service_delete()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_EXISTS\fR\fR +.ad +.RS 26n +.rt +The service contains instances. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.RS 26n +.rt +The server does not have adequate resources for a new scope handle. +.RE + +.sp +.LP +The \fBscf_scope_add_service()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_EXISTS\fR\fR +.ad +.RS 20n +.rt +A {service,instance,property group} named \fIname\fR already exists. +.RE + +.sp +.LP +The \fBscf_scope_get_service()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.RS 28n +.rt +The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) +chose for the operation denied access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.RS 28n +.rt +An internal error occurred. +.RE + +.sp +.LP +The \fBscf_scope_add_service()\fR and \fBscf_scope_get_service()\fR functions +will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The parent entity has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The scope and service are not derived from the same handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The value of the \fIname\fR argument is not a valid service name. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have the resources to complete the request. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +The service specified by \fIname\fR was not found. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The scope is not set. +.RE + +.sp +.LP +The \fBscf_scope_add_service()\fR and \fBscf_service_delete()\fR functions will +fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The user does not have sufficient privileges to create or delete a service. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_READONLY\fR\fR +.ad +.sp .6 +.RS 4n +The repository backend is read-only. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The repository backend refused the modification. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), \fBscf_handle_decode_fmri\fR(3SCF), +\fBscf_iter_service_pgs\fR(3SCF), \fBscf_iter_service_pgs_typed\fR(3SCF), +\fBscf_instance_create\fR(3SCF), \fBscf_pg_create\fR(3SCF), +\fBscf_scope_create\fR(3SCF), \fBscf_service_to_fmri\fR(3SCF), +\fBattributes\fR(5), \fBsmf\fR(5) diff --git a/usr/src/man/man3scf/scf_simple_prop_get.3scf b/usr/src/man/man3scf/scf_simple_prop_get.3scf new file mode 100644 index 0000000000..f008682484 --- /dev/null +++ b/usr/src/man/man3scf/scf_simple_prop_get.3scf @@ -0,0 +1,556 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_simple_prop_get 3SCF "7 Nov 2007" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_simple_prop_get, scf_simple_prop_free, scf_simple_app_props_get, +scf_simple_app_props_free, scf_simple_app_props_next, +scf_simple_app_props_search, scf_simple_prop_numvalues, scf_simple_prop_type, +scf_simple_prop_name, scf_simple_prop_pgname, scf_simple_prop_next_boolean, +scf_simple_prop_next_count, scf_simple_prop_next_integer, +scf_simple_prop_next_time, scf_simple_prop_next_astring, +scf_simple_prop_next_ustring, scf_simple_prop_next_opaque, +scf_simple_prop_next_reset \- simplified property read interface to Service +Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_simple_prop_t *\fR\fBscf_simple_prop_get\fR(\fBscf_handle_t *\fR\fIhandle\fR, + \fBconst char *\fR\fIinstance\fR, \fBconst char *\fR\fIpgname\fR, \fBconst char *\fR\fIpropname\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_simple_prop_free\fR(\fBscf_simple_prop_t *\fR\fIprop\fR); +.fi + +.LP +.nf +\fBscf_simple_app_props_t *\fR\fBscf_simple_app_props_get\fR(\fBscf_handle_t *\fR\fIhandle\fR, + \fBconst char *\fR\fIinstance\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_simple_app_props_free\fR(\fBscf_simple_app_props_t *\fR\fIpropblock\fR); +.fi + +.LP +.nf +\fBconst scf_simple_prop_t *\fR\fBscf_simple_app_props_next\fR + (\fBconst scf_simple_app_props_t *\fR\fIpropblock\fR,\fBscf_simple_prop_t *\fR\fIlast\fR); +.fi + +.LP +.nf +\fBconst scf_simple_prop_t *\fR\fBscf_simple_app_props_search\fR + (\fBconst scf_simple_app_props_t *\fR\fIpropblock\fR, \fBconst char *\fR\fIpgname\fR, + \fBconst char *\fR\fIpropname\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_simple_prop_numvalues\fR(\fBconst scf_simple_prop_t *\fR\fIprop\fR); +.fi + +.LP +.nf +\fBscf_type_t\fR \fBscf_simple_prop_type\fR(\fBconst scf_simple_prop_t *\fR\fIprop\fR); +.fi + +.LP +.nf +\fBconst char *\fR\fBscf_simple_prop_name\fR(\fBconst scf_simple_prop_t *\fR\fIprop\fR); +.fi + +.LP +.nf +\fBconst char *\fR\fBscf_simple_prop_pgname\fR(\fBconst scf_simple_prop_t *\fR\fIprop\fR); +.fi + +.LP +.nf +\fBuint8_t *\fR\fBscf_simple_prop_next_boolean\fR(\fBconst scf_simple_prop_t *\fR\fIprop\fR); +.fi + +.LP +.nf +\fBuint64_t *\fR\fBscf_simple_prop_next_count\fR(\fBconst scf_simple_prop_t *\fR\fIprop\fR); +.fi + +.LP +.nf +\fBint64_t *\fR\fBscf_simple_prop_next_integer\fR(\fBconst scf_simple_prop_t *\fR\fIprop\fR); +.fi + +.LP +.nf +\fBint64_t *\fR\fBscf_simple_prop_next_time\fR(\fBconst scf_simple_prop_t *\fR\fIprop\fR, + \fBint32_t *\fR\fInsec\fR); +.fi + +.LP +.nf +\fBchar *\fR\fBscf_simple_prop_next_astring\fR(\fBconst scf_simple_prop_t *\fR\fIprop\fR); +.fi + +.LP +.nf +\fBchar *\fR\fBscf_simple_prop_next_ustring\fR(\fBconst scf_simple_prop_t *\fR\fIprop\fR); +.fi + +.LP +.nf +\fBvoid *\fR\fBscf_simple_prop_next_opaque\fR(\fBconst scf_simple_prop_t *\fR\fIprop\fR, + \fBsize_t *\fR\fIlength\fR); +.fi + +.LP +.nf +\fBvoid *\fR\fBscf_simple_prop_next_reset\fR(\fBconst scf_simple_prop_t *\fR\fIprop\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The simplified read interface to the Service Configuration Facility deals with +properties and blocks of properties. +.sp +.LP +The \fBscf_simple_prop_get()\fR function pulls a single property. The +\fBscf_simple_prop_*()\fR functions operate on the resulting +\fBscf_simple_prop_t\fR. +.sp +.LP +The application might need to get many properties or iterate through all +properties. The \fBscf_simple_app_props_get()\fR function gets all properties +from the service instance that are in property groups of type 'application'. +Individual properties are pulled from the block using the +\fBscf_simple_app_props_next()\fR function for iteration or +\fBscf_simple_app_props_search()\fR to search. The pointer to the +\fBscf_simple_prop_t\fR returned from iteration or searching can be acted upon +using the \fBscf_simple_prop_*()\fR functions. Each \fBscf_*_get()\fR function +has an accompanying \fBscf_*_free\fR function. The application does not free +the pointer to the \fBscf_simple_prop_t\fR returned from the +\fBscf_simple_app_props_next()\fR and \fBscf_simple_app_props_search()\fR +calls. A free call is only used with a corresponding get call. +.sp +.LP +The \fBscf_simple_prop_*()\fR functions return references to the read-only +in-memory copy of the property information. Any changes to this information +results in unstable behavior and inaccurate results. The simplified read +interface provides read access only, with no provisions to modify data in the +service configuration facility repository. +.sp +.LP +The \fBscf_simple_prop_get()\fR function takes as arguments a bound handle, a +service instance FMRI, and the property group and property name of a property. +If \fIhandle\fR is \fINULL\fR, the library uses a temporary handle created for +the purpose. If \fIinstance\fR is \fINULL\fR the library automatically finds +the FMRI of the calling process. If \fIpgname\fR is \fINULL\fR, the library +uses the default application property group. The caller is responsible for +freeing the returned property with \fBscf_simple_prop_free()\fR. +.sp +.LP +The \fBscf_simple_prop_free()\fR function frees the \fBscf_simple_prop_t\fR +allocated by \fBscf_simple_prop_get()\fR. +.sp +.LP +The \fBscf_simple_app_props_get()\fR function takes a bound handle and a +service instance FMRI and pulls all the application properties into an +\fBscf_simple_app_props_t\fR. If \fIhandle\fR is \fINULL\fR, the library uses a +temporary handle created for the purpose. If \fIinstance\fR is \fINULL\fR, the +library looks up the instance FMRI of the process calling the function. The +caller is responsible for freeing the \fBscf_simple_app_props_t\fR with +\fBscf_simple_app_props_free()\fR. +.sp +.LP +The \fBscf_simple_app_props_free()\fR function frees the +\fBscf_simple_app_props_t\fR allocated by \fBscf_simple_app_props_get()\fR. +.sp +.LP +The \fBscf_simple_app_props_next()\fR function iterates over each property in +an \fBscf_simple_app_props_t\fR. It takes an \fBscf_simple_app_props_t\fR +pointer and the last property returned from the previous call and returns the +next property in the \fBscf_simple_app_props_t\fR. Because the property is a +reference into the \fBscf_simple_app_props_t\fR, its lifetime extends only +until that structure is freed. +.sp +.LP +The\fBscf_simple_app_props_search()\fR function queries for an exact match on a +property in a property group. It takes an apps prop object, a property group +name, and a property name, and returns a property pointer. Because the property +is a reference into the \fBscf_simple_app_props_t\fR, its lifetime extends only +until that structure is freed. If the property group name, \fIpgname\fR, is +\fINULL\fR, "application" is used. +.sp +.LP +The \fBscf_simple_prop_numvalues()\fR function takes a pointer to a property +and returns the number of values in that property. +.sp +.LP +The \fBscf_simple_prop_type()\fR function takes a pointer to a property and +returns the type of the property in an \fBscf_type_t\fR. +.sp +.LP +The \fBscf_simple_prop_name()\fR function takes a pointer to a property and +returns a pointer to the property name string. +.sp +.LP +The \fBscf_simple_prop_pgname()\fR function takes a pointer to a property and +returns a pointer to the property group name string. The +\fBscf_simple_prop_next_boolean()\fR, \fBscf_simple_prop_next_count()\fR, +\fBscf_simple_prop_next_integer()\fR, \fBscf_simple_prop_next_astring()\fR, and +\fBscf_simple_prop_next_ustring()\fR functions take a pointer to a property and +return the first value in the property. Subsequent calls iterate over all the +values in the property. The property's internal iteration can be reset with +\fBscf_simple_prop_next_reset()\fR. +.sp +.LP +The \fBscf_simple_prop_next_time()\fR function takes a pointer to a property +and the address of an allocated \fBint32_t\fR to hold the nanoseconds field, +and returns the first value in the property. Subsequent calls iterate over the +property values. +.sp +.LP +The \fBscf_simple_prop_next_opaque()\fR function takes a pointer to a property +and the address of an allocated integer to hold the size of the opaque buffer. +It returns the first value in the property. Subsequent calls iterate over the +property values, as do the \fBscf_simple_prop_next_*()\fR functions. The +\fBscf_simple_prop_next_opaque()\fR function writes the size of the opaque +buffer into the allocated integer. +.sp +.LP +The \fBscf_simple_prop_next_reset()\fR function resets iteration on a property, +so that a call to one of the \fBscf_simple_prop_next_*()\fR functions returns +the first value in the property. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_simple_prop_get()\fR returns a pointer to an +allocated \fBscf_simple_prop_t\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_simple_app_props_get()\fR returns a pointer +to an allocated \fBscf_simple_app_props_t\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_simple_app_props_next()\fR returns a pointer +to an \fBscf_simple_prop_t\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_simple_app_props_search()\fR returns a +pointer to an \fBscf_simple_prop_t\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_simple_prop_numvalues()\fR returns the +number of values in a property. Otherwise, it returns -1. +.sp +.LP +Upon successful completion, \fBscf_simple_prop_type()\fR returns an +\fBscf_type_t\fR. Otherwise, it returns -1. +.sp +.LP +Upon successful completion, \fBscf_simple_prop_name()\fR and +\fBscf_simple_prop_pgname()\fR return character pointers. Otherwise, they +return \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_simple_prop_next_boolean()\fR, +\fBscf_simple_prop_next_count()\fR, \fBscf_simple_prop_next_integer()\fR, +\fBscf_simple_prop_next_time()\fR, \fBscf_simple_prop_next_astring()\fR, +\fBscf_simple_prop_next_ustring()\fR, and \fBscf_simple_prop_next_opaque()\fR +return a pointer to the next value in the property. After all values have been +returned, NULL is returned and \fBSCF_ERROR_NONE\fR is set. On failure, +\fINULL\fR is returned and the appropriate error value is set. +.SH ERRORS +.sp +.LP +The \fBscf_simple_prop_get()\fR and \fBscf_simple_app_props_get()\fR functions +will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the datastore is broken. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The instance FMRI is invalid or property name is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.sp .6 +.RS 4n +The memory allocation failed. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The connection handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +The specified instance or property does not exist. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The caller is not authorized to read the property's value(s). +.RE + +.sp +.LP +The \fBscf_simple_app_props_next()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.RS 21n +.rt +The value of the \fIpropblock\fR argument is \fINULL\fR. +.RE + +.sp +.LP +The \fBscf_simple_app_props_search()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.RS 23n +.rt +The property was not found. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.RS 23n +.rt +The value of the \fIpropblock\fR or \fIpropname\fR argument is \fINULL\fR. +.RE + +.sp +.LP +The \fBscf_simple_prop_numvalues()\fR, \fBscf_simple_prop_type()\fR, +\fBscf_simple_prop_name()\fR, and \fBscf_simple_prop_pgname()\fR functions will +fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.RS 21n +.rt +The property is \fINULL\fR. +.RE + +.sp +.LP +The \fBscf_simple_prop_next_boolean()\fR, \fBscf_simple_prop_next_count()\fR, +\fBscf_simple_prop_next_integer()\fR, \fBscf_simple_prop_next_time()\fR, +\fBscf_simple_prop_next_astring()\fR, \fBscf_simple_prop_next_ustring()\fR, and +\fBscf_simple_prop_next_opaque()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.RS 27n +.rt +The property is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_TYPE_MISMATCH\fR\fR +.ad +.RS 27n +.rt +The requested type does not match the property type. +.RE + +.SH EXAMPLES +.LP +\fBExample 1 \fRSimple Property Get +.sp +.in +2 +.nf +/* + * In this example, we pull the property named "size" from the + * default property group. We make sure that the property + * isn't empty, and then copy it into the sizeval variable. + */ + +scf_simple_prop_t *prop; +ssize_t numvals; +int64_t *sizeval; + +prop = scf_simple_prop_get( + "svc://localhost/category/service/instance", + NULL, "size"); + +numvals = scf_simple_prop_numvalues(prop); + +if(numvals > 0){ + sizeval = scf_simple_prop_next_integer(prop); +} + +scf_simple_prop_free(prop); +.fi +.in -2 + +.LP +\fBExample 2 \fRProperty Iteration +.sp +.in +2 +.nf +scf_simple_prop_t *prop; +scf_simple_app_props_t *appprops; + +appprops = scf_simple_app_props_get( + "svc://localhost/category/service/instance"); + +prop = scf_simple_app_props_next(appprops, NULL); + +while(prop != NULL) +{ + /* + * This iteration will go through every property in the + * instance's application block. The user can use + * the set of property functions to pull the values out + * of prop, as seen in other examples. + */ + + (...code acting on each property...) + + +prop = scf_simple_app_props_next(appprops, prop); + +} + +scf_simple_app_props_free(appprops); +.fi +.in -2 + +.LP +\fBExample 3 \fRProperty Searching +.sp +.in +2 +.nf +/* + * In this example, we pull the property block from the instance, + * and then query it. Generally speaking, the simple get would + * be used for an example like this, but for the purposes of + * illustration, the non-simple approach is used. The property + * is a list of integers that are pulled into an array. + * Note how val is passed back into each call, as described above. + */ + +scf_simple_app_props_t *appprops; +scf_simple_prop_t *prop; +int i; +int64_t *intlist; +ssize_t numvals; + +appprops = scf_simple_app_props_get( + "svc://localhost/category/service/instance"); + +prop = scf_simple_app_props_search(appprops, "appname", "numlist"); + +if(prop != NULL){ + + numvals = scf_simple_prop_numvalues(prop); + + if(numvals > 0){ + + intlist = malloc(numvals * sizeof(int64_t)); + + val = scf_simple_prop_next_integer(prop); + + for(i=0, i < numvals, i++){ + intlist[i] = *val; + val = scf_simple_prop_next_integer(prop); + } + } +} + +scf_simple_app_props_free(appprops); +.fi +.in -2 + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), \fBattributes\fR(5) diff --git a/usr/src/man/man3scf/scf_simple_walk_instances.3scf b/usr/src/man/man3scf/scf_simple_walk_instances.3scf new file mode 100644 index 0000000000..4a71a7657f --- /dev/null +++ b/usr/src/man/man3scf/scf_simple_walk_instances.3scf @@ -0,0 +1,112 @@ +'\" te +.\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_simple_walk_instances 3SCF "17 Aug 2004" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_simple_walk_instances \- observational interface for Service Configuration +Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBint\fR \fBscf_simple_walk_instances\fR(\fBuint_t\fR \fIflags\fR, \fBvoid *\fR\fIprivate\fR, + \fBint (*\fR\fIinst_callback\fR)(scf_handle_t *, scf_instance_t *, void *)); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBscf_simple_walk_instances()\fR function iterates over every service +instance in a specified state and calls a callback function provided by the +user on each specified instance. +.sp +.LP +The function takes a \fIflags\fR argument to indicate which instance states are +involved in the iteration, an opaque buffer to be passed to the callback +function, and a callback function with three arguments, a handle, an instance +pointer, and an opaque buffer. If the callback function returns a value other +than success, iteration is ended, an error is set, and the function returns -1. +.sp +.LP +The handle passed to the callback function is provided to the callback function +by the library. This handle is used by the callback function for all low-level +allocation involved in the function. +.sp +.LP +The simplified library provides defined constants for the \fIflags\fR argument. +The user can use a bitwise OR to apply more than one flag. The +\fBSCF_STATE_ALL\fR flag is a bitwise OR of all the other states.The flags are: +.RS +4 +.TP +.ie t \(bu +.el o +\fBSCF_STATE_UNINIT\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fBSCF_STATE_MAINT\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fBSCF_STATE_OFFLINE\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fBSCF_STATE_DISABLED\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fBSCF_STATE_ONLINE\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fBSCF_STATE_DEGRADED\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fBSCF_STATE_ALL\fR +.RE +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_simple_walk_instances()\fR returns 0. +Otherwise, it returns -1. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityEvolving +_ +MT-LevelMT-Safe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBattributes\fR(5) diff --git a/usr/src/man/man3scf/scf_snaplevel_create.3scf b/usr/src/man/man3scf/scf_snaplevel_create.3scf new file mode 100644 index 0000000000..4c2886beab --- /dev/null +++ b/usr/src/man/man3scf/scf_snaplevel_create.3scf @@ -0,0 +1,406 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_snaplevel_create 3SCF "27 Aug 2007" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_snaplevel_create, scf_snaplevel_handle, scf_snaplevel_destroy, +scf_snaplevel_get_parent, scf_snaplevel_get_scope_name, +scf_snaplevel_get_service_name, scf_snaplevel_get_instance_name, +scf_snapshot_get_base_snaplevel, scf_snaplevel_get_next_snaplevel \- create and +manipulate snaplevel handles in the Service Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_snaplevel_t *\fR\fBscf_snaplevel_create\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBscf_handle_t *\fR\fBscf_snaplevel_handle\fR(\fBscf_snaplevel_t *\fR\fIlevel\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_snaplevel_destroy\fR(\fBscf_snaplevel_t *\fR\fIlevel\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_snaplevel_get_parent\fR(\fBconst scf_snaplevel_t *\fR\fIlevel\fR, + \fBconst scf_snapshot_t *\fR\fIsnap\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_snaplevel_get_scope_name\fR(\fBconst scf_snaplevel_t *\fR\fIlevel\fR, + \fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_snaplevel_get_service_name\fR(\fBconst scf_snaplevel_t *\fR\fIlevel\fR, + \fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_snaplevel_get_instance_name\fR(\fBconst scf_snaplevel_t *\fR\fIlevel\fR, + \fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_snapshot_get_base_snaplevel\fR(\fBconst scf_snapshot_t *\fR\fIsnap\fR, + \fBscf_snaplevel_t *\fR\fIlevel\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_snaplevel_get_next_snaplevel\fR(\fBscf_snaplevel_t *\fR\fIin\fR, + \fBscf_snaplevel_t *\fR\fIout\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +A snaplevel holds all of the property groups associated with either a service +or an instance. Each snapshot has an ordered list of snaplevels. Snaplevels +contain the names of the instance or service from which they are derived. +.sp +.LP +An \fBscf_snaplevel_t\fR is an opaque handle that can be set to a single +snaplevel at any given time. When set, the \fBscf_snaplevel_t\fR inherits the +point in time from the \fBscf_snapshot_t\fR from which it comes. +.sp +.LP +The \fBscf_snaplevel_create()\fR function allocates and initializes a new +\fBscf_snaplevel_t\fR bound to \fIhandle\fR. The \fBscf_snaplevel_destroy()\fR +function destroys and frees \fIlevel\fR. +.sp +.LP +The \fBscf_snaplevel_handle()\fR function retrieves the handle to which +\fIlevel\fR is bound. +.sp +.LP +The \fBscf_snaplevel_get_parent()\fR function sets \fIsnap\fR to the parent +snapshot of the snaplevel to which \fIlevel\fR is set. The snapshot specified +by \fIsnap\fR is attached to the same point in time as level. +.sp +.LP +The \fBscf_snaplevel_get_scope_name()\fR, +\fBscf_snaplevel_get_service_name()\fR, and +\fBscf_snaplevel_get_instance_name()\fR functions retrieve the name of the +scope, service, and instance for the snapshot to which \fIsnap\fR is set. If +the snaplevel is from an instance, all three succeed. If the snaplevel is from +a service, \fBscf_snaplevel_get_instance_name()\fR fails. +.sp +.LP +The \fBscf_snapshot_get_base_snaplevel()\fR function sets \fIlevel\fR to the +first snaplevel in the snapshot to which \fIsnap\fR is set. The +\fBscf_snaplevel_get_next_snaplevel()\fR function sets \fIout\fR to the next +snaplevel after the snaplevel to which \fIin\fR is set. Both the \fIin\fR and +\fIout\fR arguments can point to the same \fBscf_snaplevel_t\fR. +.sp +.LP +To retrieve the property groups associated with a snaplevel, see +\fBscf_iter_snaplevel_pgs\fR(3SCF), \fBscf_iter_snaplevel_pgs_typed\fR(3SCF), +and \fBscf_snaplevel_get_pg\fR(3SCF). +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_snaplevel_create()\fR returns a new +\fBscf_snaplevel_t\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_snaplevel_get_scope_name()\fR, +\fBscf_snaplevel_get_service_name()\fR, and +\fBscf_snaplevel_get_instance_name()\fR return the length of the string +written, not including the terminating null byte. Otherwise, they return -1. +.sp +.LP +Upon successful completion, \fBscf_snaplevel_get_parent()\fR, +\fBscf_snapshot_get_base_snaplevel()\fR, and +\fBscf_snaplevel_get_next_snaplevel()\fR return. Otherwise, they return -1. +.SH ERRORS +.sp +.LP +The \fBscf_snaplevel_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The \fIhandle\fR argument is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.RS 30n +.rt +There is not enough memory to allocate an \fBscf_snaplevel_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.RS 30n +.rt +The server does not have adequate resources for a new snapshot handle. +.RE + +.sp +.LP +The \fBscf_snaplevel_get_scope_name()\fR, +\fBscf_snaplevel_get_service_name()\fR, +\fBscf_snaplevel_get_instance_name()\fR, and \fBscf_snaplevel_get_parent()\fR +functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The object referred to by \fIlevel\fR has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The snaplevel is not set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.LP +The \fBscf_snaplevel_get_instance_name()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONSTRAINT_VIOLATED\fR\fR +.ad +.sp .6 +.RS 4n +The snaplevel is derived from a service. +.RE + +.sp +.LP +The \fBscf_snapshot_get_base_snaplevel()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The snapshot has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The snapshot and snaplevel are not derived from the same handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have the resources to complete the request. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +There are no snaplevels in this snapshot. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The snapshot is not set. +.RE + +.sp +.LP +The \fBscf_snaplevel_get_next_snaplevel()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The snaplevel has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The snaplevel is not set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The \fIin\fR and \fIout\fR arguments are not derived from the same handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +There are no more snaplevels in this snapshot. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), \fBscf_iter_snaplevel_pgs\fR(3SCF), +\fBscf_iter_snaplevel_pgs_typed\fR(3SCF), \fBscf_snaplevel_get_pg\fR(3SCF), +\fBattributes\fR(5) diff --git a/usr/src/man/man3scf/scf_snapshot_create.3scf b/usr/src/man/man3scf/scf_snapshot_create.3scf new file mode 100644 index 0000000000..b621750524 --- /dev/null +++ b/usr/src/man/man3scf/scf_snapshot_create.3scf @@ -0,0 +1,427 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_snapshot_create 3SCF "27 Aug 2007" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_snapshot_create, scf_snapshot_handle, scf_snapshot_destroy, +scf_snapshot_get_parent, scf_snapshot_get_name, scf_snapshot_update, +scf_instance_get_snapshot \- create and manipulate snapshot handles and +snapshots in the Service Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_snapshot_t *\fR\fBscf_snapshot_create\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBscf_handle_t *\fR\fBscf_snapshot_handle\fR(\fBscf_snapshot_t *\fR\fIsnap\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_snapshot_destroy\fR(\fBscf_snapshot_t *\fR\fIsnap\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_snapshot_get_parent\fR(\fBconst scf_snapshot_t *\fR\fIsnap\fR, + \fBscf_instance_t *\fR\fIinst\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_snapshot_get_name\fR(\fBconst scf_snapshot_t *\fR\fIsnap\fR, + \fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_snapshot_update\fR(\fBscf_snapshot_t *\fR\fIsnap\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_instance_get_snapshot\fR(\fBconst scf_instance_t *\fR\fIinst\fR, + \fBconst char *\fR\fIname\fR, \fBscf_snapshot_t *\fR\fIsnap\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +A snapshot is an unchanging picture of the full set of property groups +associated with an instance. Snapshots are automatically created and managed by +the Solaris Management Facility. See \fBsmf\fR(5). +.sp +.LP +A snapshot consists of a set of snaplevels, each of which holds copies of the +property groups associated with an instance or service in the resolution path +of the base instance. Typically, there is one snaplevel for the instance and +one for the instance's parent service. +.sp +.LP +The \fBscf_snapshot_create()\fR function allocates and initializes a new +\fBscf_snapshot_t\fR bound to \fIhandle\fR. The \fBscf_snapshot_destroy()\fR +function destroys and frees \fIsnap\fR. +.sp +.LP +The \fBscf_snapshot_handle()\fR function retrieves the handle to which +\fIsnap\fR is bound. +.sp +.LP +The \fBscf_snapshot_get_parent()\fR function sets \fIinst\fR to the parent of +the snapshot to which \fIsnap\fR is set. +.sp +.LP +The \fBscf_snapshot_get_name()\fR function retrieves the name of the snapshot +to which \fIsnap\fR is set. +.sp +.LP +The \fBscf_snapshot_update()\fR function reattaches \fIsnap\fR to the latest +version of the snapshot to which \fIsnap\fR is set. +.sp +.LP +The \fBscf_instance_get_snapshot()\fR function sets \fIsnap\fR to the snapshot +specified by \fIname\fR in the instance specified by \fIinst\fR. To walk all of +the snapshots, see \fBscf_iter_instance_snapshots\fR(3SCF). +.sp +.LP +To access the snaplevels of a snapshot, see +\fBscf_snapshot_get_base_snaplevel\fR(3SCF). +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_snapshot_create()\fR returns a new +\fBscf_snapshot_t\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_snapshot_handle()\fR returns the handle to +which \fIsnap\fR is bound. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_snapshot_get_name()\fR returns the length of +the string written, not including the terminating null byte. Otherwise, it +returns \fINULL\fR. +.sp +.LP +The \fBscf_snapshot_update()\fR function returns 1 if the snapshot was updated, +0 if the snapshot had not been updated, and -1 on failure. +.sp +.LP +Upon successful completion, \fBscf_snapshot_get_parent()\fR and +\fBscf_instance_get_snapshot()\fR return 0. Otherwise, they return -1. +.SH ERRORS +.sp +.LP +The \fBscf_snapshot_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The \fIhandle\fR argument is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.sp .6 +.RS 4n +There is not enough memory to allocate an \fBscf_snapshot_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have adequate resources for a new instance handle. +.RE + +.sp +.LP +The \fBscf_snapshot_handle()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.sp .6 +.RS 4n +The handle associated with \fIsnap\fR has been destroyed. +.RE + +.sp +.LP +The \fBscf_snapshot_get_name()\fR and \fBscf_snapshot_get_parent()\fR functions +will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The snapshot has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The snapshot is not set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.LP +The \fBscf_snapshot_update()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +An ancestor of the snapshot specified by \fIsnap\fR has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. This can happen if \fIsnap\fR has been corrupted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The \fIsnap\fR argument refers to an invalid \fBscf_snapshot_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The snapshot specified by \fIsnap\fR is not set. +.RE + +.sp +.LP +The \fBscf_instance_get_snapshot()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) +chose for the operation denied access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The instance has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The instance and snapshot are not derived from the same handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The value of the \fIname\fR argument is not a valid snapshot name. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have the resources to complete the request. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +The snapshot specified by \fIname\fR was not found. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The instance is not set. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), +\fBscf_iter_instance_snapshots\fR(3SCF), +\fBscf_snapshot_get_base_snaplevel\fR(3SCF), \fBattributes\fR(5), \fBsmf\fR(5) diff --git a/usr/src/man/man3scf/scf_tmpl_pg_create.3scf b/usr/src/man/man3scf/scf_tmpl_pg_create.3scf new file mode 100644 index 0000000000..2d6b9d3b2a --- /dev/null +++ b/usr/src/man/man3scf/scf_tmpl_pg_create.3scf @@ -0,0 +1,325 @@ +'\" te +.\" Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_tmpl_pg_create 3SCF "28 Oct 2008" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_tmpl_pg_create, scf_tmpl_pg_reset, scf_tmpl_pg_destroy, +scf_tmpl_get_by_pg_name, scf_tmpl_get_by_pg, scf_tmpl_iter_pgs \- template +property group functions +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_pg_tmpl_t *\fR\fBscf_tmpl_pg_create\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_tmpl_pg_reset\fR(\fBscf_pg_tmpl_t *\fR\fIpg_tmpl\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_tmpl_pg_destroy\fR(\fBscf_pg_tmpl_t *\fR\fIpg_tmpl\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_get_by_pg_name\fR(\fBconst char *\fR\fIinstance_fmri\fR, + \fBconst char *\fR\fIsnapshot\fR, \fBconst char *\fR\fIpg_name\fR, + \fBconst char *\fR\fIpg_type\fR, \fBscf_pg_tmpl_t *\fR\fIpg_tmpl\fR, \fBint\fR \fIflags\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_get_by_pg\fR(\fBscf_propertygroup_t *\fR\fIpg\fR, + \fBscf_pg_tmpl_t *\fR\fIpg_tmpl\fR, \fBint\fR \fIflags\fR) +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_iter_pgs\fR(\fBscf_pg_tmpl_t *\fR\fIpg_tmpl\fR, \fBconst char *\fR\fIfmri\fR, + \fBconst char *\fR\fIsnapshot\fR, \fBconst char *\fR\fIpg_type\fR, \fBint\fR \fIflags\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The template property group functions locate and give access to metadata about +SMF configuration for service instances. They are used to directly access +property group metadata and explore metadata for properties contained in those +property groups. +.sp +.LP +A property group does not need to be currently defined in order to explore +metadata about it, as long as the metadata is defined. Thus, the property +group template functions operate on strings rather than +\fBscf_propertygroup_t\fR entities. +.sp +.LP +By default, when an instance FMRI is specified, \fBscf_tmpl_get_by_pg_name()\fR +and \fBscf_tmpl_iter_pgs()\fR lookup composed data from the running snapshot of +the instance. A different snapshot may be explicitly selected by specifying a +valid snapshot name rather than NULL for the snapshot argument. If a service +FMRI is specified, the current properties are used. +.sp +.LP +By default, these functions also explore template data defined by the service +or instance itself, the service's restarter, and global template data. See +\fBsmf_template\fR(5) for more information about this composition. +.sp +.LP +Once retrieved, the \fBscf_pg_tmpl_t\fR can be explored using the +\fBscf_tmpl_pg_name\fR(3SCF) and \fBscf_tmpl_prop_create\fR(3SCF) suite of +functions. +.sp +.LP +Before calling \fBscf_tmpl_get_by_pg()\fR, \fBscf_tmpl_get_by_pg_name()\fR, or +\fBscf_tmpl_iter_pgs()\fR, the \fBscf_pg_tmpl_t\fR must be allocated by +\fBscf_tmpl_pg_create()\fR. The \fBscf_pg_tmpl_t\fR can be reset to contain no +template information with \fBscf_tmpl_pg_reset()\fR, so that it can be used to +start an iteration from scratch. All associated memory can be freed with +\fBscf_tmpl_pg_destroy()\fR. +.sp +.LP +The \fBscf_tmpl_get_by_pg()\fR function locates the most specific matching +template for the property group supplied. The parent of that property group can +be either a service or an instance. +.sp +.LP +The \fBscf_tmpl_get_by_pg_name()\fR function locates the most specific matching +template for the property group as specified. As described above, when the +snapshot argument is \fINULL\fR the default running snapshot is used. If flags +includes \fBSCF_PG_TMPL_FLAG_CURRENT\fR, the snapshot argument is ignored and +the current configuration is used. If flags includes +\fBSCF_PG_TMPL_FLAG_EXACT\fR, only the exact FMRI is looked up. Either or both +of the \fIpg_name\fR and \fIpg_type\fR arguments may be specified as +\fINULL\fR. In this case, \fIpg_name\fR and/or \fIpg_type\fR is wildcarded and +matches any value. The most specific snapshot matching those arguments is +returned. +.sp +.LP +The \fBscf_tmpl_iter_pgs()\fR function iterates across all templates defined +for the specified FMRI, snapshot, and optional property group type. It also +takes an optional flags argument. If flags includes +\fBSCF_PG_TMPL_FLAG_CURRENT\fR, the snapshot argument is ignored and the +"running" snapshot is used. \fBSCF_PG_TMPL_FLAG_REQUIRED\fR searches only for +required property groups. \fBSCF_PG_TMPL_FLAG_EXACT\fR looks only at the exact +FMRI provided for templates, and not for templates defined on its restarter or +globally. +.sp +.LP +The iterator state for \fBscf_tmpl_iter_pgs()\fR is stored on the template data +structure. The data structure should be allocated with +\fBscf_tmpl_pg_create()\fR and to continue the iteration the previously +returned structure should be passed in as an argument. +.SH RETURN VALUES +.sp +.LP +The \fBscf_tmpl_pg_create()\fR function returns \fINULL\fR on failure and a +pointer to an allocated and populated \fBscf_pg_tmpl_t\fR on success. The +caller is responsible for freeing the memory with \fBscf_tmpl_pg_destroy()\fR. +.sp +.LP +The \fBscf_tmpl_get_by_pg()\fR and \fBscf_tmpl_get_by_pg_name()\fR functions +return 0 on success and -1 on failure. +.sp +.LP +The \fBscf_tmpl_iter_pgs()\fR function returns 1 on successful completion. If +the iteration is complete, it returns 0. It returns -1 on error. +.SH ERRORS +.sp +.LP +The \fBscf_tmpl_get_by_pg()\fR, \fBscf_tmpl_get_by_pg_name()\fR, and +\fBscf_tmpl_iter_pgs()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) chose +for the operation denied access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The instance or its template property group has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.sp .6 +.RS 4n +The handle passed in has been destroyed. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The \fIhandle\fR argument, \fIfmri\fR argument, snapshot name, \fIpg_name\fR, +or \fIpg\fR is invalid. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.sp .6 +.RS 4n +There is not enough memory to populate the \fBscf_pg_tmpl_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have adequate resources to complete the request. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not currently bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +The object matching FMRI does not exist in the repository, or the snapshot does +not exist. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The template could not be read due to access restrictions. +.RE + +.sp +.LP +The \fBscf_tmpl_get_by_pg()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.RS 21n +.rt +The property group specified by \fIpg\fR is not set. +.RE + +.sp +.LP +The \fBscf_tmpl_pg_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The handle argument is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.RS 30n +.rt +There is no memory available. +.RE + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBsvc.configd\fR(1M), \fBscf_tmpl_pg_name\fR(3SCF), +\fBscf_tmpl_prop_create\fR(3SCF), \fBattributes\fR(5), \fBsmf_template\fR(5) diff --git a/usr/src/man/man3scf/scf_tmpl_pg_name.3scf b/usr/src/man/man3scf/scf_tmpl_pg_name.3scf new file mode 100644 index 0000000000..3ca4c79735 --- /dev/null +++ b/usr/src/man/man3scf/scf_tmpl_pg_name.3scf @@ -0,0 +1,282 @@ +'\" te +.\" Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_tmpl_pg_name 3SCF "28 Oct 2008" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_tmpl_pg_name, scf_tmpl_pg_type, scf_tmpl_pg_target, scf_tmpl_pg_required, +scf_tmpl_pg_common_name, scf_tmpl_pg_description \- retrieve the metadata about +a specific property group +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBssize_t\fR \fBscf_tmpl_pg_name\fR(\fBconst scf_pg_tmpl_t *\fR\fIpg_tmpl\fR, + \fBchar **\fR\fIout\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_tmpl_pg_type\fR(\fBconst scf_pg_tmpl_t *\fR\fIpg_tmpl\fR, + \fBchar **\fR\fIout\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_tmpl_pg_target\fR(\fBconst scf_pg_tmpl_t *\fR\fIpg_tmpl\fR, + \fBchar **\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_pg_required\fR(\fBconst scf_pg_tmpl_t *\fR\fIpg_tmpl\fR, + \fBuint8_t *\fR\fIout\fR) +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_tmpl_pg_common_name\fR(\fBconst scf_pg_tmpl_t *\fR\fIpg_tmpl\fR, + \fBchar *\fR \fIlocale\fR, \fBchar **\fR\fIout\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_tmpl_pg_description\fR(\fBconst scf_pg_tmpl_t *\fR\fIpg_tmpl\fR, + \fBchar *\fR \fIlocale\fR, \fBchar **\fR\fIout\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +These functions retrieve the metadata about a specific property group. They +require that the template for the property group has already been located by +one of the \fBscf_tmpl_pg_create\fR(3SCF) suite of functions. +.sp +.LP +The \fBscf_tmpl_pg_name()\fR function retrieves the name of the property group +template and place it in *\fIout\fR. If the property group name is implicitly +wildcarded (see \fBsmf_template\fR(5)) in the template, this function will +return a string containing \fBSCF_TMPL_WILDCARD\fR ("*") in *\fIout\fR. The +caller is responsible for freeing the *\fIout\fR buffer on success. +.sp +.LP +The \fBscf_tmpl_pg_type()\fR function will retrieve the type of the property +group template and place it in *\fIout\fR. If the property group type is +implicitly wildcarded (see \fBsmf_template\fR(5)) in the template, this +function will return a string containing \fBSCF_TMPL_WILDCARD\fR ("*") in +*\fIout\fR. The caller is responsible for freeing the *\fIout\fR buffer on +success. +.sp +.LP +The \fBscf_tmpl_pg_target()\fR function will retrieve the target of the +property group template and place it in *\fIout\fR. The caller is responsible +for freeing the *\fIout\fR buffer on success. +.sp +.LP +The \fBscf_tmpl_pg_required()\fR function will determine whether the property +group is required and place the result of that check in *\fIout\fR. If required +is unset, \fIout\fR will be the default value of 0. If the property is +explicitly set to required, \fIout\fR will be 1. +.sp +.LP +The \fBscf_tmpl_pg_common_name()\fR function will retrieve the property group's +localized common name as currently templated and place it in *\fIout\fR. A +locale (as described in \fBsetlocale\fR(3C)) may be specified, or if the +supplied locale is NULL, the current locale will be used. If a common_name in +the specified locale is not found, the function will also look for a +common_name in the C locale. Some templates will not specify the property group +common name. The caller is responsible for freeing the *\fIout\fR buffer on +success. +.sp +.LP +The \fBscf_tmpl_pg_description()\fR function will retrieve the property group's +localized description as currently templated and place it in *\fIout\fR. A +locale (as described in \fBsetlocale\fR(3C)) may be specified, or if the +supplied locale is NULL, the current locale will be used. If a description in +the specified locale is not found, the function will also look for a +description in the C locale. Some templates will not specify the property group +description. The caller is responsible for freeing the *\fIout\fR buffer on +success. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_tmpl_pg_name()\fR, +\fBscf_tmpl_pg_common_name()\fR, \fBscf_tmpl_pg_description()\fR, +\fBscf_tmpl_pg_target()\fR, and \fBscf_tmpl_pg_type()\fR return the length of +the string written, not including the terminating null byte. Otherwise, they +return -1. +.sp +.LP +Upon successful completion, \fBscf_tmpl_pg_required()\fR returns 0. Otherwise, +it returns -1. +.SH ERRORS +.sp +.LP +The \fBscf_tmpl_pg_name()\fR, \fBscf_tmpl_pg_common_name()\fR, +\fBscf_tmpl_pg_description()\fR, \fBscf_tmpl_pg_required()\fR, +\fBscf_tmpl_pg_target()\fR, and \fBscf_tmpl_pg_type()\fR functions will fail +if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) chose +for the operation denied access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The template property group has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.sp .6 +.RS 4n +The handle passed in has been destroyed. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.sp .6 +.RS 4n +There is not enough memory to populate the \fBscf_pg_tmpl_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have adequate resources to complete the request. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not currently bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The template could not be read due to access restrictions. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_TEMPLATE_INVALID\fR\fR +.ad +.sp .6 +.RS 4n +The template data is invalid. +.RE + +.sp +.LP +The \fBscf_tmpl_pg_common_name()\fR and \fBscf_tmpl_pg_description()\fR +functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.RS 30n +.rt +The property does not exist or exists and has no value. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The locale string is too long. +.RE + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBsvc.configd\fR(1M), \fBscf_tmpl_pg_create\fR(3SCF), \fBsetlocale\fR(3C), +\fBattributes\fR(5), \fBsmf_template\fR(5) diff --git a/usr/src/man/man3scf/scf_tmpl_prop_create.3scf b/usr/src/man/man3scf/scf_tmpl_prop_create.3scf new file mode 100644 index 0000000000..141d556f52 --- /dev/null +++ b/usr/src/man/man3scf/scf_tmpl_prop_create.3scf @@ -0,0 +1,282 @@ +'\" te +.\" Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_tmpl_prop_create 3SCF "28 Oct 2008" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_tmpl_prop_create, scf_tmpl_prop_reset, scf_tmpl_prop_destroy, +scf_tmpl_get_by_prop, scf_tmpl_iter_props \- template property functions +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_prop_tmpl_t *\fR\fBscf_tmpl_prop_create\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_tmpl_prop_reset\fR(\fBscf_prop_tmpl_t *\fR\fIprop_tmpl\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_tmpl_prop_destroy\fR(\fBscf_prop_tmpl_t *\fR\fIprop_tmpl\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_get_by_prop\fR(\fBscf_pg_tmpl_t *\fR\fIpg_tmpl\fR, + \fBconst char *\fR\fIprop\fR, \fBscf_prop_tmpl_t *\fR\fIprop_tmpl\fR, \fBint\fR \fIflags\fR) +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_iter_props\fR(\fBscf_pg_tmpl_t *\fR\fIpg_tmpl\fR, \fBconst char *\fR\fIfmri\fR, + \fBscf_prop_tmpl_t *\fR\fIprop_tmpl\fR, \fBint\fR \fIflags\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The template property functions locate and give access to metadata about +properties. They require that the template for the property group containing +the property has already been located by one of the +\fBscf_tmpl_pg_create\fR(3SCF) suite of functions. +.sp +.LP +Once retrieved, the \fBscf_prop_tmpl_t\fR can be explored using the +\fBscf_tmpl_prop_name\fR(3SCF) suite of functions. +.sp +.LP +Before calling \fBscf_tmpl_get_by_prop()\fR or \fBscf_tmpl_iter_props()\fR, the +\fBscf_prop_tmpl_t\fR must be allocated by \fBscf_tmpl_prop_create\fR. The +\fBscf_prop_tmpl_t\fR can be reset to contain no template information with +\fBscf_tmpl_prop_reset()\fR, so that it can be used to start an iteration from +scratch. All associated memory can be freed with \fBscf_tmpl_prop_destroy()\fR. +.sp +.LP +The \fBscf_tmpl_get_by_prop()\fR function locates template data about the +property name specified. +.sp +.LP +The \fBscf_tmpl_iter_props()\fR function iterates across all property templates +defined in the specified property group template. +.sp +.LP +The iterator state for \fBscf_tmpl_iter_props()\fR is stored on the property +template data structure. The data structure should be allocated with +\fBscf_tmpl_prop_create()\fR, and to continue the iteration the previously +returned structure should be passed in as an argument. +.SH RETURN VALUES +.sp +.LP +The \fBscf_tmpl_get_by_prop()\fR function returns -1 on failure and 0 on +success. +.sp +.LP +The \fBscf_tmpl_iter_props()\fR function returns 1 on successful completion. If +the iteration is complete, it returns 0. It returns -1 on error. +.SH ERRORS +.sp +.LP +The \fBscf_tmpl_get_by_prop()\fR and \fBscf_tmpl_iter_props()\fR functions will +fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) chose +for the operation denied access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The instance or its template property group has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.sp .6 +.RS 4n +The handle passed in has been destroyed. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +One of the arguments is invalid. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.sp .6 +.RS 4n +There is not enough memory to populate the \fBscf_prop_tmpl_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have adequate resources to complete the request. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not currently bound. +.RE + +.sp +.LP +The \fBscf_tmpl_get_by_prop()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +Template object matching property doesn't exist in the repository. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_TYPE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +Matching template object is the wrong type in the repository. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The template could not be read due to access restrictions. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_TEMPLATE_INVALID\fR\fR +.ad +.sp .6 +.RS 4n +The template data is invalid. +.RE + +.sp +.LP +The \fBscf_tmpl_prop_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The \fIhandle\fR argument is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.RS 30n +.rt +There is no memory available. +.RE + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBsvc.configd\fR(1M), \fBscf_tmpl_pg_create\fR(3SCF), +\fBscf_tmpl_prop_name\fR(3SCF), \fBattributes\fR(5), \fBsmf_template\fR(5) diff --git a/usr/src/man/man3scf/scf_tmpl_prop_name.3scf b/usr/src/man/man3scf/scf_tmpl_prop_name.3scf new file mode 100644 index 0000000000..f9011b7062 --- /dev/null +++ b/usr/src/man/man3scf/scf_tmpl_prop_name.3scf @@ -0,0 +1,662 @@ +'\" te +.\" Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_tmpl_prop_name 3SCF "28 Oct 2008" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_tmpl_prop_name, scf_tmpl_prop_type, scf_tmpl_prop_required, +scf_tmpl_prop_common_name, scf_tmpl_prop_description, scf_tmpl_prop_units, +scf_tmpl_prop_visibility, scf_tmpl_visibility_to_string, +scf_tmpl_prop_cardinality, scf_tmpl_prop_internal_seps, +scf_tmpl_value_name_constraints, scf_count_ranges_destroy, +scf_int_ranges_destroy, scf_tmpl_value_count_range_constraints, +scf_tmpl_value_int_range_constraints, scf_tmpl_value_name_choices, +scf_values_destroy, scf_tmpl_value_count_range_choices, +scf_tmpl_value_int_range_choices, scf_tmpl_value_common_name, +scf_tmpl_value_description, scf_tmpl_value_in_constraint \- retrieve the +metadata about a specific property +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBssize_t\fR \fBscf_tmpl_prop_name\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBchar **\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_prop_type\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBscf_type_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_prop_required\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBuint8_t *\fR\fIout\fR) +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_tmpl_prop_common_name\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBchar *\fR\fIlocale\fR, \fBchar **\fR\fIout\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_tmpl_prop_description\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBchar *\fR \fIlocale\fR, \fBchar **\fR\fIout\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_tmpl_prop_units\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBconst char *\fR\fIlocale\fR, \fBchar **\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_prop_visibility\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBuint8_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBconst char *\fR\fBscf_tmpl_visibility_to_string\fR(\fBuint8_t\fR \fIvisibility\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_prop_cardinality\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBuint64_t *\fR\fImin\fR, \fBuint64_t *\fR\fImax\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_prop_internal_seps\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBscf_values_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_value_name_constraints\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBscf_values_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_count_ranges_destroy\fR(\fBscf_count_ranges_t *\fR\fIranges\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_int_ranges_destroy\fR(\fBscf_int_ranges_t *\fR\fIranges\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_value_count_range_constraints\fR( + \fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, \fBscf_count_ranges_t *\fR\fIranges\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_value_int_range_constraints\fR( + \fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, \fBscf_int_ranges_t *\fR\fIranges\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_value_name_choices\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBscf_values_t *\fR\fIvals\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_values_destroy\fR(\fBscf_values_t *\fR\fIvals\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_value_count_range_choices\fR( + \fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, \fBscf_count_ranges_t *\fR\fIranges\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_value_int_range_choices\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBscf_int_ranges_t *\fR\fIranges\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_tmpl_value_common_name\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBconst char *\fR\fIlocale\fR, \fBconst char *\fR\fIvalue\fR, \fBchar **\fR\fIout\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_tmpl_value_description\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBconst char *\fR\fIlocale\fR, \fBconst char *\fR\fIvalue\fR, \fBchar **\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_value_in_constraint\fR(\fBconst scf_prop_tmpl_t *\fR\fIprop_tmpl\fR, + \fBscf_value_t *\fR\fIvalue\fR, \fBscf_tmpl_errors_t **\fR\fIerrs\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +These functions retrieve the metadata about a specific property. They require +that the template for the property has already been located by one of the +\fBscf_tmpl_prop_create\fR(3SCF) suite of functions. +.sp +.LP +The \fBscf_tmpl_prop_name()\fR function will retrieve the property's name as +currently templated and place it in *\fIout\fR. The caller is responsible for +freeing the *\fIout\fR buffer on success. +.sp +.LP +The \fBscf_tmpl_prop_type()\fR function will retrieve the type of the property +as templated and place the type in out. +.sp +.LP +The \fBscf_tmpl_prop_required()\fR function will determine whether the property +is required in this property group and place the result of that check in out. +If required is unset, out will be the default, 0. If the property is explicitly +set to required, out will be 1. +.sp +.LP +The \fBscf_tmpl_prop_common_name()\fR function will retrieve the property's +localized common name as currently templated and place it in *\fIout\fR. A +locale (as described in \fBsetlocale\fR(3C)) can be specified, or if the +supplied locale is \fINULL\fR, the current locale will be used. If a common +name in the specified locale is not found, the function will also look for a +common name in the C locale. Some templates will not specify the property +common name. The caller is responsible for freeing the *\fIout\fR buffer on +success. +.sp +.LP +The \fBscf_tmpl_prop_description()\fR function will retrieve the property's +localized description as currently templated and place it in *\fIout\fR. A +locale (as described in \fBsetlocale\fR(3C)) can be specified, or if the +supplied locale is \fINULL\fR, the current locale will be used. If a +description in the specified locale is not found, the function will also look +for a description in the C locale. Some templates will not specify the property +description. The caller is responsible for freeing the *\fIout\fR buffer on +success. +.sp +.LP +The \fBscf_tmpl_prop_visibility()\fR function will retrieve the visibility of +the property as currently templated and place it in out. A property can be +\fBSCF_TMPL_VISIBILITY_HIDDEN\fR, \fBSCF_TMPL_VISIBILITY_READONLY\fR, or +\fBSCF_TMPL_VISIBILITY_READWRITE\fR. If the visibility is unset, this function +will return the default, \fBSCF_TMPL_VISIBILITY_READWRITE\fR. +.sp +.LP +The \fBscf_tmpl_prop_cardinality()\fR function will retrieve the minimum number +of values and maximum number of values allowed for this property and place them +in \fImin\fR and \fImax\fR, respectively. If the values are unset, the defaults +of 0 for \fImin\fR and \fBUINT64_MAX\fR for \fImax\fR. +.sp +.LP +The \fBscf_values_destroy()\fR function destroys an \fBscf_values_t\fR +structure and all memory associated with it. +.sp +.LP +The \fBscf_values_t\fR structure is populated by a number of functions. Based +on the value type, it is populated with an array of the values. It is also +always populated with an array of \fIastring\fR translations of those values. +.sp +.in +2 +.nf +typedef struct scf_time { + int64_t t_seconds; + int32_t t_ns; +} scf_time_t; + +typedef struct scf_values { + scf_type_t value_type; + char *reserved; + int value_count; + const char **values_as_astring; + union { + uint64_t *v_count; + uint8_t *v_boolean; + int64_t *v_integer; + char **v_astring; + char **v_ustring; + char **v_opaque; + scf_time_t *v_time; + } sv_data; +} scf_values_t; +.fi +.in -2 + +.sp +.LP +The \fBscf_tmpl_prop_internal_seps()\fR function will retrieve the list of +internal separators as currently defined in the template. Each separator will +be a single string character in a different element of out. Some templates will +not specify any internal separators. The caller is responsible for calling +\fBscf_values_destroy()\fR on success. +.sp +.LP +The \fBscf_tmpl_value_name_constraints()\fR function will retrieve the set of +property values the property is expected to be part of. Some templates will not +specify any constraints. The caller is responsible for calling +\fBscf_values_destroy()\fR on success. +.sp +.LP +The \fBscf_tmpl_value_count_range_constraints()\fR function will retrieve the +set of defined lower and upper bounds as defined by the property template and +place them in \fIranges\fR. Some templates will not specify any range +constraints. +.sp +.LP +The \fBscf_count_ranges_t\fR structure is populated by the +\fBscf_tmpl_value_count_range_constraints()\fR and +\fBscf_tmpl_value_count_range_choices()\fR functions. +\fBscf_count_ranges_destroy()\fR destroys an \fBscf_count_ranges_t\fR and all +memory associated with it. +.sp +.in +2 +.nf +typedef struct scf_count_ranges { + int scr_num_ranges; + uint64_t *scr_min; + uint64_t *scr_max; +} scf_count_ranges_t; +.fi +.in -2 + +.sp +.LP +The \fBscf_tmpl_value_int_range_constraints()\fR function will retrieve the set +of defined lower and upper bounds as defined by the property template and place +them in \fIranges\fR. Some templates will not specify any range constraints. +.sp +.LP +The \fBscf_int_ranges_t\fR structure is populated by the +\fBscf_tmpl_value_int_range_constraints()\fR and +\fBscf_tmpl_value_int_range_choices()\fR functions. The +\fBscf_int_ranges_destroy()\fR function destroys an \fBscf_int_ranges_t\fR and +all memory associated with it. +.sp +.in +2 +.nf +typedef struct scf_int_ranges { + int scr_num_ranges; + int64_t *scr_min; + int64_t *scr_max; +} scf_int_ranges_t; +.fi +.in -2 + +.sp +.LP +The \fBscf_tmpl_value_name_choices()\fR function will retrieve the set of +property value choices that should be offered to a user. Some templates will +not specify any choices. The caller is responsible for calling +\fBscf_values_destroy()\fR on success. +.sp +.LP +The \fBscf_tmpl_value_count_range_choices()\fR function will retrieve the set +of defined lower and upper bounds as defined by the property template and place +them in ranges\fI\fR. Some templates will not specify any range choices. +.sp +.LP +The \fBscf_tmpl_value_int_range_constraints()\fR function will retrieve the set +of defined lower and upper bounds as defined by the property template and place +them in \fIranges\fR. Some templates will not specify any range constraints. +.sp +.LP +The \fBscf_tmpl_value_common_name()\fR function will retrieve the value's +common name as currently templated and place it in *\fIout\fR. A locale (as +described in \fBsetlocale\fR(3C)) can be specified, or if the supplied locale +is \fINULL\fR, the current locale will be used. If a common name in the +specified locale is not found, the function will also look for a common name in +the C locale. Some templates will not specify the value common name. The caller +is responsible for freeing the *\fIout\fR buffer on success. +.sp +.LP +The \fBscf_tmpl_value_description()\fR function will retrieve the value's +description as currently templated and place it in *\fIout\fR. A locale (as +described in \fBsetlocale\fR(3C)) can be specified, or if the supplied locale +is \fINULL\fR, the current locale will be used. If a description in the +specified locale is not found, the function will also look for a description in +the C locale. Some templates will not specify the value description. The caller +is responsible for freeing the *\fIout\fR buffer on success. +.sp +.LP +The \fBscf_tmpl_value_in_constraint()\fR function will check that the value +provided matches the constraints as defined in the property template provided. +This currently means it will determine if the value provided: +.RS +4 +.TP +.ie t \(bu +.el o +is of the proper type for the property template defined, +.RE +.RS +4 +.TP +.ie t \(bu +.el o +is within a range defined, if it is a numeric type, and +.RE +.RS +4 +.TP +.ie t \(bu +.el o +is within the name constraints, if name constraints are defined. +.RE +.sp +.LP +If the template property does not define a type, ranges will be considered of +the same type as the numeric values being checked. Some ranges might consider +the value out of constraint when tested as one numeric type but within +constraint if tested as other numeric type. Refer to \fBstrtoull\fR(3C) and +\fBstrtoll\fR(3C) to see the implications when retrieving numeric values from +the repository or converting strings to numeric values in \fBlibscf\fR(3LIB). +.sp +.LP +If \fIerrs\fR is not \fINULL\fR, an \fBscf_tmpl_error_t\fR will be created, +populated and added to \fIerrs\fR in case of a constraint violation. The caller +is responsible for calling \fBscf_tmpl_errors_destroy()\fR to free memory +allocated for all \fBscf_tmpl_error_t\fR associated to \fIerrs\fR. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_tmpl_prop_name()\fR, +\fBscf_tmpl_prop_common_name()\fR, \fBscf_tmpl_prop_description()\fR, +\fBscf_tmpl_prop_units()\fR, \fBscf_tmpl_value_common_name()\fR, and +\fBscf_tmpl_value_description()\fR return the length of the string written, not +including the terminating null byte. Otherwise, they return -1. +.sp +.LP +Upon successful completion, \fBscf_tmpl_prop_type()\fR, +\fBscf_tmpl_prop_required()\fR, \fBscf_tmpl_prop_visibility()\fR, +\fBscf_tmpl_prop_cardinality()\fR, \fBscf_tmpl_prop_internal_seps()\fR, +\fBscf_tmpl_value_name_constraints()\fR, +\fBscf_tmpl_value_count_range_constraints()\fR, +\fBscf_tmpl_value_int_range_constraints()\fR, +\fBscf_tmpl_value_name_choices()\fR, +\fBscf_tmpl_value_count_range_choices()\fR, +\fBscf_tmpl_value_int_range_choices()\fR return 0. Otherwise, they return -1. +.sp +.LP +The \fBscf_tmpl_value_in_constraint()\fR functions returns 0 on success, 1 if +the value is not in the constraint, and -1 on failure. +.sp +.LP +Upon successful completion, \fBscf_tmpl_visibility_to_string()\fR returns a +string of the visibility supplied. +.SH ERRORS +.sp +.LP +The \fBscf_tmpl_prop_name()\fR, \fBscf_tmpl_prop_type()\fR, +\fBscf_tmpl_prop_required()\fR, \fBscf_tmpl_prop_common_name()\fR, +\fBscf_tmpl_prop_description()\fR, \fBscf_tmpl_prop_units()\fR, +\fBscf_tmpl_prop_visibility()\fR, \fBscf_tmpl_prop_cardinality()\fR, +\fBscf_tmpl_prop_internal_seps()\fR, \fBscf_tmpl_value_name_constraints()\fR, +\fBscf_tmpl_value_count_range_constraints()\fR, +\fBscf_tmpl_value_int_range_constraints()\fR, +\fBscf_tmpl_value_name_choices()\fR, +\fBscf_tmpl_value_count_range_choices()\fR, +\fBscf_tmpl_value_int_range_choices()\fR, \fBscf_tmpl_value_common_name()\fR, +\fBscf_tmpl_value_description()\fR, and \fBscf_tmpl_value_in_constraint()\fR +functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) chose +for the operation denied access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The template property group has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.sp .6 +.RS 4n +The handle passed in has been destroyed. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.sp .6 +.RS 4n +There is not enough memory to populate the \fBscf_pg_tmpl_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have adequate resources to complete the request. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not currently bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The template could not be read due to access restrictions. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_TEMPLATE_INVALID\fR\fR +.ad +.sp .6 +.RS 4n +The template data is invalid. +.RE + +.sp +.LP +The \fBscf_tmpl_prop_type()\fR, \fBscf_tmpl_prop_common_name()\fR, +\fBscf_tmpl_prop_description()\fR, \fBscf_tmpl_prop_units()\fR, +\fBscf_tmpl_prop_cardinality()\fR, \fBscf_tmpl_prop_internal_seps()\fR, +\fBscf_tmpl_value_name_constraints()\fR, +\fBscf_tmpl_value_count_range_constraints()\fR, +\fBscf_tmpl_value_int_range_constraints()\fR, +\fBscf_tmpl_value_name_choices()\fR, +\fBscf_tmpl_value_count_range_choices()\fR, +\fBscf_tmpl_value_int_range_choices()\fR, \fBscf_tmpl_value_common_name()\fR, +and \fBscf_tmpl_value_description()\fR, functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.RS 23n +.rt +The property does not exist or exists and has no value. +.RE + +.sp +.LP +The \fBscf_tmpl_value_in_constraint()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +Value is not a valid \fBscf_value_t\fR. +.RE + +.sp +.LP +The \fBscf_tmpl_prop_common_name()\fR, \fBscf_tmpl_prop_description()\fR and +\fBscf_tmpl_prop_units()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The locale string is too long to make a property name. +.RE + +.sp +.LP +The \fBscf_tmpl_value_common_name()\fR and \fBscf_tmpl_value_description()\fR +functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The value and locale strings are too long to make a property name. +.RE + +.sp +.LP +The \fBscf_tmpl_value_count_range_constraints()\fR and +\fBscf_tmpl_value_count_range_choices()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONSTRAINT_VIOLATED\fR\fR +.ad +.sp .6 +.RS 4n +The range has negative values. +.RE + +.sp +.LP +The \fBscf_tmpl_value_int_range_constraints()\fR and +\fBscf_tmpl_value_int_range_choices()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONSTRAINT_VIOLATED\fR\fR +.ad +.sp .6 +.RS 4n +The range values don't fit in a \fBint64_t\fR. +.RE + +.sp +.LP +The \fBscf_tmpl_value_count_range_constraints()\fR, +\fBscf_tmpl_value_int_range_constraints()\fR, +\fBscf_tmpl_value_count_range_choices()\fR and +\fBscf_tmpl_value_int_range_choices()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONSTRAINT_VIOLATED\fR\fR +.ad +.sp .6 +.RS 4n +A range with \fImin\fR value > \fImax\fR value is found. +.RE + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBsvc.configd\fR(1M), \fBscf_tmpl_prop_create\fR(3SCF), \fBsetlocale\fR(3C), +\fBstrtoll\fR(3C), \fBstrtoull\fR(3C), \fBattributes\fR(5), +\fBsmf_template\fR(5) diff --git a/usr/src/man/man3scf/scf_tmpl_validate_fmri.3scf b/usr/src/man/man3scf/scf_tmpl_validate_fmri.3scf new file mode 100644 index 0000000000..c4e8be7e2e --- /dev/null +++ b/usr/src/man/man3scf/scf_tmpl_validate_fmri.3scf @@ -0,0 +1,689 @@ +'\" te +.\" Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_tmpl_validate_fmri 3SCF "28 Oct 2008" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_tmpl_validate_fmri, scf_tmpl_errors_destroy, scf_tmpl_next_error, +scf_tmpl_reset_errors, scf_tmpl_strerror, scf_tmpl_error_type, +scf_tmpl_error_source_fmri, scf_tmpl_error_pg_tmpl, scf_tmpl_error_pg, +scf_tmpl_error_prop_tmpl, scf_tmpl_error_prop, scf_tmpl_error_value \- template +validation functions +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBint\fR \fBscf_tmpl_validate_fmri\fR(\fBscf_handle_t *\fR\fIh\fR, \fBconst char *\fR\fIfmri\fR, + \fBconst char *\fR\fIsnapshot\fR, \fBscf_tmpl_errors_t **\fR\fIerrs\fR, \fBint\fR \fIflags\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_tmpl_errors_destroy\fR(\fBscf_tmpl_errors_t *\fR\fIerrs\fR); +.fi + +.LP +.nf +\fBscf_tmpl_error_t *\fR\fBscf_tmpl_next_error\fR(\fBscf_tmpl_errors_t *\fR\fIerrs\fR, + \fBscf_tmpl_errors_t *\fR\fIerr\fR) +.fi + +.LP +.nf +\fBvoid\fR \fBscf_tmpl_reset_errors\fR(\fBscf_tmpl_errors_t *\fR\fIerrs\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_strerror\fR(\fBscf_tmpl_error_t *\fR\fIerr\fR, \fBchar *\fR\fIs\fR, + \fBsize_t\fR \fIn\fR, \fBint\fR \fIflags\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_error_type\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR, + \fBscf_tmpl_error_type_t *\fR\fItype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_error_source_fmri\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR, + \fBchar *\fR\fIfmri\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_error_pg_tmpl\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR, \fBchar *\fR\fIname\fR, + \fBchar *\fR\fItype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_error_pg\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR, + \fBchar **\fR\fIname\fR, \fBchar **\fR\fItype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_error_prop_tmpl\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR, \fBchar **\fR\fIname\fR, + \fBchar **\fR\fItype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_error_prop\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR, \fBchar **\fR\fIname\fR, + \fBchar **\fR\fItype\fR,); +.fi + +.LP +.nf +\fBint\fR \fBscf_tmpl_error_value\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR, \fBchar**\fR\fIval\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The template validation functions offer a way to validate the configuration +data of an service instance against the appropriate template data. The +\fBscf_tmpl_validate_fmri()\fR function returns the full set of errors for the +specified instance, and those errors can be printed or explored directly. +.sp +.LP +By default, the validation is performed on the composed data from the running +snapshot of an instance. A different snapshot can be explicitly selected by +specifying a valid snapshot name rather than \fINULL\fR for the \fIsnapshot\fR +argument. If \fIflags\fR includes \fBSCF_TMPL_VALIDATE_FLAG_CURRENT\fR, the +\fIsnapshot\fR argument is ignored and the current configuration is used. +.sp +.LP +By default, these functions also explore template data defined by the service +or instance itself, the service's restarter, and global template data. See +\fBsmf_template\fR(5) for more information about this composition. +.sp +.LP +An instance FMRI is required, and FMRIs that specify other entities (for +example, services) are explicitly rejected. +.sp +.LP +The \fBscf_tmpl_validate_fmri()\fR function validates an instance FMRI against +the template data in the repository. As described above, when the +\fIsnapshot\fR argument is \fINULL\fR, the default running snapshot is used. If +\fBscf_tmpl_errors_t **\fR is non-null, the structure is allocated and returned +to the caller for further perusal or printing of the errors. +.sp +.LP +The \fBscf_tmpl_errors_destroy()\fR function destroys and frees the +\fBscf_tmpl_errors_t\fR and all of the \fBscf_tmpl_error_t\fR structures to +which it refers. +.sp +.LP +The \fBscf_tmpl_next_error()\fR function takes a pointer to a +\fBscf_tmpl_errors_t\fR structure previously returned by +\fBscf_tmpl_validate_fmri()\fR. On the first call, it returns a pointer to the +first \fBscf_tmpl_error_t\fR found during validation. On subsequent calls, the +next error is returned. To resume processing from the first error, the caller +can use \fBscf_tmpl_reset_errors()\fR. +.sp +.LP +The contents of an \fBscf_tmpl_error_t\fR are determined by its type. Types +added as additional validation checks are introduced. Based on the error type, +a set of fields can be retrieved from the error. +.sp +.ne 2 +.mk +.na +\fB\fBSCF_TERR_TYPE_INVALID\fR\fR +.ad +.sp .6 +.RS 4n +reserved invalid type +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_TERR_MISSING_PG\fR\fR +.ad +.sp .6 +.RS 4n +required property group is missing +.br +.in +2 +template source FMRI +.in -2 +.br +.in +2 +property group template name and type +.in -2 +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_TERR_WRONG_PG_TYPE\fR\fR +.ad +.sp .6 +.RS 4n +property group type is incorrect +.br +.in +2 +template source FMRI +.in -2 +.br +.in +2 +property group template name and type +.in -2 +.br +.in +2 +property group name and type +.in -2 +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_TERR_MISSING_PROP\fR\fR +.ad +.sp .6 +.RS 4n +required property is missing +.br +.in +2 +template source FMRI +.in -2 +.br +.in +2 +property group template name and type +.in -2 +.br +.in +2 +property template name and type +.in -2 +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_TERR_WRONG_PROP_TYPE\fR\fR +.ad +.sp .6 +.RS 4n +property type is incorrect +.br +.in +2 +template source FMRI +.in -2 +.br +.in +2 +property group template name and type +.in -2 +.br +.in +2 +property template name and type +.in -2 +.br +.in +2 +property group name and type +.in -2 +.br +.in +2 +property name and type +.in -2 +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_TERR_CARDINALITY_VIOLATION\fR\fR +.ad +.sp .6 +.RS 4n +number of values violates cardinality +.br +.in +2 +template source FMRI +.in -2 +.br +.in +2 +property group template name and type +.in -2 +.br +.in +2 +property template name and type +.in -2 +.br +.in +2 +property group name and type +.in -2 +.br +.in +2 +property name and type +.in -2 +.br +.in +2 +cardinality and cardinality limits +.in -2 +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_TERR_VALUE_CONSTRAINT_VIOLATED\fR\fR +.ad +.sp .6 +.RS 4n +constraint violated for value +.br +.in +2 +template source FMRI +.in -2 +.br +.in +2 +property group template name and type +.in -2 +.br +.in +2 +property template name and type +.in -2 +.br +.in +2 +property group name and type +.in -2 +.br +.in +2 +property name and type +.in -2 +.br +.in +2 +value +.in -2 +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_TERR_RANGE_VIOLATION\fR\fR +.ad +.sp .6 +.RS 4n +value violated specified range +.br +.in +2 +template source FMRI +.in -2 +.br +.in +2 +property group template name and type +.in -2 +.br +.in +2 +property template name and type +.in -2 +.br +.in +2 +property group name and type +.in -2 +.br +.in +2 +property name and type +.in -2 +.br +.in +2 +value +.in -2 +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_TERR_PROP_TYPE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +value type is different from property type +.br +.in +2 +template source FMRI +.in -2 +.br +.in +2 +property group template name and type +.in -2 +.br +.in +2 +property template name and type +.in -2 +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_TERR_VALUE_OUT_OF_RANGE\fR\fR +.ad +.sp .6 +.RS 4n +value is out of template defined range +.br +.in +2 +template source FMRI +.in -2 +.br +.in +2 +property group template name and type +.in -2 +.br +.in +2 +property template name and type +.in -2 +.br +.in +2 +value +.in -2 +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_TERR_INVALID_VALUE\fR\fR +.ad +.sp .6 +.RS 4n +value violates template defined constraints +.br +.in +2 +template source FMRI +.in -2 +.br +.in +2 +property group template name and type +.in -2 +.br +.in +2 +property template name and type +.in -2 +.br +.in +2 +value +.in -2 +.RE + +.sp +.LP +The \fBSCF_TERR_PROP_TYPE_MISMATCH\fR, \fBSCF_TERR_VALUE_OUT_OF_RANGE\fR and +\fBSCF_TERR_INVALID_VALUE\fR types are only set from calls to +\fBscf_tmpl_value_in_constraint\fR(3SCF). +.sp +.LP +The \fBscf_tmpl_error_type()\fR function retrieves the error type. +.sp +.LP +The \fBscf_tmpl_error_source_fmri()\fR function retrieves a string with the +FMRI of the source of the template that was violated. This string is freed by +\fBscf_tmpl_errors_destroy()\fR. +.sp +.LP +The \fBscf_tmpl_error_pg_tmpl()\fR function retrieves strings with the name and +type of the property group template that was violated. If the property group +name or type was implicitly wildcarded (see \fBsmf_template\fR(5)) in the +template, this function returns a string containing \fBSCF_TMPL_WILDCARD\fR +("*"). These strings are freed by \fBscf_tmpl_errors_destroy()\fR. +.sp +.LP +The \fBscf_tmpl_error_pg()\fR function retrieves strings with the name and type +of the property group that was violated. These strings are freed by +\fBscf_tmpl_errors_destroy()\fR. +.sp +.LP +The \fBscf_tmpl_error_prop_tmpl()\fR function retrieves strings with the name +and type of the property template that was violated. If the property type was +implicitly wildcarded (see \fBsmf_template\fR(5)) in the template, this +function returns a string containing \fBSCF_TMPL_WILDCARD\fR ("*"). These +strings are freed by \fBscf_tmpl_errors_destroy()\fR. +.sp +.LP +The \fBscf_tmpl_error_prop()\fR function retrieves strings with the name and +type of the property that was violated. These strings are freed by +\fBscf_tmpl_errors_destroy()\fR. +.sp +.LP +The \fBscf_tmpl_error_value()\fR function retrieves a string with the value +containing the error in \fIval\fR. This string are freed by +\fBscf_tmpl_errors_destroy()\fR. +.sp +.LP +The \fBscf_tmpl_strerror()\fR function takes an \fBscf_tmpl_error_t\fR +previously returned by \fBscf_tmpl_next_error()\fR and returns in \fIs\fR. If +flags includes \fBSCF_TMPL_STRERROR_HUMAN\fR, \fIs\fR is a human-readable, +localized description of the error. Otherwise, \fIs\fR is a one-line string +suitable for logfile output. +.SH RETURN VALUES +.sp +.LP +The \fBscf_tmpl_validate_fmri()\fR function returns 0 on successful completion +with no validation failures. It returns 1 if there are validation failures. It +returns -1 if there is an error validating the instance. +.sp +.LP +The \fBscf_tmpl_next_error()\fR function returns a pointer to the next +\fBscf_tmpl_error_t\fR. When none remain, it returns \fINULL\fR. +.sp +.LP +The \fBscf_tmpl_error_type()\fR, \fBscf_tmpl_error_source_fmri()\fR, +\fBscf_tmpl_error_pg_tmpl()\fR, \fBscf_tmpl_error_pg()\fR, +\fBscf_tmpl_error_prop_tmpl()\fR, \fBscf_tmpl_error_prop()\fR, and +\fBscf_tmpl_error_value()\fR functions return 0 on success and -1 on failure. +.sp +.LP +The \fBscf_tmpl_strerror()\fR function returns the number of bytes that would +have been written to s if n had been sufficiently large. +.SH ERRORS +.sp +.LP +The \fBscf_tmpl_validate_fmri()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) chose +for the operation denied access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The instance or one of its template property group have been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.sp .6 +.RS 4n +The handle passed in has been destroyed. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The handle argument, FMRI argument, or snapshot name is invalid +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.sp .6 +.RS 4n +There is not enough memory to validate the instance. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have adequate resources to complete the request. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not currently bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +An object matching FMRI does not exist in the repository, or the snapshot does +not exist. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The instance or template could not be read due to access restrictions. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_TEMPLATE_INVALID\fR\fR +.ad +.sp .6 +.RS 4n +The template data is invalid. +.RE + +.sp +.LP +The \fBscf_tmpl_strerror()\fR, \fBscf_tmpl_error_type()\fR, +\fBscf_tmpl_error_source_fmri()\fR, \fBscf_tmpl_error_pg_tmpl()\fR, +\fBscf_tmpl_error_pg()\fR, \fBscf_tmpl_error_prop_tmpl()\fR, +\fBscf_tmpl_error_prop()\fR, and \fBscf_tmpl_error_value()\fR functions will +fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The \fBscf_tmpl_errors_t\fR argument is invalid. +.RE + +.sp +.LP +The \fBscf_tmpl_error_type()\fR, \fBscf_tmpl_error_source_fmri()\fR, +\fBscf_tmpl_error_pg_tmpl()\fR, \fBscf_tmpl_error_pg()\fR, +\fBscf_tmpl_error_prop_tmpl()\fR, \fBscf_tmpl_error_prop()\fR, and +\fBscf_tmpl_error_value()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.RS 23n +.rt +The data requested is not available for the \fBscf_tmpl_error_t\fR argument +supplied. +.RE + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBsvc.configd\fR(1M), \fBscf_tmpl_value_in_constraint\fR(3SCF), +\fBattributes\fR(5), \fBsmf_template\fR(5) diff --git a/usr/src/man/man3scf/scf_transaction_create.3scf b/usr/src/man/man3scf/scf_transaction_create.3scf new file mode 100644 index 0000000000..6afe4bd576 --- /dev/null +++ b/usr/src/man/man3scf/scf_transaction_create.3scf @@ -0,0 +1,821 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_transaction_create 3SCF "28 Aug 2007" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_transaction_create, scf_transaction_handle, scf_transaction_reset, +scf_transaction_reset_all, scf_transaction_destroy, +scf_transaction_destroy_children, scf_transaction_start, +scf_transaction_property_delete, scf_transaction_property_new, +scf_transaction_property_change, scf_transaction_property_change_type, +scf_transaction_commit \- create and manipulate transaction in the Service +Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_transaction_t *\fR\fBscf_transaction_create\fR(\fBscf_handle_t *\fR\fIhandle\fR); +.fi + +.LP +.nf +\fBscf_handle_t *\fR\fBscf_transaction_handle\fR(\fBscf_transaction_t *\fR\fItran\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_transaction_reset\fR(\fBscf_transaction_t *\fR\fItran\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_transaction_reset_all\fR(\fBscf_transaction_t *\fR\fItran\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_transaction_destroy\fR(\fBscf_transaction_t *\fR\fItran\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_transaction_destroy_children\fR(\fBscf_transaction_t *\fR\fItran\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_transaction_start\fR(\fBscf_transaction_t *\fR\fItran\fR, + \fBscf_propertygroup_t *\fR\fIpg\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_transaction_property_delete\fR(\fBscf_transaction_t *\fR\fItran\fR, + \fBscf_transaction_entry_t *\fR\fIentry\fR, \fBconst char *\fR\fIprop_name\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_transaction_property_new\fR(\fBscf_transaction_t *\fR\fItran\fR, + \fBscf_transaction_entry_t *\fR\fIentry\fR, \fBconst char *\fR\fIprop_name\fR, + \fBscf_type_t\fR \fItype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_transaction_property_change\fR(\fBscf_transaction_t *\fR\fItran\fR, + \fBscf_transaction_entry_t *\fR\fIentry\fR, \fBconst char *\fR\fIprop_name\fR, + \fBscf_type_t\fR \fItype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_transaction_property_change_type\fR( + \fBscf_transaction_t *\fR\fItran\fR, \fBscf_transaction_entry_t *\fR\fIentry\fR, + \fBconst char *\fR\fIprop_name\fR, \fBscf_type_t\fR \fItype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_transaction_commit\fR(\fBscf_transaction_t *\fR\fItran\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +Transactions are the mechanism for changing property groups. They act +atomically, whereby either all of the updates occur or none of them do. An +\fBscf_transaction_t\fR is always in one of the following states: +.sp +.ne 2 +.mk +.na +\fBreset\fR +.ad +.RS 13n +.rt +The initial state. A successful return of \fBscf_transaction_start()\fR moves +the transaction to the started state. +.RE + +.sp +.ne 2 +.mk +.na +\fBstarted\fR +.ad +.RS 13n +.rt +The transaction has started. The \fBscf_transaction_property_delete()\fR, +\fBscf_transaction_property_new()\fR, \fBscf_transaction_property_change()\fR, +and \fBscf_transaction_property_change_type()\fR functions can be used to set +up changes to properties. The \fBscf_transaction_reset()\fR and +\fBscf_transaction_reset_all()\fR functions return the transaction to the reset +state. +.RE + +.sp +.ne 2 +.mk +.na +\fBcommitted\fR +.ad +.RS 13n +.rt +A call to \fBscf_transaction_commit()\fR (whether or not it is successful) +moves the transaction to the committed state. Modifying, resetting, or +destroying the entries and values associated with a transaction will move it to +the invalid state. +.RE + +.sp +.ne 2 +.mk +.na +\fBinvalid\fR +.ad +.RS 13n +.rt +The \fBscf_transaction_reset()\fR and \fBscf_transaction_reset_all()\fR +functions return the transaction to the reset state. +.RE + +.sp +.LP +The \fBscf_transaction_create()\fR function allocates and initializes an +\fBscf_transaction_t\fR bound to \fIhandle\fR. The +\fBscf_transaction_destroy()\fR function resets, destroys, and frees +\fItran\fR. If there are any entries associated with the transaction, +\fBscf_transaction_destroy()\fR also effects a call to +\fBscf_transaction_reset()\fR. The \fBscf_transaction_destroy_children()\fR +function resets, destroys, and frees all entries and values associated the +transaction. +.sp +.LP +The \fBscf_transaction_handle()\fR function gets the handle to which \fItran\fR +is bound. +.sp +.LP +The \fBscf_transaction_start()\fR function sets up the transaction to modify +the property group to which \fIpg\fR is set. The time reference used by +\fIpg\fR becomes the basis of the transaction. The transaction fails if the +property group has been modified since the last update of \fIpg\fR at the time +when \fBscf_transaction_commit()\fR is called. +.sp +.LP +The \fBscf_transaction_property_delete()\fR, +\fBscf_transaction_property_new()\fR, \fBscf_transaction_property_change()\fR, +and \fBscf_transaction_property_change_type()\fR functions add a new +transaction entry to the transaction. Each property the transaction affects +must have a unique \fBscf_transaction_entry_t\fR. Each +\fBscf_transaction_entry_t\fR can be associated with only a single transaction +at a time. These functions all fail if the transaction is not in the started +state, \fIprop_name\fR is not a valid property name, or \fIentry\fR is already +associated with a transaction. These functions affect commit and failure as +follows: +.sp +.ne 2 +.mk +.na +\fB\fBscf_transaction_property_delete()\fR\fR +.ad +.sp .6 +.RS 4n +This function deletes the property \fIprop_name\fR in the property group. It +fails if \fIprop_name\fR does not name a property in the property group. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBscf_transaction_property_new()\fR\fR +.ad +.sp .6 +.RS 4n +This function adds a new property prop_name\fI\fR to the property group with a +value list of type \fItype\fR. It fails if \fIprop_name\fR names an existing +property in the property group. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBscf_transaction_property_change()\fR\fR +.ad +.sp .6 +.RS 4n +This function changes the value list for an existing property \fIprop_name\fR +in the property group. It fails if \fIprop_name\fR does not name an existing +property in the property group or names an existing property with a different +type. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBscf_transaction_property_change_type()\fR\fR +.ad +.sp .6 +.RS 4n +This function changes the value list and type for an existing property +\fIprop_name\fR in the property group. It fails if \fIprop_name\fR does not +name an existing property in the property group. +.RE + +.sp +.LP +If the function call is successful, \fIentry\fR remains active in the +transaction until \fBscf_transaction_destroy()\fR, +\fBscf_transaction_reset()\fR, or \fBscf_transaction_reset_all()\fR is called. +The \fBscf_entry_add_value\fR(3SCF) manual page provides information for +setting up the value list for entries that are not associated with +\fBscf_transaction_property_delete()\fR. Resetting or destroying an entry or +value active in a transaction will move it into the invalid state. +.sp +.LP +The \fBscf_transaction_commit()\fR function attempts to commit \fItran\fR. +.sp +.LP +The \fBscf_transaction_reset()\fR function returns the transaction to the reset +state and releases all of the transaction entries that were added. +.sp +.LP +The \fBscf_transaction_reset_all()\fR function returns the transaction to the +reset state, releases all of the transaction entries, and calls +\fBscf_value_reset\fR(3SCF) on all values associated with the entries. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_transaction_create()\fR returns a new +\fBscf_transaction_t\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_transaction_handle()\fR returns the handle +associated with the transaction. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_transaction_start()\fR, +\fBscf_transaction_property_delete()\fR, \fBscf_transaction_property_new()\fR, +\fBscf_transaction_property_change()\fR, and +\fBscf_transaction_property_change_type()\fR return 0. Otherwise, they return +\(mi1. +.sp +.LP +The \fBscf_transaction_commit()\fR function returns 1 upon successful commit, 0 +if the property group set in \fBscf_transaction_start()\fR is not the most +recent, and -1 on failure. +.SH ERRORS +.sp +.LP +The \fBscf_transaction_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The value of the \fIhandle\fR argument is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.RS 30n +.rt +There is not enough memory to allocate an \fBscf_transaction_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.RS 30n +.rt +The server does not have adequate resources for a new transaction handle. +.RE + +.sp +.LP +The \fBscf_transaction_handle()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.RS 30n +.rt +The handle associated with \fItran\fR has been destroyed. +.RE + +.sp +.LP +The \fBscf_transaction_start()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The repository backend refused the modification. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_READONLY\fR\fR +.ad +.sp .6 +.RS 4n +The repository backend refused modification because it is read-only. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The property group has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The transaction and property group are not derived from the same handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_IN_USE\fR\fR +.ad +.sp .6 +.RS 4n +The transaction is not in the \fBreset\fR state. The +\fBscf_transaction_reset()\fR and \fBscf_transaction_reset_all()\fR functions +can be used to return the transaction to the \fBreset\fR state. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have the resources to complete the request. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle was never bound or has been unbound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The property group specified by \fIpg\fR is not set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The user does not have sufficient privileges to modify the property group. +.RE + +.sp +.LP +The \fBscf_transaction_property_delete()\fR, +\fBscf_transaction_property_new()\fR, \fBscf_transaction_property_change()\fR, +and \fBscf_transaction_property_change_type()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) +chose for the operation denied access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The property group the transaction is changing has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The transaction and entry are not derived from the same handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_IN_USE\fR\fR +.ad +.sp .6 +.RS 4n +The property already has an entry in the transaction. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INTERNAL\fR\fR +.ad +.sp .6 +.RS 4n +An internal error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The \fIprop_name\fR argument is not a valid property name. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have the resources to complete the request. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The transaction has not been started. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_TYPE_MISMATCH\fR\fR +.ad +.sp .6 +.RS 4n +The \fItran\fR argument is not of a type compatible with \fItype\fR. +.RE + +.sp +.LP +The \fBscf_transaction_property_delete()\fR, +\fBscf_transaction_property_change()\fR, and +\fBscf_transaction_property_change_type()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_EXISTS\fR\fR +.ad +.RS 23n +.rt +The object already exists. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.RS 23n +.rt +The property group does not contain a property named \fIprop_name\fR. +.RE + +.sp +.LP +The \fBscf_transaction_property_new()\fR , +\fBscf_transaction_property_change()\fR, and +\fBscf_transaction_property_change_type()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The \fIprop_name\fR argument is not not a valid property name, or the +\fItype\fR argument is an invalid type. +.RE + +.sp +.LP +The \fBscf_transaction_property_new()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_EXISTS\fR\fR +.ad +.RS 23n +.rt +The property group already contains a property named \fIprop_name\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.RS 23n +.rt +Nothing of that name was found. +.RE + +.sp +.LP +The \fBscf_transaction_property_change()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_TYPE_MISMATCH\fR\fR +.ad +.RS 27n +.rt +The property \fIprop_name\fR is not of type \fItype\fR. +.RE + +.sp +.LP +The \fBscf_transaction_commit()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_READONLY\fR\fR +.ad +.sp .6 +.RS 4n +The repository backend is read-only. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The repository backend refused the modification. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_BOUND\fR\fR +.ad +.sp .6 +.RS 4n +The handle is not bound. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to the repository was lost. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The transaction is in an invalid state. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_DELETED\fR\fR +.ad +.sp .6 +.RS 4n +The property group the transaction is acting on has been deleted. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.sp .6 +.RS 4n +The transaction has not been started. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +The user does not have sufficient privileges to modify the property group. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server does not have sufficient resources to commit the transaction. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH EXAMPLES +.LP +\fBExample 1 \fRSet an existing boolean value to true. +.sp +.in +2 +.nf +tx = scf_transaction_create(handle); +e1 = scf_entry_create(handle); +v1 = scf_value_create(handle); + +do { + if (scf_pg_update(pg) == -1) + goto fail; + if (scf_transaction_start(tx, pg) == -1) + goto fail; + + /* set up transaction entries */ + if (scf_transaction_property_change(tx, e1, "property", + SCF_TYPE_BOOLEAN) == -1) { + scf_transaction_reset(tx); + goto fail; + } + scf_value_set_boolean(v1, 1); + scf_entry_add_value(e1, v1); + + + result = scf_transaction_commit(tx); + + scf_transaction_reset(tx); +} while (result == 0); + +if (result < 0) + goto fail; + +/* success */ + + cleanup: +scf_transaction_destroy(tx); +scf_entry_destroy(e1); +scf_value_destroy(v1); +.fi +.in -2 + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_value_reset\fR(3SCF), \fBscf_error\fR(3SCF), +\fBscf_pg_create\fR(3SCF), \fBattributes\fR(5) diff --git a/usr/src/man/man3scf/scf_value_create.3scf b/usr/src/man/man3scf/scf_value_create.3scf new file mode 100644 index 0000000000..a340c3ae88 --- /dev/null +++ b/usr/src/man/man3scf/scf_value_create.3scf @@ -0,0 +1,442 @@ +'\" te +.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with +.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH scf_value_create 3SCF "28 May 2009" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +scf_value_create, scf_value_handle, scf_value_reset, scf_value_destroy, +scf_value_type, scf_value_base_type, scf_value_is_type, scf_type_base_type, +scf_value_get_boolean, scf_value_get_count, scf_value_get_integer, +scf_value_get_time, scf_value_get_astring, scf_value_get_ustring, +scf_value_get_opaque, scf_value_get_as_string, scf_value_get_as_string_typed, +scf_value_set_boolean, scf_value_set_count, scf_value_set_integer, +scf_value_set_time, scf_value_set_from_string, scf_value_set_astring, +scf_value_set_ustring, scf_value_set_opaque \- manipulate values in the Service +Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBscf_value_t *\fR\fBscf_value_create\fR(\fBscf_handle_t *\fR\fIh\fR); +.fi + +.LP +.nf +\fBscf_handle_t *\fR\fBscf_value_handle\fR(\fBscf_value_t *\fR\fIv\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_value_reset\fR(\fBscf_value_t *\fR\fIv\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_value_destroy\fR(\fBscf_value_t *\fR\fIv\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_value_type\fR(\fBscf_value_t *\fR\fIv\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_value_base_type\fR(\fBscf_value_t *\fR\fIv\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_value_is_type\fR(\fBscf_value_t *\fR\fIv\fR, \fBscf_type_t\fR \fItype\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_type_base_type\fR(\fBscf_type_t\fR \fItype\fR, \fBscf_type_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_value_get_boolean\fR(\fBscf_value_t *\fR\fIv\fR, \fBuint8_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_value_get_count\fR(\fBscf_value_t *\fR\fIv\fR, \fBuint64_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_value_get_integer\fR(\fBscf_value_t *\fR\fIv\fR, \fBint64_t *\fR\fIout\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_value_get_time\fR(\fBscf_value_t *\fR\fIv\fR, \fBint64_t *\fR\fIseconds\fR, + \fBint32_t *\fR\fIns\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_value_get_astring\fR(\fBscf_value_t *\fR\fIv\fR, \fBchar *\fR\fIbuf\fR, + \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_value_get_ustring\fR(\fBscf_value_t *\fR\fIv\fR, \fBchar *\fR\fIbuf\fR, + \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_value_get_opaque\fR(\fBscf_value_t *\fR\fIv\fR, \fBchar *\fR\fIout\fR, + \fBsize_t\fR \fIlen\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_value_get_as_string\fR(\fBscf_value_t *\fR\fIv\fR, \fBchar *\fR\fIbuf\fR, + \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBssize_t\fR \fBscf_value_get_as_string_typed\fR(\fBscf_value_t *\fR\fIv\fR, + \fBscf_type_t\fR \fItype\fR, \fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIsize\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_value_set_boolean\fR(\fBscf_value_t *\fR\fIv\fR, \fBuint8_t\fR \fIin\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_value_set_count\fR(\fBscf_value_t *\fR\fIv\fR, \fBuint64_t\fR \fIin\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBscf_value_set_integer\fR(\fBscf_value_t *\fR\fIv\fR, \fBint64_t\fR \fIin\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_value_set_time\fR(\fBscf_value_t *\fR\fIv\fR, \fBint64_t\fR \fIseconds\fR, + \fBint32_t\fR \fIns\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_value_set_from_string\fR(\fBscf_value_t *\fR\fIv\fR, \fBscf_type_t\fR \fItype\fR, + \fBchar *\fR\fIin\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_value_set_astring\fR(\fBscf_value_t *\fR\fIv\fR, \fBconst char *\fR\fIin\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_value_set_ustring\fR(\fBscf_value_t *\fR\fIv\fR, \fBconst char *\fR\fIin\fR); +.fi + +.LP +.nf +\fBint\fR \fBscf_value_set_opaque\fR(\fBscf_value_t *\fR\fIv\fR, \fBvoid *\fR\fIin\fR, \fBsize_t\fR \fIsz\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBscf_value_create()\fR function creates a new, reset \fBscf_value_t\fR +that holds a single typed value. The value can be used only with the handle +specified by \fIh\fR and objects associated with \fIh\fR. +.sp +.LP +The \fBscf_value_reset()\fR function resets the value to the uninitialized +state. The \fBscf_value_destroy()\fR function deallocates the object. +.sp +.LP +The \fBscf_value_type()\fR function retrieves the type of the contents of +\fIv\fR. The \fBscf_value_is_type()\fR function determines if a value is of a +particular type or any of its subtypes. The \fBscf_type_base_type()\fR function +returns the base type of \fItype\fR. The \fBscf_value_base_type()\fR function +returns the true base type of the value (the highest type reachable from the +value's type). +.sp + +.sp +.TS +tab(); +cw(1.8i) cw(.84i) cw(2.86i) +lw(1.8i) lw(.84i) lw(2.86i) +. +Type IdentifierBase TypeType Description +_ +\fBSCF_TYPE_INVALID\fRreserved invalid type +\fBSCF_TYPE_BOOLEAN\fRsingle bit +\fBSCF_TYPE_COUNT\fRunsigned 64-bit quantity +\fBSCF_TYPE_INTEGER\fRsigned 64-bit quantity +\fBSCF_TYPE_TIME\fRT{ +signed 64-bit seconds, signed 32-bit nanoseconds in the range 0 <= \fIns\fR < 1,000,000,000 +T} +\fBSCF_TYPE_ASTRING\fR8-bit NUL-terminated string +\fBSCF_TYPE_OPAQUE\fRopaque 8-bit data +\fBSCF_TYPE_USTRING\fR\fBASTRING\fR8-bit UTF-8 string +\fBSCF_TYPE_URI\fR\fBUSTRING\fRa URI string +\fBSCF_TYPE_FMRI\fR\fBURI\fRa Fault Management Resource Identifier +\fBSCF_TYPE_HOST\fR\fBUSTRING\fRT{ +either a hostname, IPv4 address, or IPv6 address +T} +\fBSCF_TYPE_HOSTNAME\fR\fBHOST\fRa fully-qualified domain name +\fBSCF_TYPE_NET_ADDR_V4\fR\fBHOST\fRT{ +a dotted-quad IPv4 address with optional network portion +T} +\fBSCF_TYPE_NET_ADDR_V6\fR\fBHOST\fRlegal IPv6 address +.TE + +.sp +.LP +The \fBscf_value_get_boolean()\fR, \fBscf_value_get_count()\fR, +\fBscf_value_get_integer()\fR, \fBscf_value_get_time()\fR, +\fBscf_value_get_astring()\fR, \fBscf_value_get_ustring()\fR, and +\fBscf_value_get_opaque()\fR functions read a particular type of value from +\fIv\fR. +.sp +.LP +The \fBscf_value_get_as_string()\fR and \fBscf_value_get_as_string_typed()\fR +functions convert the value to a string form. For +\fBscf_value_get_as_string_typed()\fR, the value must be a reachable subtype of +\fItype\fR. +.sp +.LP +The \fBscf_value_set_boolean()\fR, \fBscf_value_set_count()\fR, +\fBscf_value_set_integer()\fR, \fBscf_value_set_time()\fR, +\fBscf_value_set_astring()\fR, \fBscf_value_set_ustring()\fR, and +\fBscf_value_set_opaque()\fR functions set \fIv\fR to a particular value of a +particular type. +.sp +.LP +The \fBscf_value_set_from_string()\fR function is the inverse of +\fBscf_value_get_as_string()\fR. It sets \fIv\fR to the value encoded in +\fIbuf\fR of type \fItype\fR. +.sp +.LP +The \fBscf_value_set_*()\fR functions will succeed on \fBscf_value_t\fR objects +that have already been set. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBscf_value_create()\fR returns a new, reset +\fBscf_value_t\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +Upon successful completion, \fBscf_value_handle()\fR returns the handle +associated with \fIv\fR. Otherwise, it returns \fINULL\fR. +.sp +.LP +The \fBscf_value_base_type()\fR function returns the base type of the value, or +\fBSCF_TYPE_INVALID\fR on failure. +.sp +.LP +Upon successful completion, \fBscf_value_type()\fR returns the type of the +value. Otherwise, it returns \fBSCF_TYPE_INVALID\fR. +.sp +.LP +Upon successful completion, \fBscf_value_is_type()\fR, +\fBscf_value_get_boolean()\fR, \fBscf_value_get_count()\fR, +\fBscf_value_get_integer()\fR, \fBscf_value_get_time()\fR, +\fBscf_value_set_time()\fR, \fBscf_value_set_from_string()\fR, +\fBscf_value_set_astring()\fR, \fBscf_value_set_ustring()\fR, and +\fBscf_value_set_opaque()\fR return 0. Otherwise, they return -1. +.sp +.LP +Upon successful completion, \fBscf_value_get_astring()\fR, +\fBscf_value_get_ustring()\fR, \fBscf_value_get_as_string()\fR, and +\fBscf_value_get_as_string_typed()\fR return the length of the source string, +not including the terminating null byte. Otherwise, they return -1. +.sp +.LP +Upon successful completion, \fBscf_value_get_opaque()\fR returns the number of +bytes written. Otherwise, it returns -1. +.SH ERRORS +.sp +.LP +The \fBscf_value_create()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.RS 30n +.rt +The handle associated with \fIh\fR has been destroyed. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The handle is \fINULL\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.RS 30n +.rt +There is not enough memory to allocate an \fBscf_value_t\fR. +.RE + +.sp +.LP +The \fBscf_value_handle()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR +.ad +.RS 30n +.rt +The handle associated with \fIv\fR has been destroyed. +.RE + +.sp +.LP +The \fBscf_value_set_time()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The nanoseconds field is not in the range 0 <= \fIns\fR < 1,000,000,000. +.RE + +.sp +.LP +The \fBscf_type_base_type()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The \fItype\fR argument is not a valid type. +.RE + +.sp +.LP +The \fBscf_value_set_astring()\fR, \fBscf_value_set_ustring()\fR, +\fBscf_value_set_opaque()\fR, and \fBscf_value_set_from_string()\fR functions +will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The \fIin\fR argument is not a valid value for the specified type or is longer +than the maximum supported value length. +.RE + +.sp +.LP +The \fBscf_type_base_type()\fR, \fBscf_value_is_type()\fR, and +\fBscf_value_get_as_string_typed()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.RS 30n +.rt +The \fItype\fR argument is not a valid type. +.RE + +.sp +.LP +The \fBscf_value_type()\fR, \fBscf_value_base_type()\fR, +\fBscf_value_get_boolean()\fR, \fBscf_value_get_count()\fR, +\fBscf_value_get_integer()\fR, \fBscf_value_get_time()\fR, +\fBscf_value_get_astring()\fR, \fBscf_value_get_ustring()\fR, +\fBscf_value_get_as_string()\fR, and\fBscf_value_get_as_string_typed()\fR +functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_SET\fR\fR +.ad +.RS 21n +.rt +The \fIv\fR argument has not been set to a value. +.RE + +.sp +.LP +The \fBscf_value_get_boolean()\fR, \fBscf_value_get_count()\fR, +\fBscf_value_get_integer()\fR, \fBscf_value_get_time()\fR, +\fBscf_value_get_astring()\fR, \fBscf_value_get_ustring()\fR, and +\fBscf_value_get_as_string_typed()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_TYPE_MISMATCH\fR\fR +.ad +.RS 27n +.rt +The requested type is not the same as the value's type and is not in the +base-type chain. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibscf\fR(3LIB), \fBscf_entry_add_value\fR(3SCF), \fBscf_error\fR(3SCF), +\fBattributes\fR(5) diff --git a/usr/src/man/man3scf/smf_enable_instance.3scf b/usr/src/man/man3scf/smf_enable_instance.3scf new file mode 100644 index 0000000000..1e40fbaa52 --- /dev/null +++ b/usr/src/man/man3scf/smf_enable_instance.3scf @@ -0,0 +1,275 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.TH smf_enable_instance 3SCF "5 Nov 2007" "SunOS 5.11" "Service Configuration Facility Library Functions" +.SH NAME +smf_enable_instance, smf_disable_instance, smf_refresh_instance, +smf_restart_instance, smf_maintain_instance, smf_degrade_instance, +smf_restore_instance, smf_get_state \- administrative interface to the Service +Configuration Facility +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <libscf.h> + +\fBint\fR \fBsmf_enable_instance\fR(\fBconst char *\fR\fIinstance\fR, \fBint\fR \fIflags\fR); +.fi + +.LP +.nf +\fBint\fR \fBsmf_disable_instance\fR(\fBconst char *\fR\fIinstance\fR, \fBint\fR \fIflags\fR); +.fi + +.LP +.nf +\fBint\fR \fBsmf_refresh_instance\fR(\fBconst char *\fR\fIinstance\fR); +.fi + +.LP +.nf +\fBint\fR \fBsmf_restart_instance\fR(\fBconst char *\fR\fIinstance\fR); +.fi + +.LP +.nf +\fBint\fR \fBsmf_maintain_instance\fR(\fBconst char *\fR\fIinstance\fR, \fBint\fR \fIflags\fR); +.fi + +.LP +.nf +\fBint\fR \fBsmf_degrade_instance\fR(\fBconst char *\fR\fIinstance\fR, \fBint\fR \fIflags\fR); +.fi + +.LP +.nf +\fBint\fR \fBsmf_restore_instance\fR(\fBconst char *\fR\fIinstance\fR); +.fi + +.LP +.nf +\fBchar *\fR\fBsmf_get_state\fR(\fBconst char *\fR\fIinstance\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +These functions provide administrative control over service instances. Using +these functions, an administrative tool can make a request to enable, disable, +refresh, or restart an instance. All calls are asynchronous. They request an +action, but do not wait to see if the action succeeds or fails. +.sp +.LP +The \fBsmf_enable_instance()\fR function enables the service instance specified +by \fIinstance\fR FMRI. If \fIflags\fR is \fBSMF_TEMPORARY\fR, the enabling of +the service instance is a temporary change, lasting only for the lifetime of +the current system instance. The \fIflags\fR argument is set to \fB0\fR if no +flags are to be use. +.sp +.LP +The \fBsmf_disable_instance()\fR function places the service instance specified +by \fIinstance\fR FMRI in the disabled state and triggers the stop method (see +\fBsvc.startd\fR(1M)). If \fIflags\fR is \fBSMF_TEMPORARY\fR, the disabling of +the service instance is a temporary change, lasting only for the lifetime of +the current system instance. The \fIflags\fR argument is set to \fB0\fR if no +flags are to be use. +.sp +.LP +The \fBsmf_refresh_instance()\fR function causes the service instance specified +by \fIinstance\fR FMRI to re-read its configuration information. +.sp +.LP +The \fBsmf_restart_instance()\fR function restarts the service instance +specified by \fIinstance\fR FMRI. +.sp +.LP +The \fBsmf_maintain_instance()\fR function moves the service instance specified +by \fIinstance\fR into the maintenance state. If \fIflags\fR is +\fBSMF_IMMEDIATE\fR, the instance is moved into maintenance state immediately, +killing any running methods. If \fIflags\fR is \fBSMF_TEMPORARY\fR, the change +to maintenance state is a temporary change, lasting only for the lifetime of +the current system instance. The \fIflags\fR argument is set to \fB0\fR if no +flags are to be use. +.sp +.LP +The \fBsmf_degrade_instance()\fR function moves an online service instance into +the degraded state. This function operates only on instances in the online +state. The \fIflags\fR argument is set to \fB0\fR if no flags are to be use. +The only available flag is \fBSMF_IMMEDIATE\fR, which causes the instance to be +moved into the degraded state immediately. +.sp +.LP +The \fBsmf_restore_instance()\fR function brings an instance currently in the +maintenance to the uninitialized state, so that it can be brought back online. +For a service in the degraded state, \fBsmf_restore_instance()\fR brings the +specified instance back to the online state. +.sp +.LP +The \fBsmf_get_state()\fR function returns a pointer to a string containing the +name of the instance's current state. The user is responsible for freeing this +string. Possible state strings are defined as the following: +.sp +.in +2 +.nf +#define SCF_STATE_STRING_UNINIT ((const char *)"uninitialized") +#define SCF_STATE_STRING_MAINT ((const char *)"maintenance") +#define SCF_STATE_STRING_OFFLINE ((const char *)"offline") +#define SCF_STATE_STRING_DISABLED ((const char *)"disabled") +#define SCF_STATE_STRING_ONLINE ((const char *)"online") +#define SCF_STATE_STRING_DEGRADED ((const char *)"degraded") +.fi +.in -2 + +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBsmf_enable_instance()\fR, +\fBsmf_disable_instance()\fR, \fBsmf_refresh_instance()\fR, +\fBsmf_restart_instance()\fR, \fBsmf_maintain_instance()\fR, +\fBsmf_degrade_instance()\fR, and \fBsmf_restore_instance()\fR return \fB0\fR. +Otherwise, they return \fB-1\fR\&. +.sp +.LP +Upon successful completion, smf_get_state returns an allocated string. +Otherwise, it returns \fINULL\fR. +.SH ERRORS +.sp +.LP +These functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_MEMORY\fR\fR +.ad +.sp .6 +.RS 4n +The memory allocation failed. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR +.ad +.sp .6 +.RS 4n +The \fIinstance\fR FMRI or \fIflags\fR argument is invalid. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NOT_FOUND\fR\fR +.ad +.sp .6 +.RS 4n +The FMRI is valid but there is no matching instance found. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR +.ad +.sp .6 +.RS 4n +The connection to repository was broken. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_NO_RESOURCES\fR\fR +.ad +.sp .6 +.RS 4n +The server has insufficient resources. +.RE + +.sp +.LP +The \fBsmf_maintain_instance()\fR, \fBsmf_refresh_instance()\fR, +\fBsmf_restart_instance()\fR, \fBsmf_degrade_instance()\fR, and +\fBsmf_restore_instance()\fR functions will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR +.ad +.sp .6 +.RS 4n +User does not have proper authorizations. See \fBsmf_security\fR(5). +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR +.ad +.sp .6 +.RS 4n +The repository's backend refused access. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_BACKEND_READONLY\fR\fR +.ad +.sp .6 +.RS 4n +The repository's backend is read-only. +.RE + +.sp +.LP +The \fBsmf_restore_instance()\fR and \fBsmf_degrade_instance()\fR functions +will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBSCF_ERROR_CONSTRAINT_VIOLATED\fR\fR +.ad +.sp .6 +.RS 4n +The function is called on an instance in an inappropriate state. +.RE + +.sp +.LP +The \fBscf_error\fR(3SCF) function can be used to retrieve the error value. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBsvc.startd\fR(1M), \fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), +\fBattributes\fR(5), \fBsmf_security\fR(5) |
