Skip to content

Commit 9aa66dc

Browse files
committed
Auto merge of rust-lang#1390 - gnzlbg:ref_gnu, r=gnzlbg
Refactor the GNU module
2 parents ce7e3a7 + fbe38dd commit 9aa66dc

23 files changed

+2175
-2115
lines changed

src/unix/linux_like/linux/other/b32/arm.rs renamed to src/unix/linux_like/linux/gnu/b32/arm.rs

Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,37 @@ pub type c_char = u8;
22
pub type wchar_t = u32;
33

44
s! {
5+
pub struct sigaction {
6+
pub sa_sigaction: ::sighandler_t,
7+
pub sa_mask: ::sigset_t,
8+
pub sa_flags: ::c_int,
9+
pub sa_restorer: ::Option<extern fn()>,
10+
}
11+
12+
pub struct statfs {
13+
pub f_type: ::__fsword_t,
14+
pub f_bsize: ::__fsword_t,
15+
pub f_blocks: ::fsblkcnt_t,
16+
pub f_bfree: ::fsblkcnt_t,
17+
pub f_bavail: ::fsblkcnt_t,
18+
19+
pub f_files: ::fsfilcnt_t,
20+
pub f_ffree: ::fsfilcnt_t,
21+
pub f_fsid: ::fsid_t,
22+
23+
pub f_namelen: ::__fsword_t,
24+
pub f_frsize: ::__fsword_t,
25+
f_spare: [::__fsword_t; 5],
26+
}
27+
28+
pub struct flock {
29+
pub l_type: ::c_short,
30+
pub l_whence: ::c_short,
31+
pub l_start: ::off_t,
32+
pub l_len: ::off_t,
33+
pub l_pid: ::pid_t,
34+
}
35+
536
pub struct ipc_perm {
637
pub __key: ::key_t,
738
pub uid: ::uid_t,
@@ -112,18 +143,169 @@ s! {
112143
pub c_ispeed: ::speed_t,
113144
pub c_ospeed: ::speed_t,
114145
}
146+
147+
pub struct siginfo_t {
148+
pub si_signo: ::c_int,
149+
pub si_errno: ::c_int,
150+
pub si_code: ::c_int,
151+
#[doc(hidden)]
152+
#[deprecated(
153+
since="0.2.54",
154+
note="Please leave a comment on \
155+
https://github.com/rust-lang/libc/pull/1316 if you're using \
156+
this field"
157+
)]
158+
pub _pad: [::c_int; 29],
159+
_align: [usize; 0],
160+
}
161+
162+
pub struct stack_t {
163+
pub ss_sp: *mut ::c_void,
164+
pub ss_flags: ::c_int,
165+
pub ss_size: ::size_t
166+
}
115167
}
116168

169+
pub const RLIM_INFINITY: ::rlim_t = !0;
170+
pub const VEOF: usize = 4;
171+
pub const RTLD_DEEPBIND: ::c_int = 0x8;
172+
pub const RTLD_GLOBAL: ::c_int = 0x100;
173+
pub const RTLD_NOLOAD: ::c_int = 0x4;
117174
pub const O_DIRECT: ::c_int = 0x10000;
118175
pub const O_DIRECTORY: ::c_int = 0x4000;
119176
pub const O_NOFOLLOW: ::c_int = 0x8000;
120177
pub const O_LARGEFILE: ::c_int = 0o400000;
178+
pub const O_APPEND: ::c_int = 1024;
179+
pub const O_CREAT: ::c_int = 64;
180+
pub const O_EXCL: ::c_int = 128;
181+
pub const O_NOCTTY: ::c_int = 256;
182+
pub const O_NONBLOCK: ::c_int = 2048;
183+
pub const O_SYNC: ::c_int = 1052672;
184+
pub const O_RSYNC: ::c_int = 1052672;
185+
pub const O_DSYNC: ::c_int = 4096;
186+
pub const O_FSYNC: ::c_int = 0x101000;
187+
pub const O_ASYNC: ::c_int = 0x2000;
188+
pub const O_NDELAY: ::c_int = 0x800;
189+
pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7;
190+
pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6;
191+
pub const RLIMIT_RSS: ::__rlimit_resource_t = 5;
192+
pub const RLIMIT_AS: ::__rlimit_resource_t = 9;
193+
pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8;
121194

195+
pub const MADV_SOFT_OFFLINE: ::c_int = 101;
122196
pub const MAP_LOCKED: ::c_int = 0x02000;
123197
pub const MAP_NORESERVE: ::c_int = 0x04000;
198+
pub const MAP_ANON: ::c_int = 0x0020;
199+
pub const MAP_ANONYMOUS: ::c_int = 0x0020;
200+
pub const MAP_DENYWRITE: ::c_int = 0x0800;
201+
pub const MAP_EXECUTABLE: ::c_int = 0x01000;
202+
pub const MAP_POPULATE: ::c_int = 0x08000;
203+
pub const MAP_NONBLOCK: ::c_int = 0x010000;
204+
pub const MAP_STACK: ::c_int = 0x020000;
205+
pub const MAP_HUGETLB: ::c_int = 0x040000;
206+
pub const MAP_GROWSDOWN: ::c_int = 0x0100;
207+
208+
pub const SOL_SOCKET: ::c_int = 1;
124209

125210
pub const EDEADLOCK: ::c_int = 35;
211+
pub const EUCLEAN: ::c_int = 117;
212+
pub const ENOTNAM: ::c_int = 118;
213+
pub const ENAVAIL: ::c_int = 119;
214+
pub const EISNAM: ::c_int = 120;
215+
pub const EREMOTEIO: ::c_int = 121;
216+
pub const EDEADLK: ::c_int = 35;
217+
pub const ENAMETOOLONG: ::c_int = 36;
218+
pub const ENOLCK: ::c_int = 37;
219+
pub const ENOSYS: ::c_int = 38;
220+
pub const ENOTEMPTY: ::c_int = 39;
221+
pub const ELOOP: ::c_int = 40;
222+
pub const ENOMSG: ::c_int = 42;
223+
pub const EIDRM: ::c_int = 43;
224+
pub const ECHRNG: ::c_int = 44;
225+
pub const EL2NSYNC: ::c_int = 45;
226+
pub const EL3HLT: ::c_int = 46;
227+
pub const EL3RST: ::c_int = 47;
228+
pub const ELNRNG: ::c_int = 48;
229+
pub const EUNATCH: ::c_int = 49;
230+
pub const ENOCSI: ::c_int = 50;
231+
pub const EL2HLT: ::c_int = 51;
232+
pub const EBADE: ::c_int = 52;
233+
pub const EBADR: ::c_int = 53;
234+
pub const EXFULL: ::c_int = 54;
235+
pub const ENOANO: ::c_int = 55;
236+
pub const EBADRQC: ::c_int = 56;
237+
pub const EBADSLT: ::c_int = 57;
238+
pub const EMULTIHOP: ::c_int = 72;
239+
pub const EOVERFLOW: ::c_int = 75;
240+
pub const ENOTUNIQ: ::c_int = 76;
241+
pub const EBADFD: ::c_int = 77;
242+
pub const EBADMSG: ::c_int = 74;
243+
pub const EREMCHG: ::c_int = 78;
244+
pub const ELIBACC: ::c_int = 79;
245+
pub const ELIBBAD: ::c_int = 80;
246+
pub const ELIBSCN: ::c_int = 81;
247+
pub const ELIBMAX: ::c_int = 82;
248+
pub const ELIBEXEC: ::c_int = 83;
249+
pub const EILSEQ: ::c_int = 84;
250+
pub const ERESTART: ::c_int = 85;
251+
pub const ESTRPIPE: ::c_int = 86;
252+
pub const EUSERS: ::c_int = 87;
253+
pub const ENOTSOCK: ::c_int = 88;
254+
pub const EDESTADDRREQ: ::c_int = 89;
255+
pub const EMSGSIZE: ::c_int = 90;
256+
pub const EPROTOTYPE: ::c_int = 91;
257+
pub const ENOPROTOOPT: ::c_int = 92;
258+
pub const EPROTONOSUPPORT: ::c_int = 93;
259+
pub const ESOCKTNOSUPPORT: ::c_int = 94;
260+
pub const EOPNOTSUPP: ::c_int = 95;
261+
pub const EPFNOSUPPORT: ::c_int = 96;
262+
pub const EAFNOSUPPORT: ::c_int = 97;
263+
pub const EADDRINUSE: ::c_int = 98;
264+
pub const EADDRNOTAVAIL: ::c_int = 99;
265+
pub const ENETDOWN: ::c_int = 100;
266+
pub const ENETUNREACH: ::c_int = 101;
267+
pub const ENETRESET: ::c_int = 102;
268+
pub const ECONNABORTED: ::c_int = 103;
269+
pub const ECONNRESET: ::c_int = 104;
270+
pub const ENOBUFS: ::c_int = 105;
271+
pub const EISCONN: ::c_int = 106;
272+
pub const ENOTCONN: ::c_int = 107;
273+
pub const ESHUTDOWN: ::c_int = 108;
274+
pub const ETOOMANYREFS: ::c_int = 109;
275+
pub const ETIMEDOUT: ::c_int = 110;
276+
pub const ECONNREFUSED: ::c_int = 111;
277+
pub const EHOSTDOWN: ::c_int = 112;
278+
pub const EHOSTUNREACH: ::c_int = 113;
279+
pub const EALREADY: ::c_int = 114;
280+
pub const EINPROGRESS: ::c_int = 115;
281+
pub const ESTALE: ::c_int = 116;
282+
pub const EDQUOT: ::c_int = 122;
283+
pub const ENOMEDIUM: ::c_int = 123;
284+
pub const EMEDIUMTYPE: ::c_int = 124;
285+
pub const ECANCELED: ::c_int = 125;
286+
pub const ENOKEY: ::c_int = 126;
287+
pub const EKEYEXPIRED: ::c_int = 127;
288+
pub const EKEYREVOKED: ::c_int = 128;
289+
pub const EKEYREJECTED: ::c_int = 129;
290+
pub const EOWNERDEAD: ::c_int = 130;
291+
pub const ENOTRECOVERABLE: ::c_int = 131;
292+
pub const EHWPOISON: ::c_int = 133;
293+
pub const ERFKILL: ::c_int = 132;
126294

295+
pub const SO_REUSEADDR: ::c_int = 2;
296+
pub const SO_TYPE: ::c_int = 3;
297+
pub const SO_ERROR: ::c_int = 4;
298+
pub const SO_DONTROUTE: ::c_int = 5;
299+
pub const SO_BROADCAST: ::c_int = 6;
300+
pub const SO_SNDBUF: ::c_int = 7;
301+
pub const SO_RCVBUF: ::c_int = 8;
302+
pub const SO_KEEPALIVE: ::c_int = 9;
303+
pub const SO_OOBINLINE: ::c_int = 10;
304+
pub const SO_LINGER: ::c_int = 13;
305+
pub const SO_REUSEPORT: ::c_int = 15;
306+
pub const SO_ACCEPTCONN: ::c_int = 30;
307+
pub const SO_PROTOCOL: ::c_int = 38;
308+
pub const SO_DOMAIN: ::c_int = 39;
127309
pub const SO_PASSCRED: ::c_int = 16;
128310
pub const SO_PEERCRED: ::c_int = 17;
129311
pub const SO_RCVLOWAT: ::c_int = 18;
@@ -133,12 +315,56 @@ pub const SO_SNDTIMEO: ::c_int = 21;
133315
pub const SO_SNDBUFFORCE: ::c_int = 32;
134316
pub const SO_RCVBUFFORCE: ::c_int = 33;
135317

318+
pub const SA_SIGINFO: ::c_int = 0x00000004;
319+
pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
320+
321+
pub const SOCK_STREAM: ::c_int = 1;
322+
pub const SOCK_DGRAM: ::c_int = 2;
323+
136324
pub const FIOCLEX: ::c_ulong = 0x5451;
137325
pub const FIONBIO: ::c_ulong = 0x5421;
138326

139327
pub const MCL_CURRENT: ::c_int = 0x0001;
140328
pub const MCL_FUTURE: ::c_int = 0x0002;
141329

330+
pub const POLLWRNORM: ::c_short = 0x100;
331+
pub const POLLWRBAND: ::c_short = 0x200;
332+
333+
pub const F_GETLK: ::c_int = 5;
334+
pub const F_GETOWN: ::c_int = 9;
335+
pub const F_SETOWN: ::c_int = 8;
336+
337+
pub const EFD_NONBLOCK: ::c_int = 0x800;
338+
pub const SFD_NONBLOCK: ::c_int = 0x0800;
339+
340+
pub const SIGCHLD: ::c_int = 17;
341+
pub const SIGBUS: ::c_int = 7;
342+
pub const SIGUSR1: ::c_int = 10;
343+
pub const SIGUSR2: ::c_int = 12;
344+
pub const SIGCONT: ::c_int = 18;
345+
pub const SIGSTOP: ::c_int = 19;
346+
pub const SIGTSTP: ::c_int = 20;
347+
pub const SIGURG: ::c_int = 23;
348+
pub const SIGIO: ::c_int = 29;
349+
pub const SIGSYS: ::c_int = 31;
350+
pub const SIGSTKFLT: ::c_int = 16;
351+
#[deprecated(
352+
since = "0.2.55",
353+
note = "Use SIGSYS instead"
354+
)]
355+
pub const SIGUNUSED: ::c_int = 31;
356+
pub const SIGPOLL: ::c_int = 29;
357+
pub const SIGPWR: ::c_int = 30;
358+
pub const SIG_SETMASK: ::c_int = 2;
359+
pub const SIG_BLOCK: ::c_int = 0x000000;
360+
pub const SIG_UNBLOCK: ::c_int = 0x01;
361+
pub const SIGTTIN: ::c_int = 21;
362+
pub const SIGTTOU: ::c_int = 22;
363+
pub const SIGXCPU: ::c_int = 24;
364+
pub const SIGXFSZ: ::c_int = 25;
365+
pub const SIGVTALRM: ::c_int = 26;
366+
pub const SIGPROF: ::c_int = 27;
367+
pub const SIGWINCH: ::c_int = 28;
142368
pub const SIGSTKSZ: ::size_t = 8192;
143369
pub const MINSIGSTKSZ: ::size_t = 2048;
144370
pub const CBAUD: ::tcflag_t = 0o0010017;
@@ -256,6 +482,31 @@ pub const TIOCGRS485: ::c_int = 0x542E;
256482
pub const TIOCSRS485: ::c_int = 0x542F;
257483
pub const FIONREAD: ::c_ulong = 0x541B;
258484

485+
pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
486+
pub const TIOCSSOFTCAR: ::c_ulong = 0x541A;
487+
pub const TIOCEXCL: ::c_ulong = 0x540C;
488+
pub const TIOCNXCL: ::c_ulong = 0x540D;
489+
pub const TIOCSCTTY: ::c_ulong = 0x540E;
490+
pub const TIOCSTI: ::c_ulong = 0x5412;
491+
pub const TIOCMGET: ::c_ulong = 0x5415;
492+
pub const TIOCMBIS: ::c_ulong = 0x5416;
493+
pub const TIOCMBIC: ::c_ulong = 0x5417;
494+
pub const TIOCMSET: ::c_ulong = 0x5418;
495+
pub const TIOCCONS: ::c_ulong = 0x541D;
496+
497+
pub const TCSANOW: ::c_int = 0;
498+
pub const TCSADRAIN: ::c_int = 1;
499+
pub const TCSAFLUSH: ::c_int = 2;
500+
501+
pub const TIOCLINUX: ::c_ulong = 0x541C;
502+
pub const TIOCGSERIAL: ::c_ulong = 0x541E;
503+
pub const TIOCM_ST: ::c_int = 0x008;
504+
pub const TIOCM_SR: ::c_int = 0x010;
505+
pub const TIOCM_CTS: ::c_int = 0x020;
506+
pub const TIOCM_CAR: ::c_int = 0x040;
507+
pub const TIOCM_RNG: ::c_int = 0x080;
508+
pub const TIOCM_DSR: ::c_int = 0x100;
509+
259510
// Syscall table
260511
pub const SYS_restart_syscall: ::c_long = 0;
261512
pub const SYS_exit: ::c_long = 1;

0 commit comments

Comments
 (0)