1ct_dev_status_get_dev_Csotnattrea(c3tCOMNaTnRaAgCeTm)entcLti_bdreavr_ystFautnucst_igoents_dev_state(3CONTRACT)
2
3
4
6 ct_dev_status_get_dev_state, ct_dev_status_get_aset, ct_dev_sta‐
7 tus_get_minor, ct_dev_status_get_noneg - read contract status informa‐
8 tion from a status object
9
11 cc [ flag... ] file... -D_LARGEFILE64_SOURCE -lcontract [ library... ]
12 #include <libcontract.h>
13 #include <sys/contract/device.h>
14
15 int ct_dev_status_get_dev_state(ct_stathdl_t stathdl,
16 uint_t *statep);
17
18
19 int ct_dev_status_get_aset(ct_stathdl_t stathdl,
20 uint_t *asetp);
21
22
23 int ct_dev_status_get_minor(ct_stathdl_t stathdl, char *buf,
24 size_t *buflenp);
25
26
27 int ct_dev_status_get_noneg(ct_stathdl_t stathdl,
28 uint_t *nonegp);
29
30
32 asetp a pointer to a uint_t variable for receiving the acceptable
33 state set (such as A-set) for the contract
34
35
36 buf a buffer for receiving the devfs path of a minor in a con‐
37 tract
38
39
40 buflenp a pointer to a variable of type size_t for passing the size
41 of the buffer buf. If the buffer is too small (< PATH_MAX),
42 the minimum size of the buffer needed (PATH_MAX) is passed
43 back to the caller with this argument.
44
45
46 nonegp a pointer to a uint_t variable for receiving the setting of
47 the "noneg" term
48
49
50 stathdl a status object returned by ct_status_read(3CONTRACT)
51
52
53 statep a pointer to a uint_t variable for receiving the current
54 state of the device which is the subject of the contract
55
56
58 These functions read contract status information from a status object
59 stathdl returned by ct_status_read(). The detail level in the call to
60 ct_status_read() needs to be at least CTD_FIXED for the following calls
61 to be successful. The one exception is ct_dev_status_get_minor(), which
62 requires a detail level of CTD_ALL.
63
64
65 The ct_dev_status_get_dev_state() function returns the current state of
66 the device which is the subject of the contract. This can be one of the
67 following:
68
69 CT_DEV_EV_ONLINE The device is online and functioning normally.
70
71
72 CT_DEV_EV_DEGRADED The device is online but degraded.
73
74
75 CT_DEV_EV_OFFLINE The device is offline and not configured.
76
77
78
79 The ct_dev_status_get_aset() function returns the A-set of the con‐
80 tract. This can be the bitset of one or more of the following states:
81 CT_DEV_EV_ONLINE, CT_DEV_EV_DEGRADED, or CT_DEV_EV_OFFLINE.
82
83
84 The ct_dev_status_get_minor() function reads the devfs path of the
85 minor participating in the contract. The devfs path returned does not
86 include the /devices prefix. If the buffer passed in by the caller is
87 too small (< PATH_MAX), the minimum size of the buffer required (
88 PATH_MAX) is returned to the caller via the buflenp argument.
89
90
91 The ct_dev_status_get_noneg() function returns the "noneg" setting for
92 the contract. A value of 1 is returned in the nonegp argument if NONEG
93 is set, else 0 is returned.
94
96 Upon successful completion, these functions return 0. Otherwise, they
97 return a non-zero error value.
98
100 The ct_dev_status_get_minor() function will fail if:
101
102 EOVERFLOW The buffer size is too small to hold the result.
103
104
105
106 The ct_dev_status_get_dev_state(), ct_dev_status_get_aset(),
107 ct_dev_status_get_minor() and ct_dev_status_get_noneg() functions will
108 fail if:
109
110 EINVAL An invalid argument was specified.
111
112
113 ENOENT The requested data is not present in the status object.
114
115
117 See attributes(5) for descriptions of the following attributes:
118
119
120
121
122 ┌─────────────────────────────┬─────────────────────────────┐
123 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
124 ├─────────────────────────────┼─────────────────────────────┤
125 │Interface Stability │Committed │
126 ├─────────────────────────────┼─────────────────────────────┤
127 │MT-Level │Safe │
128 └─────────────────────────────┴─────────────────────────────┘
129
131 ct_status_free(3CONTRACT), ct_status_read(3CONTRACT), libcon‐
132 tract(3LIB), contract(4), devices(4), attributes(5), lfcompile(5)
133
134
135
136SunOS 5.11 9 Aug 2c0t0_7dev_status_get_dev_state(3CONTRACT)