Debian Codegraph @

debian/missing-sources/libc/src/unix/solarish/illumos.rs

raw
1 use crate::prelude::*;
2 use crate::{
3 exit_status,
4 off_t,
5 NET_MAC_AWARE,
6 NET_MAC_AWARE_INHERIT,
7 PRIV_AWARE_RESET,
8 PRIV_DEBUG,
9 PRIV_PFEXEC,
10 PRIV_XPOLICY,
11 };
12
13 pub type lgrp_rsrc_t = c_int;
14 pub type lgrp_affinity_t = c_int;
15
16 s! {
17 pub struct aiocb {
18 pub aio_fildes: c_int,
19 pub aio_buf: *mut c_void,
20 pub aio_nbytes: size_t,
21 pub aio_offset: off_t,
22 pub aio_reqprio: c_int,
23 pub aio_sigevent: crate::sigevent,
24 pub aio_lio_opcode: c_int,
25 pub aio_resultp: crate::aio_result_t,
26 pub aio_state: c_int,
27 pub aio__pad: [c_int; 1],
28 }
29
30 pub struct shmid_ds {
31 pub shm_perm: crate::ipc_perm,
32 pub shm_segsz: size_t,
33 pub shm_amp: *mut c_void,
34 pub shm_lkcnt: c_ushort,
35 pub shm_lpid: crate::pid_t,
36 pub shm_cpid: crate::pid_t,
37 pub shm_nattch: crate::shmatt_t,
38 pub shm_cnattch: c_ulong,
39 pub shm_atime: crate::time_t,
40 pub shm_dtime: crate::time_t,
41 pub shm_ctime: crate::time_t,
42 pub shm_pad4: [i64; 4],
43 }
44
45 pub struct fil_info {
46 pub fi_flags: c_int,
47 pub fi_pos: c_int,
48 pub fi_name: [c_char; crate::FILNAME_MAX as usize],
49 }
50
51 #[cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), repr(packed(4)))]
52 pub struct epoll_event {
53 pub events: u32,
54 pub u64: u64,
55 }
56
57 pub struct utmpx {
58 pub ut_user: [c_char; _UTX_USERSIZE],
59 pub ut_id: [c_char; _UTX_IDSIZE],
60 pub ut_line: [c_char; _UTX_LINESIZE],
61 pub ut_pid: crate::pid_t,
62 pub ut_type: c_short,
63 pub ut_exit: exit_status,
64 pub ut_tv: crate::timeval,
65 pub ut_session: c_int,
66 pub ut_pad: [c_int; _UTX_PADSIZE],
67 pub ut_syslen: c_short,
68 pub ut_host: [c_char; _UTX_HOSTSIZE],
69 }
70 }
71
72 pub const _UTX_USERSIZE: usize = 32;
73 pub const _UTX_LINESIZE: usize = 32;
74 pub const _UTX_PADSIZE: usize = 5;
75 pub const _UTX_IDSIZE: usize = 4;
76 pub const _UTX_HOSTSIZE: usize = 257;
77
78 pub const AF_LOCAL: c_int = 1; // AF_UNIX
79 pub const AF_FILE: c_int = 1; // AF_UNIX
80
81 pub const EFD_SEMAPHORE: c_int = 0x1;
82 pub const EFD_NONBLOCK: c_int = 0x800;
83 pub const EFD_CLOEXEC: c_int = 0x80000;
84
85 pub const POLLRDHUP: c_short = 0x4000;
86
87 pub const TCP_KEEPIDLE: c_int = 34;
88 pub const TCP_KEEPCNT: c_int = 35;
89 pub const TCP_KEEPINTVL: c_int = 36;
90 pub const TCP_CONGESTION: c_int = 37;
91
92 // These constants are correct for 64-bit programs or 32-bit programs that are
93 // not using large-file mode. If Rust ever supports anything other than 64-bit
94 // compilation on illumos, this may require adjustment:
95 pub const F_OFD_GETLK: c_int = 47;
96 pub const F_OFD_SETLK: c_int = 48;
97 pub const F_OFD_SETLKW: c_int = 49;
98 pub const F_FLOCK: c_int = 53;
99 pub const F_FLOCKW: c_int = 54;
100
101 pub const F_DUPFD_CLOEXEC: c_int = 37;
102 pub const F_DUPFD_CLOFORK: c_int = 58;
103 pub const F_DUP2FD_CLOEXEC: c_int = 36;
104 pub const F_DUP2FD_CLOFORK: c_int = 57;
105 pub const F_DUP3FD: c_int = 59;
106
107 pub const FD_CLOFORK: c_int = 2;
108
109 pub const FIL_ATTACH: c_int = 0x1;
110 pub const FIL_DETACH: c_int = 0x2;
111 pub const FIL_LIST: c_int = 0x3;
112 pub const FILNAME_MAX: c_int = 32;
113 pub const FILF_PROG: c_int = 0x1;
114 pub const FILF_AUTO: c_int = 0x2;
115 pub const FILF_BYPASS: c_int = 0x4;
116 pub const SOL_FILTER: c_int = 0xfffc;
117
118 pub const MADV_PURGE: c_int = 9;
119
120 pub const POSIX_FADV_NORMAL: c_int = 0;
121 pub const POSIX_FADV_RANDOM: c_int = 1;
122 pub const POSIX_FADV_SEQUENTIAL: c_int = 2;
123 pub const POSIX_FADV_WILLNEED: c_int = 3;
124 pub const POSIX_FADV_DONTNEED: c_int = 4;
125 pub const POSIX_FADV_NOREUSE: c_int = 5;
126
127 pub const POSIX_SPAWN_SETSID: c_short = 0x40;
128
129 pub const SIGINFO: c_int = 41;
130
131 pub const O_DIRECT: c_int = 0x2000000;
132 pub const O_CLOFORK: c_int = 0x4000000;
133
134 pub const MSG_CMSG_CLOEXEC: c_int = 0x1000;
135 pub const MSG_CMSG_CLOFORK: c_int = 0x2000;
136
137 pub const PBIND_HARD: crate::processorid_t = -3;
138 pub const PBIND_SOFT: crate::processorid_t = -4;
139
140 pub const PS_SYSTEM: c_int = 1;
141
142 pub const MAP_FILE: c_int = 0;
143
144 pub const MAP_32BIT: c_int = 0x80;
145
146 pub const AF_NCA: c_int = 28;
147
148 pub const PF_NCA: c_int = AF_NCA;
149
150 pub const LOCK_SH: c_int = 1;
151 pub const LOCK_EX: c_int = 2;
152 pub const LOCK_NB: c_int = 4;
153 pub const LOCK_UN: c_int = 8;
154
155 pub const _PC_LAST: c_int = 101;
156
157 pub const VSTATUS: usize = 16;
158 pub const VERASE2: usize = 17;
159
160 pub const EPOLLIN: c_int = 0x1;
161 pub const EPOLLPRI: c_int = 0x2;
162 pub const EPOLLOUT: c_int = 0x4;
163 pub const EPOLLRDNORM: c_int = 0x40;
164 pub const EPOLLRDBAND: c_int = 0x80;
165 pub const EPOLLWRNORM: c_int = 0x100;
166 pub const EPOLLWRBAND: c_int = 0x200;
167 pub const EPOLLMSG: c_int = 0x400;
168 pub const EPOLLERR: c_int = 0x8;
169 pub const EPOLLHUP: c_int = 0x10;
170 pub const EPOLLET: c_int = 0x80000000;
171 pub const EPOLLRDHUP: c_int = 0x2000;
172 pub const EPOLLONESHOT: c_int = 0x40000000;
173 pub const EPOLLWAKEUP: c_int = 0x20000000;
174 pub const EPOLLEXCLUSIVE: c_int = 0x10000000;
175 pub const EPOLL_CLOEXEC: c_int = 0x80000;
176 pub const EPOLL_CTL_ADD: c_int = 1;
177 pub const EPOLL_CTL_MOD: c_int = 3;
178 pub const EPOLL_CTL_DEL: c_int = 2;
179
180 pub const PRIV_USER: c_uint = PRIV_DEBUG
181 | NET_MAC_AWARE
182 | NET_MAC_AWARE_INHERIT
183 | PRIV_XPOLICY
184 | PRIV_AWARE_RESET
185 | PRIV_PFEXEC;
186
187 pub const LGRP_RSRC_COUNT: crate::lgrp_rsrc_t = 2;
188 pub const LGRP_RSRC_CPU: crate::lgrp_rsrc_t = 0;
189 pub const LGRP_RSRC_MEM: crate::lgrp_rsrc_t = 1;
190
191 pub const P_DISABLED: c_int = 0x008;
192
193 pub const AT_SUN_HWCAP2: c_uint = 2023;
194 pub const AT_SUN_FPTYPE: c_uint = 2027;
195
196 pub const B1000000: crate::speed_t = 24;
197 pub const B1152000: crate::speed_t = 25;
198 pub const B1500000: crate::speed_t = 26;
199 pub const B2000000: crate::speed_t = 27;
200 pub const B2500000: crate::speed_t = 28;
201 pub const B3000000: crate::speed_t = 29;
202 pub const B3500000: crate::speed_t = 30;
203 pub const B4000000: crate::speed_t = 31;
204
205 // sys/systeminfo.h
206 pub const SI_ADDRESS_WIDTH: c_int = 520;
207
208 // sys/timerfd.h
209 pub const TFD_CLOEXEC: i32 = 0o2000000;
210 pub const TFD_NONBLOCK: i32 = 0o4000;
211 pub const TFD_TIMER_ABSTIME: i32 = 1 << 0;
212 pub const TFD_TIMER_CANCEL_ON_SET: i32 = 1 << 1;
213
214 extern "C" {
215 pub fn eventfd(initval: c_uint, flags: c_int) -> c_int;
216
217 pub fn epoll_pwait(
218 epfd: c_int,
219 events: *mut crate::epoll_event,
220 maxevents: c_int,
221 timeout: c_int,
222 sigmask: *const crate::sigset_t,
223 ) -> c_int;
224 pub fn epoll_create(size: c_int) -> c_int;
225 pub fn epoll_create1(flags: c_int) -> c_int;
226 pub fn epoll_wait(
227 epfd: c_int,
228 events: *mut crate::epoll_event,
229 maxevents: c_int,
230 timeout: c_int,
231 ) -> c_int;
232 pub fn epoll_ctl(epfd: c_int, op: c_int, fd: c_int, event: *mut crate::epoll_event) -> c_int;
233
234 pub fn mincore(addr: crate::caddr_t, len: size_t, vec: *mut c_char) -> c_int;
235
236 pub fn pset_bind_lwp(
237 pset: crate::psetid_t,
238 id: crate::id_t,
239 pid: crate::pid_t,
240 opset: *mut crate::psetid_t,
241 ) -> c_int;
242 pub fn pset_getloadavg(pset: crate::psetid_t, load: *mut c_double, num: c_int) -> c_int;
243
244 pub fn pthread_attr_get_np(thread: crate::pthread_t, attr: *mut crate::pthread_attr_t)
245 -> c_int;
246 pub fn pthread_attr_getstackaddr(
247 attr: *const crate::pthread_attr_t,
248 stackaddr: *mut *mut c_void,
249 ) -> c_int;
250 pub fn pthread_attr_setstack(
251 attr: *mut crate::pthread_attr_t,
252 stackaddr: *mut c_void,
253 stacksize: size_t,
254 ) -> c_int;
255 pub fn pthread_attr_setstackaddr(
256 attr: *mut crate::pthread_attr_t,
257 stackaddr: *mut c_void,
258 ) -> c_int;
259
260 pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advice: c_int) -> c_int;
261 pub fn preadv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
262 pub fn pwritev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
263 pub fn getpagesizes2(pagesize: *mut size_t, nelem: c_int) -> c_int;
264
265 pub fn posix_spawn_file_actions_addfchdir_np(
266 file_actions: *mut crate::posix_spawn_file_actions_t,
267 fd: c_int,
268 ) -> c_int;
269
270 pub fn ptsname_r(fildes: c_int, name: *mut c_char, namelen: size_t) -> c_int;
271
272 pub fn syncfs(fd: c_int) -> c_int;
273
274 pub fn strcasecmp_l(s1: *const c_char, s2: *const c_char, loc: crate::locale_t) -> c_int;
275 pub fn strncasecmp_l(
276 s1: *const c_char,
277 s2: *const c_char,
278 n: size_t,
279 loc: crate::locale_t,
280 ) -> c_int;
281
282 pub fn timerfd_create(clockid: c_int, flags: c_int) -> c_int;
283 pub fn timerfd_gettime(fd: c_int, curr_value: *mut crate::itimerspec) -> c_int;
284 pub fn timerfd_settime(
285 fd: c_int,
286 flags: c_int,
287 new_value: *const crate::itimerspec,
288 old_value: *mut crate::itimerspec,
289 ) -> c_int;
290 }