2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH CT_PR_STATUS_GET_PARAM 3CONTRACT "Feb 25, 2008"
8 ct_pr_status_get_param, ct_pr_status_get_fatal, ct_pr_status_get_members,
9 ct_pr_status_get_contracts, ct_pr_status_get_svc_fmri,
10 ct_pr_status_get_svc_aux, ct_pr_status_get_svc_ctid,
11 ct_pr_status_get_svc_creator \- process contract status functions
15 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB -lcontract \fR [ \fIlibrary\fR\&.\|.\|. ]
16 #include <libcontract.h>
17 #include <sys/contract/process.h>
19 \fBint\fR \fBct_pr_status_get_param\fR(\fBct_stathdl_t\fR \fIstathdl\fR, \fBuint_t *\fR\fIparamp\fR);
24 \fBint\fR \fBct_pr_status_get_fatal\fR(\fBct_stathdl_t\fR \fIstathdl\fR, \fBuint_t *\fR\fIeventsp\fR);
29 \fBint\fR \fBct_pr_status_get_members\fR(\fBct_stathdl_t\fR \fIstathdl\fR,
30 \fBpid_t **\fR\fIpidpp\fR, \fBuint_t *\fR\fIn\fR);
35 \fBint\fR \fBct_pr_status_get_contracts\fR(\fBct_stathdl_t\fR \fIstathdl\fR,
36 \fBctid_t **\fR\fIidpp\fR, \fBuint_t *\fR\fIn\fR);
41 \fBint\fR \fBct_pr_status_get_svc_fmri\fR(\fBct_stathdl_t\fR \fIstathdl\fR, \fBchar **\fR\fIfmri\fR);
46 \fBint\fR \fBct_pr_status_get_svc_aux\fR(\fBct_stathdl_t\fR \fIstathdl\fR, \fBchar **\fR\fIaux\fR);
51 \fBint\fR \fBct_pr_status_get_svc_ctid\fR(\fBct_stathdl_t\fR \fIstathdl\fR, \fBctid_t *\fR\fIctid\fR);
56 \fBint\fR \fBct_pr_status_get_svc_creator\fR(\fBct_stathdl_t\fR \fIstathdl\fR,
57 \fBchar **\fR\fIcreator\fR);
63 These functions read process contract status information from a status object
64 returned by \fBct_status_read\fR(3CONTRACT).
67 The \fBct_pr_status_get_param()\fR function reads the parameter set term. The
68 value is a collection of bits as described in \fBprocess\fR(4).
71 The \fBct_pr_status_get_fatal()\fR function reads the fatal event set term. The
72 value is a collection of bits as described in \fBprocess\fR(4).
75 The \fBct_pr_status_get_members()\fR function obtains a list of the process IDs
76 of the members of the process contract. A pointer to an array of process IDs is
77 stored in *\fIpidpp\fR. The number of elements in this array is stored in
78 *\fIn\fR. These data are freed when the status object is freed by a call to
79 \fBct_status_free\fR(3CONTRACT).
82 The \fBct_pr_status_get_contracts()\fR function obtains a list of IDs of
83 contracts that have been inherited by the contract. A pointer to an array of
84 IDs is stored in *\fIidpp\fR. The number of elements in this array is stored in
85 *\fIn\fR. These data are freed when the status object is freed by a call to
86 \fBct_status_free()\fR.
89 The \fBct_pr_status_get_svc_fmri()\fR, \fBct_pr_status_get_svc_creator()\fR,
90 and \fBct_pr_status_get_svc_aux()\fR functions read, respectively, the service
91 FMRI, the contract's creator \fBexecname\fR and the creator's auxiliary field.
92 The buffer pointed to by \fIfmri\fR, \fIaux\fR or \fIcreator\fR, is freed by a
93 call to \fBct_status_free()\fR and should not be modified.
96 The \fBct_pr_status_get_svc_ctid()\fR function reads the process contract id
97 for which the service FMRI was first set.
101 Upon successful completion, \fBct_pr_status_get_param()\fR,
102 \fBct_pr_status_get_fatal()\fR, \fBct_pr_status_get_members()\fR,
103 \fBct_pr_status_get_contracts()\fR, \fBct_pr_status_get_svc_fmri()\fR,
104 \fBct_pr_status_get_svc_creator()\fR, \fBct_pr_status_get_svc_aux()\fR, and
105 \fBct_pr_status_get_svc_ctid()\fR return 0. Otherwise, they return a non-zero
110 The \fBct_pr_status_get_param()\fR, \fBct_pr_status_get_fatal()\fR,
111 \fBct_pr_status_get_members()\fR, \fBct_pr_status_get_contracts()\fR,
112 \fBct_pr_status_get_svc_fmri()\fR, \fBct_pr_status_get_svc_creator()\fR,
113 \fBct_pr_status_get_svc_aux()\fR, and \fBct_pr_status_get_svc_ctid()\fR
114 functions will fail if:
121 The \fIstathdl\fR argument is not a process contract status object.
126 The \fBct_pr_status_get_param()\fR, \fBct_pr_status_get_fatal()\fR,
127 \fBct_pr_status_get_members()\fR, \fBct_r_status_get_contracts()\fR,
128 \fBct_pr_status_get_svc_fmri()\fR, \fBct_pr_status_get_svc_creator()\fR,
129 \fBct_pr_status_get_svc_aux()\fR, and \fBct_pr_status_get_svc_ctid()\fR
130 functions will fail if:
137 The requested data were not available in the status object.
142 \fBExample 1 \fRPrint members of process contract 1.
145 Open the status file for contract 1, read the contract's status, obtain the
146 list of processes, print them, and free the status object.
151 #include <sys/types.h>
153 #include <libcontract.h>
162 fd = open("/system/contract/process/1/status");
163 ct_status_read(fd, &st);
164 ct_pr_status_get_members(st, &procs, &n);
165 for (i = 0 ; i < n; i++)
166 printf("%ld\en", (long)procs[i]);
167 ct_status_free(stat);
176 See \fBattributes\fR(5) for descriptions of the following attributes:
184 ATTRIBUTE TYPE ATTRIBUTE VALUE
186 Interface Stability Committed
194 \fBct_status_free\fR(3CONTRACT), \fBct_status_read\fR(3CONTRACT),
195 \fBlibcontract\fR(3LIB), \fBcontract\fR(4), \fBprocess\fR(4),