]> git.proxmox.com Git - rustc.git/blame - src/liblibc/src/unix/notbsd/linux/musl/mod.rs
New upstream version 1.32.0+dfsg1
[rustc.git] / src / liblibc / src / unix / notbsd / linux / musl / mod.rs
CommitLineData
7453a54e
SL
1pub type clock_t = c_long;
2pub type time_t = c_long;
3pub type suseconds_t = c_long;
4pub type ino_t = u64;
5pub type off_t = i64;
6pub type blkcnt_t = i64;
7
abe05a73
XL
8pub type shmatt_t = ::c_ulong;
9pub type msgqnum_t = ::c_ulong;
10pub type msglen_t = ::c_ulong;
7453a54e
SL
11pub type fsblkcnt_t = ::c_ulonglong;
12pub type fsfilcnt_t = ::c_ulonglong;
13pub type rlim_t = ::c_ulonglong;
14
15s! {
476ff2be
SL
16 pub struct aiocb {
17 pub aio_fildes: ::c_int,
18 pub aio_lio_opcode: ::c_int,
19 pub aio_reqprio: ::c_int,
20 pub aio_buf: *mut ::c_void,
21 pub aio_nbytes: ::size_t,
22 pub aio_sigevent: ::sigevent,
23 __td: *mut ::c_void,
24 __lock: [::c_int; 2],
25 __err: ::c_int,
26 __ret: ::ssize_t,
27 pub aio_offset: off_t,
28 __next: *mut ::c_void,
29 __prev: *mut ::c_void,
30 #[cfg(target_pointer_width = "32")]
31 __dummy4: [::c_char; 24],
32 #[cfg(target_pointer_width = "64")]
33 __dummy4: [::c_char; 16],
34 }
35
7453a54e
SL
36 pub struct sigaction {
37 pub sa_sigaction: ::sighandler_t,
38 pub sa_mask: ::sigset_t,
39 pub sa_flags: ::c_int,
7cac9316 40 pub sa_restorer: ::dox::Option<extern fn()>,
7453a54e
SL
41 }
42
8faf50e0
XL
43 pub struct statvfs {
44 pub f_bsize: ::c_ulong,
45 pub f_frsize: ::c_ulong,
46 pub f_blocks: ::fsblkcnt_t,
47 pub f_bfree: ::fsblkcnt_t,
48 pub f_bavail: ::fsblkcnt_t,
49 pub f_files: ::fsfilcnt_t,
50 pub f_ffree: ::fsfilcnt_t,
51 pub f_favail: ::fsfilcnt_t,
52 #[cfg(target_endian = "little")]
53 pub f_fsid: ::c_ulong,
54 #[cfg(target_pointer_width = "32")]
55 __f_unused: ::c_int,
56 #[cfg(target_endian = "big")]
57 pub f_fsid: ::c_ulong,
58 pub f_flag: ::c_ulong,
59 pub f_namemax: ::c_ulong,
60 __f_spare: [::c_int; 6],
61 }
62
7453a54e
SL
63 pub struct termios {
64 pub c_iflag: ::tcflag_t,
65 pub c_oflag: ::tcflag_t,
66 pub c_cflag: ::tcflag_t,
67 pub c_lflag: ::tcflag_t,
68 pub c_line: ::cc_t,
69 pub c_cc: [::cc_t; ::NCCS],
70 pub __c_ispeed: ::speed_t,
71 pub __c_ospeed: ::speed_t,
72 }
73
74 pub struct flock {
75 pub l_type: ::c_short,
76 pub l_whence: ::c_short,
77 pub l_start: ::off_t,
78 pub l_len: ::off_t,
79 pub l_pid: ::pid_t,
80 }
3157f602
XL
81
82 pub struct sysinfo {
83 pub uptime: ::c_ulong,
84 pub loads: [::c_ulong; 3],
85 pub totalram: ::c_ulong,
86 pub freeram: ::c_ulong,
87 pub sharedram: ::c_ulong,
88 pub bufferram: ::c_ulong,
89 pub totalswap: ::c_ulong,
90 pub freeswap: ::c_ulong,
91 pub procs: ::c_ushort,
92 pub pad: ::c_ushort,
93 pub totalhigh: ::c_ulong,
94 pub freehigh: ::c_ulong,
95 pub mem_unit: ::c_uint,
96 pub __reserved: [::c_char; 256],
97 }
7453a54e
SL
98}
99
32a655c1
SL
100pub const SFD_CLOEXEC: ::c_int = 0x080000;
101
102pub const NCCS: usize = 32;
103
104pub const O_TRUNC: ::c_int = 512;
3b2f2976 105pub const O_NOATIME: ::c_int = 0o1000000;
32a655c1 106pub const O_CLOEXEC: ::c_int = 0x80000;
abe05a73 107pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
32a655c1
SL
108
109pub const EBFONT: ::c_int = 59;
110pub const ENOSTR: ::c_int = 60;
111pub const ENODATA: ::c_int = 61;
112pub const ETIME: ::c_int = 62;
113pub const ENOSR: ::c_int = 63;
114pub const ENONET: ::c_int = 64;
115pub const ENOPKG: ::c_int = 65;
116pub const EREMOTE: ::c_int = 66;
117pub const ENOLINK: ::c_int = 67;
118pub const EADV: ::c_int = 68;
119pub const ESRMNT: ::c_int = 69;
120pub const ECOMM: ::c_int = 70;
121pub const EPROTO: ::c_int = 71;
122pub const EDOTDOT: ::c_int = 73;
123
124pub const SA_NODEFER: ::c_int = 0x40000000;
125pub const SA_RESETHAND: ::c_int = 0x80000000;
126pub const SA_RESTART: ::c_int = 0x10000000;
127pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
128
129pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
130
131pub const EFD_CLOEXEC: ::c_int = 0x80000;
132
7453a54e
SL
133pub const BUFSIZ: ::c_uint = 1024;
134pub const TMP_MAX: ::c_uint = 10000;
135pub const FOPEN_MAX: ::c_uint = 1000;
cc61c64b
XL
136pub const O_PATH: ::c_int = 0o10000000;
137pub const O_EXEC: ::c_int = 0o10000000;
138pub const O_SEARCH: ::c_int = 0o10000000;
7453a54e
SL
139pub const O_ACCMODE: ::c_int = 0o10000003;
140pub const O_NDELAY: ::c_int = O_NONBLOCK;
7453a54e
SL
141pub const NI_MAXHOST: ::socklen_t = 255;
142pub const PTHREAD_STACK_MIN: ::size_t = 2048;
9e0c209e
SL
143pub const POSIX_FADV_DONTNEED: ::c_int = 4;
144pub const POSIX_FADV_NOREUSE: ::c_int = 5;
145
146pub const POSIX_MADV_DONTNEED: ::c_int = 4;
7453a54e
SL
147
148pub const RLIM_INFINITY: ::rlim_t = !0;
149pub const RLIMIT_RTTIME: ::c_int = 15;
7453a54e
SL
150
151pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
152
abe05a73
XL
153pub const SOCK_DCCP: ::c_int = 6;
154pub const SOCK_PACKET: ::c_int = 10;
155
7453a54e
SL
156pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15;
157pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16;
158pub const TCP_THIN_DUPACK: ::c_int = 17;
159pub const TCP_USER_TIMEOUT: ::c_int = 18;
160pub const TCP_REPAIR: ::c_int = 19;
161pub const TCP_REPAIR_QUEUE: ::c_int = 20;
162pub const TCP_QUEUE_SEQ: ::c_int = 21;
163pub const TCP_REPAIR_OPTIONS: ::c_int = 22;
164pub const TCP_FASTOPEN: ::c_int = 23;
165pub const TCP_TIMESTAMP: ::c_int = 24;
166
167pub const SIGUNUSED: ::c_int = ::SIGSYS;
168
5bcae85e 169pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
7453a54e 170pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
3b2f2976 171pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
7453a54e
SL
172
173pub const CPU_SETSIZE: ::c_int = 128;
174
7453a54e
SL
175pub const PTRACE_TRACEME: ::c_int = 0;
176pub const PTRACE_PEEKTEXT: ::c_int = 1;
177pub const PTRACE_PEEKDATA: ::c_int = 2;
178pub const PTRACE_PEEKUSER: ::c_int = 3;
179pub const PTRACE_POKETEXT: ::c_int = 4;
180pub const PTRACE_POKEDATA: ::c_int = 5;
181pub const PTRACE_POKEUSER: ::c_int = 6;
182pub const PTRACE_CONT: ::c_int = 7;
183pub const PTRACE_KILL: ::c_int = 8;
184pub const PTRACE_SINGLESTEP: ::c_int = 9;
3b2f2976
XL
185pub const PTRACE_GETREGS: ::c_int = 12;
186pub const PTRACE_SETREGS: ::c_int = 13;
187pub const PTRACE_GETFPREGS: ::c_int = 14;
188pub const PTRACE_SETFPREGS: ::c_int = 15;
7453a54e
SL
189pub const PTRACE_ATTACH: ::c_int = 16;
190pub const PTRACE_DETACH: ::c_int = 17;
3b2f2976
XL
191pub const PTRACE_GETFPXREGS: ::c_int = 18;
192pub const PTRACE_SETFPXREGS: ::c_int = 19;
7453a54e
SL
193pub const PTRACE_SYSCALL: ::c_int = 24;
194pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
195pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
196pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
197pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
198pub const PTRACE_GETREGSET: ::c_int = 0x4204;
199pub const PTRACE_SETREGSET: ::c_int = 0x4205;
200pub const PTRACE_SEIZE: ::c_int = 0x4206;
201pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
202pub const PTRACE_LISTEN: ::c_int = 0x4208;
203pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
204
7453a54e
SL
205pub const EPOLLWAKEUP: ::c_int = 0x20000000;
206
7453a54e
SL
207pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
208
209pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
210
211pub const TCSANOW: ::c_int = 0;
212pub const TCSADRAIN: ::c_int = 1;
213pub const TCSAFLUSH: ::c_int = 2;
214
7453a54e
SL
215pub const RTLD_GLOBAL: ::c_int = 0x100;
216pub const RTLD_NOLOAD: ::c_int = 0x4;
217
54a0048b
SL
218// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux
219// kernel 3.10). See also notbsd/mod.rs
220pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
221pub const CLOCK_TAI: ::clockid_t = 11;
222
cc61c64b
XL
223pub const B0: ::speed_t = 0o000000;
224pub const B50: ::speed_t = 0o000001;
225pub const B75: ::speed_t = 0o000002;
226pub const B110: ::speed_t = 0o000003;
227pub const B134: ::speed_t = 0o000004;
228pub const B150: ::speed_t = 0o000005;
229pub const B200: ::speed_t = 0o000006;
230pub const B300: ::speed_t = 0o000007;
231pub const B600: ::speed_t = 0o000010;
232pub const B1200: ::speed_t = 0o000011;
233pub const B1800: ::speed_t = 0o000012;
234pub const B2400: ::speed_t = 0o000013;
235pub const B4800: ::speed_t = 0o000014;
236pub const B9600: ::speed_t = 0o000015;
237pub const B19200: ::speed_t = 0o000016;
238pub const B38400: ::speed_t = 0o000017;
239pub const EXTA: ::speed_t = B19200;
240pub const EXTB: ::speed_t = B38400;
cc61c64b 241
3b2f2976
XL
242pub const SO_BINDTODEVICE: ::c_int = 25;
243pub const SO_TIMESTAMP: ::c_int = 29;
244pub const SO_MARK: ::c_int = 36;
245pub const SO_RXQ_OVFL: ::c_int = 40;
246pub const SO_PEEK_OFF: ::c_int = 42;
247pub const SO_BUSY_POLL: ::c_int = 46;
248
7453a54e 249extern {
7453a54e 250 pub fn ptrace(request: ::c_int, ...) -> ::c_long;
3157f602
XL
251 pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
252 pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
7453a54e
SL
253}
254
255cfg_if! {
abe05a73
XL
256 if #[cfg(any(target_arch = "x86_64",
257 target_arch = "aarch64",
258 target_arch = "powerpc64"))] {
7453a54e
SL
259 mod b64;
260 pub use self::b64::*;
261 } else if #[cfg(any(target_arch = "x86",
262 target_arch = "mips",
b7449926
XL
263 target_arch = "arm",
264 target_arch = "powerpc"))] {
7453a54e
SL
265 mod b32;
266 pub use self::b32::*;
267 } else { }
268}