Current File : //usr/share/man/man3contract/ct_tmpl_activate.3contract
'\" te
.\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
.TH ct_tmpl_activate 3CONTRACT "1 Apr 2004" "SunOS 5.11" "Contract Management Library Functions"
.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
.mk
.na
\fB\fBERANGE\fR\fR
.ad
.RS 10n
.rt  
The terms specified in the template were unsatisfied at the time of the call.
.RE

.sp
.ne 2
.mk
.na
\fB\fBEAGAIN\fR\fR
.ad
.RS 10n
.rt  
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
.mk
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
.rt  
An invalid event was specified.
.RE

.sp
.LP
The \fBct_tmpl_set_critical()\fR function will fail if:
.sp
.ne 2
.mk
.na
\fB\fBEPERM\fR\fR
.ad
.RS 9n
.rt  
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
tab() box;
cw(2.75i) |cw(2.75i) 
lw(2.75i) |lw(2.75i) 
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Interface StabilityCommitted
_
MT-LevelSafe
.TE

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