1ct_pr_status_get_paramC(o3nCtOrNaTcRtACMTa)nagement Libracrty_pFru_nscttaitounss_get_param(3CONTRACT)
2
3
4

NAME

6       ct_pr_status_get_param,  ct_pr_status_get_fatal,  ct_pr_status_get_mem‐
7       bers, ct_pr_status_get_contracts, ct_pr_status_get_svc_fmri, ct_pr_sta‐
8       tus_get_svc_aux,  ct_pr_status_get_svc_ctid,  ct_pr_status_get_svc_cre‐
9       ator - process contract status functions
10

SYNOPSIS

12       cc [ flag... ] file... -D_LARGEFILE64_SOURCE  -lcontract  [ library... ]
13       #include <libcontract.h>
14       #include <sys/contract/process.h>
15
16       int ct_pr_status_get_param(ct_stathdl_t stathdl, uint_t *paramp);
17
18
19       int ct_pr_status_get_fatal(ct_stathdl_t stathdl, uint_t *eventsp);
20
21
22       int ct_pr_status_get_members(ct_stathdl_t stathdl,
23            pid_t **pidpp, uint_t *n);
24
25
26       int ct_pr_status_get_contracts(ct_stathdl_t stathdl,
27            ctid_t **idpp, uint_t *n);
28
29
30       int ct_pr_status_get_svc_fmri(ct_stathdl_t stathdl, char **fmri);
31
32
33       int ct_pr_status_get_svc_aux(ct_stathdl_t stathdl, char **aux);
34
35
36       int ct_pr_status_get_svc_ctid(ct_stathdl_t stathdl, ctid_t *ctid);
37
38
39       int ct_pr_status_get_svc_creator(ct_stathdl_t stathdl,
40            char **creator);
41
42

DESCRIPTION

44       These functions read process contract status information from a  status
45       object returned by ct_status_read(3CONTRACT).
46
47
48       The ct_pr_status_get_param() function reads the parameter set term. The
49       value is a collection of bits as described in process(4).
50
51
52       The ct_pr_status_get_fatal() function reads the fatal event  set  term.
53       The value is a collection of bits as described in process(4).
54
55
56       The  ct_pr_status_get_members()  function obtains a list of the process
57       IDs of the members of the process contract. A pointer to  an  array  of
58       process  IDs  is stored in *pidpp. The number of elements in this array
59       is stored in *n. These data are freed when the status object  is  freed
60       by a call to ct_status_free(3CONTRACT).
61
62
63       The ct_pr_status_get_contracts() function obtains a list of IDs of con‐
64       tracts that have been inherited by the contract. A pointer to an  array
65       of  IDs  is  stored  in  *idpp. The number of elements in this array is
66       stored in *n. These data are freed when the status object is freed by a
67       call to ct_status_free().
68
69
70       The  ct_pr_status_get_svc_fmri(),  ct_pr_status_get_svc_creator(),  and
71       ct_pr_status_get_svc_aux() functions read,  respectively,  the  service
72       FMRI,  the  contract's  creator  execname  and  the creator's auxiliary
73       field. The buffer pointed to by fmri, aux or creator,  is  freed  by  a
74       call to ct_status_free() and should not be modified.
75
76
77       The  ct_pr_status_get_svc_ctid() function reads the process contract id
78       for which the service FMRI was first set.
79

RETURN VALUES

81       Upon  successful   completion,   ct_pr_status_get_param(),   ct_pr_sta‐
82       tus_get_fatal(),    ct_pr_status_get_members(),   ct_pr_status_get_con‐
83       tracts(), ct_pr_status_get_svc_fmri(),  ct_pr_status_get_svc_creator(),
84       ct_pr_status_get_svc_aux(),  and  ct_pr_status_get_svc_ctid() return 0.
85       Otherwise, they return a non-zero error value.
86

ERRORS

88       The  ct_pr_status_get_param(),   ct_pr_status_get_fatal(),   ct_pr_sta‐
89       tus_get_members(),       ct_pr_status_get_contracts(),       ct_pr_sta‐
90       tus_get_svc_fmri(),     ct_pr_status_get_svc_creator(),      ct_pr_sta‐
91       tus_get_svc_aux(),  and ct_pr_status_get_svc_ctid() functions will fail
92       if:
93
94       EINVAL    The stathdl argument is not a process contract status object.
95
96
97
98       The  ct_pr_status_get_param(),   ct_pr_status_get_fatal(),   ct_pr_sta‐
99       tus_get_members(),        ct_r_status_get_contracts(),       ct_pr_sta‐
100       tus_get_svc_fmri(),     ct_pr_status_get_svc_creator(),      ct_pr_sta‐
101       tus_get_svc_aux(),  and ct_pr_status_get_svc_ctid() functions will fail
102       if:
103
104       ENOENT    The requested data were not available in the status object.
105
106

EXAMPLES

108       Example 1 Print members of process contract 1.
109
110
111       Open the status file for contract 1, read the contract's status, obtain
112       the list of processes, print them, and free the status object.
113
114
115         #include <sys/types.h>
116         #include <fcntl.h>
117         #include <libcontract.h>
118         #include <stdio.h>
119
120         ...
121         int fd;
122         uint_t i, n;
123         pid_t *procs;
124         ct_stathdl_t st;
125
126         fd = open("/system/contract/process/1/status");
127         ct_status_read(fd, &st);
128         ct_pr_status_get_members(st, &procs, &n);
129         for (i = 0 ; i < n; i++)
130                 printf("%ld\n", (long)procs[i]);
131         ct_status_free(stat);
132         close(fd);
133         ...
134
135

ATTRIBUTES

137       See attributes(5) for descriptions of the following attributes:
138
139
140
141
142       ┌─────────────────────────────┬─────────────────────────────┐
143       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
144       ├─────────────────────────────┼─────────────────────────────┤
145       │Interface Stability          │Committed                    │
146       ├─────────────────────────────┼─────────────────────────────┤
147       │MT-Level                     │Safe                         │
148       └─────────────────────────────┴─────────────────────────────┘
149

SEE ALSO

151       ct_status_free(3CONTRACT),      ct_status_read(3CONTRACT),      libcon‐
152       tract(3LIB), contract(4), process(4), attributes(5), lfcompile(5)
153
154
155
156SunOS 5.11                        25 Feb 2008ct_pr_status_get_param(3CONTRACT)
Impressum