Skip Navigation Links | |
Exit Print View | |
man pages section 3: Extended Library Functions, Volume 1 Oracle Solaris 11.1 Information Library |
Extended Library Functions, Volume 1
CIRCLEQ_HEAD_INITIALIZER(3EXT)
cpc_walk_generic_events_all(3CPC)
cpc_walk_generic_events_pic(3CPC)
ct_dev_status_get_aset(3CONTRACT)
ct_dev_status_get_dev_state(3CONTRACT)
ct_dev_status_get_minor(3CONTRACT)
ct_dev_status_get_noneg(3CONTRACT)
ct_dev_tmpl_clear_noneg(3CONTRACT)
ct_dev_tmpl_get_aset(3CONTRACT)
ct_dev_tmpl_get_minor(3CONTRACT)
ct_dev_tmpl_get_noneg(3CONTRACT)
ct_dev_tmpl_set_aset(3CONTRACT)
ct_dev_tmpl_set_minor(3CONTRACT)
ct_dev_tmpl_set_noneg(3CONTRACT)
ct_event_read_critical(3CONTRACT)
ct_pr_event_get_exitstatus(3CONTRACT)
ct_pr_event_get_gcorefile(3CONTRACT)
ct_pr_event_get_pcorefile(3CONTRACT)
ct_pr_event_get_pid(3CONTRACT)
ct_pr_event_get_ppid(3CONTRACT)
ct_pr_event_get_sender(3CONTRACT)
ct_pr_event_get_senderct(3CONTRACT)
ct_pr_event_get_signal(3CONTRACT)
ct_pr_event_get_zcorefile(3CONTRACT)
ct_pr_status_get_contracts(3CONTRACT)
ct_pr_status_get_fatal(3CONTRACT)
ct_pr_status_get_members(3CONTRACT)
ct_pr_status_get_param(3CONTRACT)
ct_pr_status_get_svc_aux(3CONTRACT)
ct_pr_status_get_svc_creator(3CONTRACT)
ct_pr_status_get_svc_ctid(3CONTRACT)
ct_pr_status_get_svc_fmri(3CONTRACT)
ct_pr_tmpl_get_fatal(3CONTRACT)
ct_pr_tmpl_get_svc_aux(3CONTRACT)
ct_pr_tmpl_get_svc_fmri(3CONTRACT)
ct_pr_tmpl_get_transfer(3CONTRACT)
ct_pr_tmpl_set_fatal(3CONTRACT)
ct_pr_tmpl_set_param(3CONTRACT)
ct_pr_tmpl_set_svc_aux(3CONTRACT)
ct_pr_tmpl_set_svc_fmri(3CONTRACT)
ct_pr_tmpl_set_transfer(3CONTRACT)
ct_status_get_cookie(3CONTRACT)
ct_status_get_critical(3CONTRACT)
ct_status_get_holder(3CONTRACT)
ct_status_get_informative(3CONTRACT)
ct_status_get_nevents(3CONTRACT)
ct_status_get_nevid(3CONTRACT)
ct_status_get_ntime(3CONTRACT)
ct_status_get_qtime(3CONTRACT)
ct_status_get_state(3CONTRACT)
ct_status_get_zoneid(3CONTRACT)
ct_tmpl_get_critical(3CONTRACT)
ct_tmpl_get_informative(3CONTRACT)
ct_tmpl_set_critical(3CONTRACT)
ct_tmpl_set_informative(3CONTRACT)
dat_evd_clear_unwaitable(3DAT)
dat_get_consumer_context(3DAT)
dat_registry_add_provider(3DAT)
dat_registry_list_providers(3DAT)
dat_registry_remove_provider(3DAT)
dat_set_consumer_context(3DAT)
devid_deviceid_to_nmlist(3DEVID)
di_link_next_by_lnode(3DEVINFO)
di_link_next_by_node(3DEVINFO)
di_lnode_private_get(3DEVINFO)
di_lnode_private_set(3DEVINFO)
di_minor_private_get(3DEVINFO)
di_minor_private_set(3DEVINFO)
di_path_client_devfs_path(3DEVINFO)
di_path_client_next_path(3DEVINFO)
di_path_phci_next_path(3DEVINFO)
di_path_prop_lookup_bytes(3DEVINFO)
di_path_prop_lookup_int64s(3DEVINFO)
di_path_prop_lookup_ints(3DEVINFO)
di_path_prop_lookup_strings(3DEVINFO)
di_path_prop_strings(3DEVINFO)
di_prom_prop_lookup_bytes(3DEVINFO)
di_prom_prop_lookup_ints(3DEVINFO)
di_prom_prop_lookup_strings(3DEVINFO)
di_prop_lookup_bytes(3DEVINFO)
di_prop_lookup_int64(3DEVINFO)
di_prop_lookup_strings(3DEVINFO)
ea_match_object_catalog(3EXACCT)
- process contract template functions
cc [ flag… ] file… -D_LARGEFILE64_SOURCE -lcontract [ library… ] #include <libcontract.h> #include <sys/contract/process.h> int ct_pr_tmpl_set_transfer(int fd, ctid_t ctid);
int ct_pr_tmpl_set_fatal(int fd, uint_t events);
int ct_pr_tmpl_set_param(int fd, uint_t params);
int ct_pr_tmpl_set_svc_fmri(int fd, const char *fmri);
int ct_pr_tmpl_set_svc_aux(int fd, const char *aux);
int ct_pr_tmpl_get_transfer(int fd, ctid_t *ctidp);
int ct_pr_tmpl_get_fatal(int fd, uint_t *eventsp);
int ct_pr_tmpl_get_param(int fd, uint_t *paramsp);
int ct_pr_tmpl_get_svc_fmri(int fd, char *fmri, size_t size);
int ct_pr_tmpl_get_svc_aux(int fd, char *aux, size_t size);
These functions read and write process contract terms and operate on process contract template file descriptors obtained from the contract(4) file system.
The ct_pr_tmpl_set_transfer() and ct_pr_tmpl_get_transfer() functions write and read the transfer contract term. The value is the ID of an empty regent process contract owned by the caller whose inherited contracts are to be transferred to a newly created contract.
The ct_pr_tmpl_set_fatal() and ct_pr_tmpl_get_fatal() functions write and read the fatal event set term. The value is a collection of bits as described in process(4).
The ct_pr_tmpl_set_param() and ct_pr_tmpl_get_param() functions write and read the parameter set term. The value is a collection of bits as described in process(4).
The ct_pr_tmpl_set_svc_fmri() and ct_pr_tmpl_get_svc_fmri() functions write and read the service FMRI value of a process contract template. The ct_pr_tmpl_set_svc_fmri() function requires the caller to have the {PRIV_CONTRACT_IDENTITY} privilege in its effective set.
The ct_pr_tmpl_set_svc_aux() and ct_pr_tmpl_get_svc_aux() functions write and read the creator's auxiliary value of a process contract template.
Upon successful completion, ct_pr_tmpl_set_transfer(), ct_pr_tmpl_set_fatal(), ct_pr_tmpl_set_param(), ct_pr_tmpl_set_svc_fmri(), ct_pr_tmpl_set_svc_aux(), ct_pr_tmpl_get_transfer(), ct_pr_tmpl_get_fatal(), and ct_pr_tmpl_get_param() return 0. Otherwise, they return a non-zero error value.
Upon successful completion, ct_pr_tmpl_get_svc_fmri() and ct_pr_tmpl_get_svc_aux() return the size required to store the value, which is the same value return by strcpy(3C) + 1. Insufficient buffer size can be checked by:
if (ct_pr_tmpl_get_svc_fmri(fd, fmri, size) > size) /* buffer is too small */
Otherwise, ct_pr_tmpl_get_svc_fmri() and ct_pr_tmpl_get_svc_aux() return -1 and set errno to indicate the error.
The ct_pr_tmpl_set_param(), ct_pr_tmpl_set_svc_fmri(), ct_pr_tmpl_set_svc_aux(), ct_pr_tmpl_get_svc_fmri() and ct_pr_tmpl_get_svc_aux() functions will fail if:
An invalid parameter was specified.
The ct_pr_tmpl_set_fatal() function will fail if:
An invalid event was specified.
The ct_pr_tmpl_set_transfer() function will fail if:
The ID specified by ctid does not correspond to a process contract.
The ID specified by ctid does not correspond to a process contract owned by the calling process.
The ID specified by ctid does not correspond to an empty process contract.
The ct_pr_tmpl_set_svc_fmri() function will fail if:
The calling process does not have {PRIV_CONTRACT_IDENTITY} in its effective set.
Example 1 Create and activate a process contract template.
The following example opens a new template, makes hardware errors and signals fatal events, makes hardware errors critical events, and activates the template. It then forks a process in the new contract using the requested terms.
#include <libcontract.h> #include <fcntl.h> #include <unistd.h> ... int fd; fd = open("/system/contract/process/template", O_RDWR); (void) ct_pr_tmpl_set_fatal(fd, CT_PR_EV_HWERR|CT_PR_EV_SIGNAL); (void) ct_tmpl_set_critical(fd, CT_PR_EV_HWERR); (void) ct_tmpl_activate(fd); close(fd); if (fork()) { /* parent - owns new process contract */ ... } else { /* child - in new process contract */ ... } ...
Example 2 Clear the process contract template.
The following example opens the template file and requests that the active template be cleared.
#include <libcontract.h> #include <fcntl.h> ... int fd; fd = open("/system/contract/process/template", O_RDWR); (void) ct_tmpl_clear(fd); close(fd); ...
See attributes(5) for descriptions of the following attributes:
|
libcontract(3LIB), strcpy(3C), contract(4), process(4), attributes(5), lfcompile(5)