JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 3: Extended Library Functions
search filter icon
search icon

Document Information

Preface

Extended Library Functions - Part 1

acl_check(3SEC)

aclcheck(3SEC)

acl_free(3SEC)

aclfrommode(3SEC)

acl_fromtext(3SEC)

aclfromtext(3SEC)

acl_get(3SEC)

acl_set(3SEC)

aclsort(3SEC)

acl_strip(3SEC)

acltomode(3SEC)

acl_totext(3SEC)

acltotext(3SEC)

acl_trivial(3SEC)

acos(3M)

acosf(3M)

acosh(3M)

acoshf(3M)

acoshl(3M)

acosl(3M)

advance(3GEN)

asin(3M)

asinf(3M)

asinh(3M)

asinhf(3M)

asinhl(3M)

asinl(3M)

atan2(3M)

atan2f(3M)

atan2l(3M)

atan(3M)

atanf(3M)

atanh(3M)

atanhf(3M)

atanhl(3M)

atanl(3M)

au_close(3BSM)

au_open(3BSM)

au_preselect(3BSM)

au_to(3BSM)

au_to_arg32(3BSM)

au_to_arg(3BSM)

au_to_arg64(3BSM)

au_to_attr(3BSM)

au_to_cmd(3BSM)

au_to_data(3BSM)

auto_ef(3EXT)

auto_ef_file(3EXT)

auto_ef_free(3EXT)

auto_ef_get_encoding(3EXT)

auto_ef_get_score(3EXT)

auto_ef_str(3EXT)

au_to_groups(3BSM)

au_to_in_addr(3BSM)

au_to_ipc(3BSM)

au_to_iport(3BSM)

au_to_me(3BSM)

au_to_newgroups(3BSM)

au_to_opaque(3BSM)

au_to_path(3BSM)

au_to_process(3BSM)

au_to_process_ex(3BSM)

au_to_return32(3BSM)

au_to_return(3BSM)

au_to_return64(3BSM)

au_to_socket(3BSM)

au_to_subject(3BSM)

au_to_subject_ex(3BSM)

au_to_text(3BSM)

au_user_mask(3BSM)

au_write(3BSM)

bcleartoh(3TSOL)

bcleartoh_r(3TSOL)

bcleartos(3TSOL)

bgets(3GEN)

blcompare(3TSOL)

bldominates(3TSOL)

blequal(3TSOL)

blinrange(3TSOL)

blmaximum(3TSOL)

blminimum(3TSOL)

blminmax(3TSOL)

blstrictdom(3TSOL)

bltocolor(3TSOL)

bltocolor_r(3TSOL)

bltos(3TSOL)

bsltoh(3TSOL)

bsltoh_r(3TSOL)

bsltos(3TSOL)

btohex(3TSOL)

bufsplit(3GEN)

cabs(3M)

cabsf(3M)

cabsl(3M)

cacos(3M)

cacosf(3M)

cacosh(3M)

cacoshf(3M)

cacoshl(3M)

cacosl(3M)

carg(3M)

cargf(3M)

cargl(3M)

casin(3M)

casinf(3M)

casinh(3M)

casinhf(3M)

casinhl(3M)

casinl(3M)

catan(3M)

catanf(3M)

catanh(3M)

catanhf(3M)

catanhl(3M)

catanl(3M)

cbrt(3M)

cbrtf(3M)

cbrtl(3M)

ccos(3M)

ccosf(3M)

ccosh(3M)

ccoshf(3M)

ccoshl(3M)

ccosl(3M)

ceil(3M)

ceilf(3M)

ceill(3M)

cexp(3M)

cexpf(3M)

cexpl(3M)

cfc_file_start(3TECLA)

cfc_literal_escapes(3TECLA)

cfc_set_check_fn(3TECLA)

chkauthattr(3SECDB)

cimag(3M)

cimagf(3M)

cimagl(3M)

clog(3M)

clogf(3M)

clogl(3M)

compile(3GEN)

config_admin(3CFGADM)

config_ap_id_cmp(3CFGADM)

config_change_state(3CFGADM)

config_list(3CFGADM)

config_list_ext(3CFGADM)

config_private_func(3CFGADM)

config_stat(3CFGADM)

config_strerror(3CFGADM)

config_test(3CFGADM)

config_unload_libs(3CFGADM)

conj(3M)

conjf(3M)

conjl(3M)

ConnectToServer(3DMI)

copylist(3GEN)

copysign(3M)

copysignf(3M)

copysignl(3M)

cos(3M)

cosf(3M)

cosh(3M)

coshf(3M)

coshl(3M)

cosl(3M)

cpc(3CPC)

cpc_access(3CPC)

cpc_bind_cpu(3CPC)

cpc_bind_curlwp(3CPC)

cpc_bind_event(3CPC)

cpc_bind_pctx(3CPC)

cpc_buf_add(3CPC)

cpc_buf_copy(3CPC)

cpc_buf_create(3CPC)

cpc_buf_destroy(3CPC)

cpc_buf_get(3CPC)

cpc_buf_hrtime(3CPC)

cpc_buf_set(3CPC)

cpc_buf_sub(3CPC)

cpc_buf_tick(3CPC)

cpc_buf_zero(3CPC)

cpc_caps(3CPC)

cpc_cciname(3CPC)

cpc_close(3CPC)

cpc_count_sys_events(3CPC)

cpc_count_usr_events(3CPC)

cpc_cpuref(3CPC)

cpc_disable(3CPC)

cpc_enable(3CPC)

cpc_event(3CPC)

cpc_event_accum(3CPC)

cpc_event_diff(3CPC)

cpc_eventtostr(3CPC)

cpc_getcciname(3CPC)

cpc_getcpuref(3CPC)

cpc_getcpuver(3CPC)

cpc_getnpic(3CPC)

cpc_getusage(3CPC)

cpc_npic(3CPC)

cpc_open(3CPC)

cpc_pctx_bind_event(3CPC)

cpc_pctx_invalidate(3CPC)

cpc_pctx_rele(3CPC)

cpc_pctx_take_sample(3CPC)

cpc_rele(3CPC)

cpc_request_preset(3CPC)

cpc_set_add_request(3CPC)

cpc_set_create(3CPC)

cpc_set_destroy(3CPC)

cpc_seterrfn(3CPC)

cpc_seterrhndlr(3CPC)

cpc_set_restart(3CPC)

cpc_set_sample(3CPC)

cpc_shared_bind_event(3CPC)

cpc_shared_close(3CPC)

cpc_shared_open(3CPC)

cpc_shared_rele(3CPC)

cpc_shared_take_sample(3CPC)

cpc_strtoevent(3CPC)

cpc_take_sample(3CPC)

cpc_unbind(3CPC)

cpc_version(3CPC)

cpc_walk_attrs(3CPC)

cpc_walk_events_all(3CPC)

cpc_walk_events_pic(3CPC)

cpc_walk_names(3CPC)

cpc_walk_requests(3CPC)

cpl_add_completion(3TECLA)

cpl_check_exe(3TECLA)

cpl_complete_word(3TECLA)

cpl_file_completions(3TECLA)

cpl_last_error(3TECLA)

cpl_list_completions(3TECLA)

cpl_recall_matches(3TECLA)

cpl_record_error(3TECLA)

cplus_demangle(3EXT)

cpow(3M)

cpowf(3M)

cpowl(3M)

cproj(3M)

cprojf(3M)

cprojl(3M)

creal(3M)

crealf(3M)

creall(3M)

csin(3M)

csinf(3M)

csinh(3M)

csinhf(3M)

csinhl(3M)

csinl(3M)

csqrt(3M)

csqrtf(3M)

csqrtl(3M)

ctan(3M)

ctanf(3M)

ctanh(3M)

ctanhf(3M)

ctanhl(3M)

ctanl(3M)

ct_ctl_abandon(3CONTRACT)

ct_ctl_ack(3CONTRACT)

ct_ctl_adopt(3CONTRACT)

ct_ctl_newct(3CONTRACT)

ct_ctl_qack(3CONTRACT)

ct_event_free(3CONTRACT)

ct_event_get_ctid(3CONTRACT)

ct_event_get_evid(3CONTRACT)

ct_event_get_flags(3CONTRACT)

ct_event_get_nevid(3CONTRACT)

ct_event_get_newct(3CONTRACT)

ct_event_get_type(3CONTRACT)

ct_event_read(3CONTRACT)

ct_event_read_critical(3CONTRACT)

ct_event_reliable(3CONTRACT)

ct_event_reset(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_tmpl_get_fatal(3CONTRACT)

ct_pr_tmpl_get_param(3CONTRACT)

ct_pr_tmpl_get_transfer(3CONTRACT)

ct_pr_tmpl_set_fatal(3CONTRACT)

ct_pr_tmpl_set_param(3CONTRACT)

ct_pr_tmpl_set_transfer(3CONTRACT)

ct_status_free(3CONTRACT)

ct_status_get_cookie(3CONTRACT)

ct_status_get_critical(3CONTRACT)

ct_status_get_holder(3CONTRACT)

ct_status_get_id(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_type(3CONTRACT)

ct_status_get_zoneid(3CONTRACT)

ct_status_read(3CONTRACT)

ct_tmpl_activate(3CONTRACT)

ct_tmpl_clear(3CONTRACT)

ct_tmpl_create(3CONTRACT)

ct_tmpl_get_cookie(3CONTRACT)

ct_tmpl_get_critical(3CONTRACT)

ct_tmpl_get_informative(3CONTRACT)

ct_tmpl_set_cookie(3CONTRACT)

ct_tmpl_set_critical(3CONTRACT)

ct_tmpl_set_informative(3CONTRACT)

dat_cno_create(3DAT)

dat_cno_free(3DAT)

dat_cno_modify_agent(3DAT)

dat_cno_query(3DAT)

dat_cno_wait(3DAT)

dat_cr_accept(3DAT)

dat_cr_handoff(3DAT)

dat_cr_query(3DAT)

dat_cr_reject(3DAT)

dat_ep_connect(3DAT)

dat_ep_create(3DAT)

dat_ep_create_with_srq(3DAT)

dat_ep_disconnect(3DAT)

dat_ep_dup_connect(3DAT)

dat_ep_free(3DAT)

dat_ep_get_status(3DAT)

dat_ep_modify(3DAT)

dat_ep_post_rdma_read(3DAT)

dat_ep_post_rdma_write(3DAT)

dat_ep_post_recv(3DAT)

dat_ep_post_send(3DAT)

dat_ep_query(3DAT)

dat_ep_recv_query(3DAT)

dat_ep_reset(3DAT)

dat_ep_set_watermark(3DAT)

dat_evd_clear_unwaitable(3DAT)

dat_evd_dequeue(3DAT)

dat_evd_disable(3DAT)

dat_evd_enable(3DAT)

dat_evd_free(3DAT)

dat_evd_modify_cno(3DAT)

dat_evd_post_se(3DAT)

dat_evd_query(3DAT)

dat_evd_resize(3DAT)

dat_evd_set_unwaitable(3DAT)

dat_evd_wait(3DAT)

dat_get_consumer_context(3DAT)

dat_get_handle_type(3DAT)

dat_ia_close(3DAT)

dat_ia_open(3DAT)

dat_ia_query(3DAT)

dat_lmr_create(3DAT)

dat_lmr_free(3DAT)

dat_lmr_query(3DAT)

dat_lmr_sync_rdma_read(3DAT)

Extended Library Functions - Part 2

Extended Library Functions - Part 3

Extended Library Functions - Part 4

Extended Library Functions - Part 5

Extended Library Functions - Part 6

ct_pr_tmpl_set_transfer

, ct_pr_tmpl_set_fatal

, ct_pr_tmpl_set_param

, ct_pr_tmpl_get_transfer

, ct_pr_tmpl_get_fatal

, ct_pr_tmpl_get_param

- process contract template functions

Synopsis

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_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);

Description

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).

Return Values

Upon successful completion, ct_pr_tmpl_set_transfer(), ct_pr_tmpl_set_fatal(), ct_pr_tmpl_set_param(), 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.

Errors

The ct_pr_tmpl_set_param() function will fail if:

EINVAL

An invalid parameter was specified.

The ct_pr_tmpl_set_fatal() function will fail if:

EINVAL

An invalid event was specified.

The ct_pr_tmpl_set_transfer() function will fail if:

ESRCH

The ID specified by ctid does not correspond to a process contract.

EACCES

The ID specified by ctid does not correspond to a process contract owned by the calling process.

ENOTEMPTY

The ID specified by ctid does not correspond to an empty process contract.

Examples

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);
...

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Evolving
MT-Level
Safe

See Also

libcontract(3LIB), contract(4), process(4), attributes(5), lfcompile(5)