1ct_dev_tmpl_set_aset(3CCoOnNtTrRaAcCtT)Management LibraryctF_udnecvt_itomnpsl_set_aset(3CONTRACT)
2
3
4

NAME

6       ct_dev_tmpl_set_aset,    ct_dev_tmpl_get_aset,   ct_dev_tmpl_set_minor,
7       ct_dev_tmpl_get_minor, ct_dev_tmpl_set_noneg,  ct_dev_tmpl_clear_noneg,
8       ct_dev_tmpl_get_noneg - device contract template functions
9

SYNOPSIS

11       cc [ flag... ] file... -D_LARGEFILE64_SOURCE  -lcontract  [ library... ]
12       #include <libcontract.h>
13       #include <sys/contract/device.h>
14
15       int ct_dev_tmpl_set_aset(int fd, uint_t aset);
16
17
18       int ct_dev_tmpl_get_aset(int fd, uint_t *asetp);
19
20
21       int ct_dev_tmpl_set_minor(int fd, char *minor);
22
23
24       int ct_dev_tmpl_get_minor(int fd, char *buf, size_t *buflenp);
25
26
27       int ct_dev_tmpl_set_noneg(int fd);
28
29
30       int ct_dev_tmpl_clear_noneg(int fd);
31
32
33       int ct_dev_tmpl_get_noneg(int fd, uint_t *nonegp);
34
35

PARAMETERS

37       aset       a bitset of one or more of device states
38
39
40       asetp      a  pointer  to a variable into which the current A-set is to
41                  be returned
42
43
44       buf        a buffer into which the minor path is to be returned
45
46
47       buflenp    a pointer to variable of type size_t in which  the  size  of
48                  the  buffer buf is passed in. If the buffer is too small the
49                  size of the buffer needed for a successful  call  is  passed
50                  back to the caller.
51
52
53       fd         a  file  descriptor from an open of the device contract tem‐
54                  plate file in the contract filesystem (ctfs)
55
56
57       minor      the devfs path (the /devices  path  without  the  "/devices"
58                  prefix) of a minor which is to be the subject of a contract
59
60
61       nonegp     a  pointer  to  a  uint_t variable for receiving the current
62                  setting of the "nonnegotiable" term in the template
63
64

DESCRIPTION

66       These functions read and write device contract  terms  and  operate  on
67       device contract template file descriptors obtained from the contract(4)
68       filesystem (ctfs).
69
70
71       The ct_dev_tmpl_set_aset() and ct_dev_tmpl_get_aset()  functions  write
72       and read the "acceptable states" set (or A-set for short).  This is the
73       set of device states guaranteed by the  contract.  Any  departure  from
74       these states will result in the breaking of the contract and a delivery
75       of a critical contract event to the contract holder. The A-set value is
76       a   bitset   of   one   or   more   of  the  following  device  states:
77       CT_DEV_EV_ONLINE, CT_DEV_EV_DEGRADED, and CT_DEV_EV_OFFLINE.
78
79
80       The ct_dev_tmpl_set_minor() and ct_dev_tmpl_get_minor() functions write
81       and  read the minor term (the device resource that is to be the subject
82       of the contract.) The value is a devfs path  to  a  device  minor  node
83       (minus  the  "/devices"  prefix). For the ct_dev_tmpl_get_minor() func‐
84       tion, a buffer at least PATH_MAX in size must be passed in. If the buf‐
85       fer  is  smaller  than  PATH_MAX,  then  the minimum size of the buffer
86       required (PATH_MAX) for this function is passed back to the caller  via
87       the buflenp argument.
88
89
90       The ct_dev_tmpl_set_noneg() and ct_dev_tmpl_get_noneg() functions write
91       and read the nonnegotiable term. If this term is set, synchronous nego‐
92       tiation  events  are  automatically  NACKed  on  behalf of the contract
93       holder. For ct_dev_tmpl_get_noneg(), the variable pointed to by  nonegp
94       is  set  to  1  if  the  "noneg"  term  is  set or to 0 otherwise.  The
95       ct_dev_tmpl_clear_noneg() term clears the  nonnegotiable  term  from  a
96       template.
97

RETURN VALUES

99       Upon  successful  completion, these functions return 0. Otherwise, they
100       return a non-zero error value.
101

ERRORS

103       The ct_dev_tmpl_set_aset() function will fail if:
104
105       EINVAL    A template file descriptor or A-set is invalid
106
107
108
109       The ct_dev_tmpl_set_minor() function will fail if:
110
111       EINVAL    One or more arguments is invalid.
112
113
114       ENXIO     The minor named by minor path does not exist.
115
116
117
118       The ct_dev_tmpl_set_noneg() function will fail if:
119
120       EPERM    A process lacks sufficient privilege to NACK  a  device  state
121                change.
122
123
124
125       The  ct_dev_tmpl_get_aset()  and ct_dev_tmpl_get_minor() functions will
126       fail if:
127
128       EINVAL    One or more arguments is invalid.
129
130
131       ENOENT    The requested term is not set.
132
133
134
135       The ct_dev_tmpl_get_noneg() function will fail if:
136
137       EINVAL    One or more arguments is invalid.
138
139
140
141       The ct_dev_tmpl_get_minor() function will fail if:
142
143       EOVEFLOW    The supplied buffer is too small.
144
145

ATTRIBUTES

147       See attributes(5) for descriptions of the following attributes:
148
149
150
151
152       ┌─────────────────────────────┬─────────────────────────────┐
153       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
154       ├─────────────────────────────┼─────────────────────────────┤
155       │Interface Stability          │Committed                    │
156       ├─────────────────────────────┼─────────────────────────────┤
157       │MT-Level                     │Safe                         │
158       └─────────────────────────────┴─────────────────────────────┘
159

SEE ALSO

161       libcontract(3LIB), contract(4), devices(4), attributes(5), lfcompile(5)
162
163
164
165SunOS 5.11                        9 Aug 2007   ct_dev_tmpl_set_aset(3CONTRACT)
Impressum