summaryrefslogtreecommitdiff
path: root/usr/src/man/man3contract/ct_tmpl_activate.3contract
blob: cea0ad2481fdb9e2baf5fe83d869513e082f96a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
'\" 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 CT_TMPL_ACTIVATE 3CONTRACT "Apr 1, 2004"
.SH NAME
ct_tmpl_activate, ct_tmpl_clear, ct_tmpl_create, ct_tmpl_set_cookie,
ct_tmpl_set_critical, ct_tmpl_set_informative, ct_tmpl_get_cookie,
ct_tmpl_get_critical, ct_tmpl_get_informative \- common contract template
functions
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-D_LARGEFILE64_SOURCE\fR \fB -lcontract \fR [ \fIlibrary\fR\&.\|.\|. ]
#include <libcontract.h>

\fBint\fR \fBct_tmpl_activate\fR(\fBint\fR \fIfd\fR);
.fi

.LP
.nf
\fBint\fR \fBct_tmpl_clear\fR(\fBint\fR \fIfd\fR);
.fi

.LP
.nf
\fBint\fR \fBct_tmpl_create\fR(\fBint\fR \fIfd\fR, \fBctid_t *\fR\fIidp\fR);
.fi

.LP
.nf
\fBint\fR \fBct_tmpl_set_cookie\fR(\fBint\fR \fIfd\fR, \fBuint64_t\fR \fIcookie\fR);
.fi

.LP
.nf
\fBint\fR \fBct_tmpl_set_critical\fR(\fBint\fR \fIfd\fR, \fBuint_t\fR \fIevents\fR);
.fi

.LP
.nf
\fBint\fR \fBct_tmpl_set_informative\fR(\fBint\fR \fIfd\fR, \fBuint_t\fR \fIevents\fR);
.fi

.LP
.nf
\fBint\fR \fBct_tmpl_get_cookie\fR(\fBint\fR \fIfd\fR, \fBuint64_t *\fR\fIcookiep\fR);
.fi

.LP
.nf
\fBint\fR \fBct_tmpl_get_critical\fR(\fBint\fR \fIfd\fR, \fBuint_t *\fR\fIeventsp\fR);
.fi

.LP
.nf
\fBint\fR \fBct_tmpl_get_informative\fR(\fBint\fR \fIfd\fR, \fBuint_t *\fR\fIeventsp\fR);
.fi

.SH DESCRIPTION
.sp
.LP
These functions operate on contract template file descriptors obtained from the
\fBcontract\fR(4) file system.
.sp
.LP
The \fBct_tmpl_activate()\fR function makes the template referenced by the file
descriptor \fIfd\fR the active template for the calling thread.
.sp
.LP
The \fBct_tmpl_clear()\fR function clears calling thread's active template.
.sp
.LP
The \fBct_tmpl_create()\fR function uses the template referenced by the file
descriptor \fIfd\fR to create a new contract. If successful, the ID of the
newly created contract is placed in *\fIidp\fR.
.sp
.LP
The \fBct_tmpl_set_cookie()\fR and \fBct_tmpl_get_cookie()\fR functions write
and read the cookie term of a contract template. The cookie term is ignored by
the system, except to include its value in a resulting contract's status
object. The default cookie term is 0.
.sp
.LP
The \fBct_tmpl_set_critical()\fR and \fBct_tmpl_get_critical()\fR functions
write and read the critical event set term. The value is a collection of bits
as described in the contract type's manual page.
.sp
.LP
The \fBct_tmpl_set_informative()\fR and \fBct_tmpl_get_informative()\fR
functions write and read the informative event set term. The value is a
collection of bits as described in the contract type's manual page.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBct_tmpl_activate()\fR, \fBct_tmpl_create()\fR,
\fBct_tmpl_set_cookie()\fR, \fBct_tmpl_get_cookie()\fR,
\fBct_tmpl_set_critical()\fR, \fBct_tmpl_get_critical()\fR,
\fBct_tmpl_set_informative()\fR, and \fBct_tmpl_get_informative()\fR return 0.
Otherwise, they return a non-zero error value.
.SH ERRORS
.sp
.LP
The \fBct_tmpl_create()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBERANGE\fR\fR
.ad
.RS 10n
The terms specified in the template were unsatisfied at the time of the call.
.RE

.sp
.ne 2
.na
\fB\fBEAGAIN\fR\fR
.ad
.RS 10n
The \fIproject\fR.\fImax-contracts\fR resource control would have been
exceeded.
.RE

.sp
.LP
The \fBct_tmpl_set_critical()\fR and \fBct_tmpl_set_informative()\fR functions
will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
An invalid event was specified.
.RE

.sp
.LP
The \fBct_tmpl_set_critical()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEPERM\fR\fR
.ad
.RS 9n
One of the specified events was disallowed given other contract terms (see
\fBcontract\fR(4)) and {\fBPRIV_CONTRACT_EVENT\fR} was not in the effective set
for the calling process.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
_
MT-Level	Safe
.TE

.SH SEE ALSO
.sp
.LP
\fBlibcontract\fR(3LIB), \fBcontract\fR(4), \fBattributes\fR(5),
\fBlfcompile\fR(5)