Contract Management Library Functions
ctdevtmplsetaset(3CONTRACT)
NAME
ctdevtmplsetaset, ctdevtmplgetaset,
ctdevtmplsetminor, ctdevtmplgetminor,
ctdevtmplsetnoneg, ctdevtmplclearnoneg,
ctdevtmplgetnoneg - device contract template functions
SYNOPSIS
cc [ flag... ] file... -DLARGEFILE64SOURCE -lcontract [ library... ]
#include
#include
int ctdevtmplsetaset(int fd, uintt aset);
int ctdevtmplgetaset(int fd, uintt *asetp);
int ctdevtmplsetminor(int fd, char *minor);
int ctdevtmplgetminor(int fd, char *buf, sizet *buflenp);
int ctdevtmplsetnoneg(int fd);
int ctdevtmplclearnoneg(int fd);
int ctdevtmplgetnoneg(int fd, uintt *nonegp);
PARAMETERS
aset a bitset of one or more of device states
asetp a pointer to a variable into which the current
A-set is to be returned
buf a buffer into which the minor path is to be
returned
buflenp a pointer to variable of type sizet in which the
size of the buffer buf is passed in. If the
buffer is too small the size of the buffer needed
for a successful call is passed back to the
caller.
SunOS 5.11 Last change: 9 Aug 2007 1
Contract Management Library Functions
ctdevtmplsetaset(3CONTRACT)
fd a file descriptor from an open of the device con-
tract template file in the contract filesystem
(ctfs)
minor the devfs path (the /devices path without the
"/devices" prefix) of a minor which is to be the
subject of a contract
nonegp a pointer to a uintt variable for receiving the
current setting of the "nonnegotiable" term in
the template
DESCRIPTION
These functions read and write device contract terms and
operate on device contract template file descriptors
obtained from the contract(4) filesystem (ctfs).
The ctdevtmplsetaset() and ctdevtmplgetaset() func-
tions write and read the "acceptable states" set (or A-set
for short). This is the set of device states guaranteed by
the contract. Any departure from these states will result in
the breaking of the contract and a delivery of a critical
contract event to the contract holder. The A-set value is a
bitset of one or more of the following device states:
CTDEVEVONLINE, CTDEVEVDEGRADED, and CTDEVEVOFLINE.
The ctdevtmplsetminor() and ctdevtmplgetminor()
functions write and read the minor term (the device resource
that is to be the subject of the contract.) The value is a
devfs path to a device minor node (minus the "/devices" pre-
fix). For the ctdevtmplgetminor() function, a buffer at
least PATHMAX in size must be passed in. If the buffer is
smaller than PATHMAX, then the minimum size of the buffer
required (PATHMAX) for this function is passed back to the
caller via the buflenp argument.
The ctdevtmplsetnoneg() and ctdevtmplgetnoneg()
functions write and read the nonnegotiable term. If this
term is set, synchronous negotiation events are automati-
cally NACKed on behalf of the contract holder. For
ctdevtmplgetnoneg(), the variable pointed to by nonegp
is set to 1 if the "noneg" term is set or to 0 otherwise.
The ctdevtmplclearnoneg() term clears the nonnegotiable
term from a template.
SunOS 5.11 Last change: 9 Aug 2007 2
Contract Management Library Functions
ctdevtmplsetaset(3CONTRACT)
RETURN VALUES
Upon successful completion, these functions return 0. Other-
wise, they return a non-zero error value.
ERORS
The ctdevtmplsetaset() function will fail if:
EINVAL A template file descriptor or A-set is invalid
The ctdevtmplsetminor() function will fail if:
EINVAL One or more arguments is invalid.
ENXIO The minor named by minor path does not exist.
The ctdevtmplsetnoneg() function will fail if:
EPERM A process lacks sufficient privilege to NACK a dev-
ice state change.
The ctdevtmplgetaset() and ctdevtmplgetminor() func-
tions will fail if:
EINVAL One or more arguments is invalid.
ENOENT The requested term is not set.
The ctdevtmplgetnoneg() function will fail if:
EINVAL One or more arguments is invalid.
The ctdevtmplgetminor() function will fail if:
EOVEFLOW The supplied buffer is too small.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 9 Aug 2007 3
Contract Management Library Functions
ctdevtmplsetaset(3CONTRACT)
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
MT-Level Safe
SEE ALSO
libcontract(3LIB), contract(4), devices(4), attributes(5),
lfcompile(5)
SunOS 5.11 Last change: 9 Aug 2007 4
Contract Management Library Functions
ctdevtmplsetaset(3CONTRACT)
SunOS 5.11 Last change: 9 Aug 2007 5
|