Debian Codegraph @

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

raw
1 use crate::prelude::*;
2 use crate::{
3 exit_status,
4 off_t,
5 termios,
6 NET_MAC_AWARE,
7 NET_MAC_AWARE_INHERIT,
8 PRIV_AWARE_RESET,
9 PRIV_DEBUG,
10 PRIV_PFEXEC,
11 PRIV_XPOLICY,
12 };
13
14 pub type door_attr_t = c_uint;
15 pub type door_id_t = c_ulonglong;
16 pub type lgrp_affinity_t = c_uint;
17
18 e! {
19 #[repr(u32)]
20 pub enum lgrp_rsrc_t {
21 LGRP_RSRC_CPU = 0,
22 LGRP_RSRC_MEM = 1,
23 LGRP_RSRC_TYPES = 2,
24 }
25 }
26
27 s! {
28 pub struct aiocb {
29 pub aio_fildes: c_int,
30 pub aio_buf: *mut c_void,
31 pub aio_nbytes: size_t,
32 pub aio_offset: off_t,
33 pub aio_reqprio: c_int,
34 pub aio_sigevent: crate::sigevent,
35 pub aio_lio_opcode: c_int,
36 pub aio_resultp: crate::aio_result_t,
37 pub aio_state: c_char,
38 pub aio_returned: c_char,
39 pub aio__pad1: [c_char; 2],
40 pub aio_flags: c_int,
41 }
42
43 pub struct shmid_ds {
44 pub shm_perm: crate::ipc_perm,
45 pub shm_segsz: size_t,
46 pub shm_flags: crate::uintptr_t,
47 pub shm_lkcnt: c_ushort,
48 pub shm_lpid: crate::pid_t,
49 pub shm_cpid: crate::pid_t,
50 pub shm_nattch: crate::shmatt_t,
51 pub shm_cnattch: c_ulong,
52 pub shm_atime: crate::time_t,
53 pub shm_dtime: crate::time_t,
54 pub shm_ctime: crate::time_t,
55 pub shm_amp: *mut c_void,
56 pub shm_gransize: u64,
57 pub shm_allocated: u64,
58 pub shm_pad4: [i64; 1],
59 }
60
61 pub struct xrs_t {
62 pub xrs_id: c_ulong,
63 pub xrs_ptr: *mut c_char,
64 }
65
66 pub struct utmpx {
67 pub ut_user: [c_char; _UTMP_USER_LEN],
68 pub ut_id: [c_char; _UTMP_ID_LEN],
69 pub ut_line: [c_char; _UTMP_LINE_LEN],
70 pub ut_pid: crate::pid_t,
71 pub ut_type: c_short,
72 pub ut_exit: exit_status,
73 pub ut_tv: crate::timeval,
74 pub ut_session: c_int,
75 pub pad: [c_int; 5],
76 pub ut_syslen: c_short,
77 pub ut_host: [c_char; 257],
78 }
79 }
80
81 s_no_extra_traits! {
82 #[repr(packed)]
83 pub struct door_desc_t__d_data__d_desc {
84 pub d_descriptor: c_int,
85 pub d_id: crate::door_id_t,
86 }
87
88 pub union door_desc_t__d_data {
89 pub d_desc: door_desc_t__d_data__d_desc,
90 d_resv: [c_int; 5], /* Check out /usr/include/sys/door.h */
91 }
92
93 pub struct door_desc_t {
94 pub d_attributes: door_attr_t,
95 pub d_data: door_desc_t__d_data,
96 }
97
98 pub struct door_arg_t {
99 pub data_ptr: *const c_char,
100 pub data_size: size_t,
101 pub desc_ptr: *const door_desc_t,
102 pub dec_num: c_uint,
103 pub rbuf: *const c_char,
104 pub rsize: size_t,
105 }
106 }
107
108 // FIXME(solaris): O_DIRECT and SIGINFO are NOT available on Solaris.
109 // But in past they were defined here and thus other crates expected them.
110 // Latest version v0.29.0 of Nix crate still expects this. Since last
111 // version of Nix crate is almost one year ago let's define these two
112 // temporarily before new Nix version is released.
113 pub const O_DIRECT: c_int = 0x2000000;
114 pub const SIGINFO: c_int = 41;
115
116 pub const _UTMP_USER_LEN: usize = 32;
117 pub const _UTMP_LINE_LEN: usize = 32;
118 pub const _UTMP_ID_LEN: usize = 4;
119
120 pub const PORT_SOURCE_POSTWAIT: c_int = 8;
121 pub const PORT_SOURCE_SIGNAL: c_int = 9;
122
123 pub const AF_LOCAL: c_int = 1; // AF_UNIX
124 pub const AF_FILE: c_int = 1; // AF_UNIX
125
126 pub const TCP_KEEPIDLE: c_int = 0x1d;
127 pub const TCP_KEEPINTVL: c_int = 0x1e;
128 pub const TCP_KEEPCNT: c_int = 0x1f;
129
130 pub const F_DUPFD_CLOEXEC: c_int = 47;
131 pub const F_DUPFD_CLOFORK: c_int = 49;
132 pub const F_DUP2FD_CLOEXEC: c_int = 48;
133 pub const F_DUP2FD_CLOFORK: c_int = 50;
134
135 pub const _PC_LAST: c_int = 102;
136
137 pub const PRIV_PROC_SENSITIVE: c_uint = 0x0008;
138 pub const PRIV_PFEXEC_AUTH: c_uint = 0x0200;
139 pub const PRIV_PROC_TPD: c_uint = 0x0400;
140 pub const PRIV_TPD_UNSAFE: c_uint = 0x0800;
141 pub const PRIV_PROC_TPD_RESET: c_uint = 0x1000;
142 pub const PRIV_TPD_KILLABLE: c_uint = 0x2000;
143
144 pub const POSIX_SPAWN_SETSID: c_short = 0x400;
145
146 pub const PRIV_USER: c_uint = PRIV_DEBUG
147 | PRIV_PROC_SENSITIVE
148 | NET_MAC_AWARE
149 | NET_MAC_AWARE_INHERIT
150 | PRIV_XPOLICY
151 | PRIV_AWARE_RESET
152 | PRIV_PFEXEC
153 | PRIV_PFEXEC_AUTH
154 | PRIV_PROC_TPD
155 | PRIV_TPD_UNSAFE
156 | PRIV_TPD_KILLABLE
157 | PRIV_PROC_TPD_RESET;
158
159 extern "C" {
160 // DIFF(main): changed to `*const *mut` in e77f551de9
161 pub fn fexecve(fd: c_int, argv: *const *const c_char, envp: *const *const c_char) -> c_int;
162
163 pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_char) -> c_int;
164
165 pub fn door_call(d: c_int, params: *mut door_arg_t) -> c_int;
166 pub fn door_return(
167 data_ptr: *mut c_char,
168 data_size: size_t,
169 desc_ptr: *mut door_desc_t,
170 num_desc: c_uint,
171 ) -> c_int;
172 pub fn door_create(
173 server_procedure: extern "C" fn(
174 cookie: *mut c_void,
175 argp: *mut c_char,
176 arg_size: size_t,
177 dp: *mut door_desc_t,
178 n_desc: c_uint,
179 ),
180 cookie: *mut c_void,
181 attributes: door_attr_t,
182 ) -> c_int;
183
184 pub fn fattach(fildes: c_int, path: *const c_char) -> c_int;
185
186 pub fn pthread_getattr_np(thread: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int;
187
188 pub fn euidaccess(path: *const c_char, amode: c_int) -> c_int;
189
190 pub fn openpty(
191 amain: *mut c_int,
192 asubord: *mut c_int,
193 name: *mut c_char,
194 termp: *mut termios,
195 winp: *mut crate::winsize,
196 ) -> c_int;
197
198 pub fn forkpty(
199 amain: *mut c_int,
200 name: *mut c_char,
201 termp: *mut termios,
202 winp: *mut crate::winsize,
203 ) -> crate::pid_t;
204 }