Debian Codegraph @

third_party/rust/libc/src/unix/solarish/solaris.rs

raw
1 use crate::prelude::*;
2 use crate::{
3 exit_status, off_t, NET_MAC_AWARE, NET_MAC_AWARE_INHERIT, PRIV_AWARE_RESET, PRIV_DEBUG,
4 PRIV_PFEXEC, PRIV_XPOLICY,
5 };
6
7 pub type door_attr_t = c_uint;
8 pub type door_id_t = c_ulonglong;
9 pub type lgrp_affinity_t = c_uint;
10
11 e! {
12 #[repr(u32)]
13 pub enum lgrp_rsrc_t {
14 LGRP_RSRC_CPU = 0,
15 LGRP_RSRC_MEM = 1,
16 LGRP_RSRC_TYPES = 2,
17 }
18 }
19
20 s! {
21 pub struct aiocb {
22 pub aio_fildes: c_int,
23 pub aio_buf: *mut c_void,
24 pub aio_nbytes: size_t,
25 pub aio_offset: off_t,
26 pub aio_reqprio: c_int,
27 pub aio_sigevent: crate::sigevent,
28 pub aio_lio_opcode: c_int,
29 pub aio_resultp: crate::aio_result_t,
30 pub aio_state: c_char,
31 pub aio_returned: c_char,
32 pub aio__pad1: [c_char; 2],
33 pub aio_flags: c_int,
34 }
35
36 pub struct shmid_ds {
37 pub shm_perm: crate::ipc_perm,
38 pub shm_segsz: size_t,
39 pub shm_flags: crate::uintptr_t,
40 pub shm_lkcnt: c_ushort,
41 pub shm_lpid: crate::pid_t,
42 pub shm_cpid: crate::pid_t,
43 pub shm_nattch: crate::shmatt_t,
44 pub shm_cnattch: c_ulong,
45 pub shm_atime: crate::time_t,
46 pub shm_dtime: crate::time_t,
47 pub shm_ctime: crate::time_t,
48 pub shm_amp: *mut c_void,
49 pub shm_gransize: u64,
50 pub shm_allocated: u64,
51 pub shm_pad4: [i64; 1],
52 }
53
54 pub struct xrs_t {
55 pub xrs_id: c_ulong,
56 pub xrs_ptr: *mut c_char,
57 }
58 }
59
60 s_no_extra_traits! {
61 #[repr(packed)]
62 #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))]
63 pub struct door_desc_t__d_data__d_desc {
64 pub d_descriptor: c_int,
65 pub d_id: crate::door_id_t,
66 }
67
68 pub union door_desc_t__d_data {
69 pub d_desc: door_desc_t__d_data__d_desc,
70 d_resv: [c_int; 5], /* Check out /usr/include/sys/door.h */
71 }
72
73 #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))]
74 pub struct door_desc_t {
75 pub d_attributes: door_attr_t,
76 pub d_data: door_desc_t__d_data,
77 }
78
79 #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))]
80 pub struct door_arg_t {
81 pub data_ptr: *const c_char,
82 pub data_size: size_t,
83 pub desc_ptr: *const door_desc_t,
84 pub dec_num: c_uint,
85 pub rbuf: *const c_char,
86 pub rsize: size_t,
87 }
88
89 pub struct utmpx {
90 pub ut_user: [c_char; _UTMP_USER_LEN],
91 pub ut_id: [c_char; _UTMP_ID_LEN],
92 pub ut_line: [c_char; _UTMP_LINE_LEN],
93 pub ut_pid: crate::pid_t,
94 pub ut_type: c_short,
95 pub ut_exit: exit_status,
96 pub ut_tv: crate::timeval,
97 pub ut_session: c_int,
98 pub pad: [c_int; 5],
99 pub ut_syslen: c_short,
100 pub ut_host: [c_char; 257],
101 }
102 }
103
104 cfg_if! {
105 if #[cfg(feature = "extra_traits")] {
106 impl PartialEq for utmpx {
107 fn eq(&self, other: &utmpx) -> bool {
108 self.ut_type == other.ut_type
109 && self.ut_pid == other.ut_pid
110 && self.ut_user == other.ut_user
111 && self.ut_line == other.ut_line
112 && self.ut_id == other.ut_id
113 && self.ut_exit == other.ut_exit
114 && self.ut_session == other.ut_session
115 && self.ut_tv == other.ut_tv
116 && self.ut_syslen == other.ut_syslen
117 && self.pad == other.pad
118 && self
119 .ut_host
120 .iter()
121 .zip(other.ut_host.iter())
122 .all(|(a, b)| a == b)
123 }
124 }
125
126 impl Eq for utmpx {}
127
128 impl fmt::Debug for utmpx {
129 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
130 f.debug_struct("utmpx")
131 .field("ut_user", &self.ut_user)
132 .field("ut_id", &self.ut_id)
133 .field("ut_line", &self.ut_line)
134 .field("ut_pid", &self.ut_pid)
135 .field("ut_type", &self.ut_type)
136 .field("ut_exit", &self.ut_exit)
137 .field("ut_tv", &self.ut_tv)
138 .field("ut_session", &self.ut_session)
139 .field("pad", &self.pad)
140 .field("ut_syslen", &self.ut_syslen)
141 .field("ut_host", &&self.ut_host[..])
142 .finish()
143 }
144 }
145
146 impl hash::Hash for utmpx {
147 fn hash<H: hash::Hasher>(&self, state: &mut H) {
148 self.ut_user.hash(state);
149 self.ut_type.hash(state);
150 self.ut_pid.hash(state);
151 self.ut_line.hash(state);
152 self.ut_id.hash(state);
153 self.ut_host.hash(state);
154 self.ut_exit.hash(state);
155 self.ut_session.hash(state);
156 self.ut_tv.hash(state);
157 self.ut_syslen.hash(state);
158 self.pad.hash(state);
159 }
160 }
161 }
162 }
163
164 pub const _UTMP_USER_LEN: usize = 32;
165 pub const _UTMP_LINE_LEN: usize = 32;
166 pub const _UTMP_ID_LEN: usize = 4;
167
168 pub const PORT_SOURCE_POSTWAIT: c_int = 8;
169 pub const PORT_SOURCE_SIGNAL: c_int = 9;
170
171 pub const AF_LOCAL: c_int = 1; // AF_UNIX
172 pub const AF_FILE: c_int = 1; // AF_UNIX
173
174 pub const TCP_KEEPIDLE: c_int = 0x1d;
175 pub const TCP_KEEPINTVL: c_int = 0x1e;
176 pub const TCP_KEEPCNT: c_int = 0x1f;
177
178 pub const F_DUPFD_CLOEXEC: c_int = 47;
179 pub const F_DUPFD_CLOFORK: c_int = 49;
180 pub const F_DUP2FD_CLOEXEC: c_int = 48;
181 pub const F_DUP2FD_CLOFORK: c_int = 50;
182
183 pub const _PC_LAST: c_int = 102;
184
185 pub const PRIV_PROC_SENSITIVE: c_uint = 0x0008;
186 pub const PRIV_PFEXEC_AUTH: c_uint = 0x0200;
187 pub const PRIV_PROC_TPD: c_uint = 0x0400;
188 pub const PRIV_TPD_UNSAFE: c_uint = 0x0800;
189 pub const PRIV_PROC_TPD_RESET: c_uint = 0x1000;
190 pub const PRIV_TPD_KILLABLE: c_uint = 0x2000;
191
192 pub const POSIX_SPAWN_SETSID: c_short = 0x400;
193
194 pub const PRIV_USER: c_uint = PRIV_DEBUG
195 | PRIV_PROC_SENSITIVE
196 | NET_MAC_AWARE
197 | NET_MAC_AWARE_INHERIT
198 | PRIV_XPOLICY
199 | PRIV_AWARE_RESET
200 | PRIV_PFEXEC
201 | PRIV_PFEXEC_AUTH
202 | PRIV_PROC_TPD
203 | PRIV_TPD_UNSAFE
204 | PRIV_TPD_KILLABLE
205 | PRIV_PROC_TPD_RESET;
206
207 extern "C" {
208 // DIFF(main): changed to `*const *mut` in e77f551de9
209 pub fn fexecve(fd: c_int, argv: *const *const c_char, envp: *const *const c_char) -> c_int;
210
211 pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_char) -> c_int;
212
213 pub fn door_call(d: c_int, params: *mut door_arg_t) -> c_int;
214 pub fn door_return(
215 data_ptr: *mut c_char,
216 data_size: size_t,
217 desc_ptr: *mut door_desc_t,
218 num_desc: c_uint,
219 ) -> c_int;
220 pub fn door_create(
221 server_procedure: extern "C" fn(
222 cookie: *mut c_void,
223 argp: *mut c_char,
224 arg_size: size_t,
225 dp: *mut door_desc_t,
226 n_desc: c_uint,
227 ),
228 cookie: *mut c_void,
229 attributes: door_attr_t,
230 ) -> c_int;
231
232 pub fn fattach(fildes: c_int, path: *const c_char) -> c_int;
233
234 pub fn pthread_getattr_np(thread: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int;
235
236 pub fn euidaccess(path: *const c_char, amode: c_int) -> c_int;
237 }