Skip to content

Commit 3e89579

Browse files
committed
Auto merge of #483 - japaric:sparc64, r=alexcrichton
sparc64-linux support This needs to be "cleaned" up to use modules instead of a bunch of `cfg`s ... Sadly, sparc64 constants are very different from other architectures so cleaning this will result in a bunch of duplication, I think. While working on this, I was wondering why the constants are not written like this: ``` rust // linux/mod.rs const COMMON: ::c_int = 3; cfg_if! { if #[cfg(target_arch = "sparc64")] { const FOO: ::c_int = 1; } else if #[cfg(any(target_arch = "mips64", target_arch = "x86_64"))] { const FOO: ::c_int = 2; } else { // unsupported/unknown architecture } } ``` I think this might result in less duplicated code. @alexcrichton Has something like that ^ been attempted before?
2 parents 21bf054 + 67615b4 commit 3e89579

File tree

13 files changed

+1312
-194
lines changed

13 files changed

+1312
-194
lines changed

src/unix/notbsd/android/mod.rs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,34 @@ s! {
137137
}
138138
}
139139

140+
pub const O_TRUNC: ::c_int = 512;
141+
142+
pub const O_CLOEXEC: ::c_int = 0x80000;
143+
144+
pub const EBFONT: ::c_int = 59;
145+
pub const ENOSTR: ::c_int = 60;
146+
pub const ENODATA: ::c_int = 61;
147+
pub const ETIME: ::c_int = 62;
148+
pub const ENOSR: ::c_int = 63;
149+
pub const ENONET: ::c_int = 64;
150+
pub const ENOPKG: ::c_int = 65;
151+
pub const EREMOTE: ::c_int = 66;
152+
pub const ENOLINK: ::c_int = 67;
153+
pub const EADV: ::c_int = 68;
154+
pub const ESRMNT: ::c_int = 69;
155+
pub const ECOMM: ::c_int = 70;
156+
pub const EPROTO: ::c_int = 71;
157+
pub const EDOTDOT: ::c_int = 73;
158+
159+
pub const SA_NODEFER: ::c_int = 0x40000000;
160+
pub const SA_RESETHAND: ::c_int = 0x80000000;
161+
pub const SA_RESTART: ::c_int = 0x10000000;
162+
pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
163+
164+
pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
165+
166+
pub const EFD_CLOEXEC: ::c_int = 0x80000;
167+
140168
pub const USER_PROCESS: ::c_short = 7;
141169

142170
pub const BUFSIZ: ::c_uint = 1024;
@@ -227,7 +255,6 @@ pub const FIOCLEX: ::c_int = 0x5451;
227255
pub const SA_ONSTACK: ::c_ulong = 0x08000000;
228256
pub const SA_SIGINFO: ::c_ulong = 0x00000004;
229257
pub const SA_NOCLDWAIT: ::c_ulong = 0x00000002;
230-
231258
pub const SIGCHLD: ::c_int = 17;
232259
pub const SIGBUS: ::c_int = 7;
233260
pub const SIGUSR1: ::c_int = 10;

src/unix/notbsd/linux/mips/mod.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
2+
3+
pub const SFD_CLOEXEC: ::c_int = 0x080000;
4+
5+
pub const NCCS: usize = 32;
6+
7+
pub const O_TRUNC: ::c_int = 512;
8+
9+
pub const O_CLOEXEC: ::c_int = 0x80000;
10+
11+
pub const EBFONT: ::c_int = 59;
12+
pub const ENOSTR: ::c_int = 60;
13+
pub const ENODATA: ::c_int = 61;
14+
pub const ETIME: ::c_int = 62;
15+
pub const ENOSR: ::c_int = 63;
16+
pub const ENONET: ::c_int = 64;
17+
pub const ENOPKG: ::c_int = 65;
18+
pub const EREMOTE: ::c_int = 66;
19+
pub const ENOLINK: ::c_int = 67;
20+
pub const EADV: ::c_int = 68;
21+
pub const ESRMNT: ::c_int = 69;
22+
pub const ECOMM: ::c_int = 70;
23+
pub const EPROTO: ::c_int = 71;
24+
pub const EDOTDOT: ::c_int = 73;
25+
26+
pub const SA_NODEFER: ::c_int = 0x40000000;
27+
pub const SA_RESETHAND: ::c_int = 0x80000000;
28+
pub const SA_RESTART: ::c_int = 0x10000000;
29+
pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
30+
31+
pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
32+
33+
pub const EFD_CLOEXEC: ::c_int = 0x80000;
34+
135
pub const BUFSIZ: ::c_uint = 8192;
236
pub const TMP_MAX: ::c_uint = 238328;
337
pub const FOPEN_MAX: ::c_uint = 16;

src/unix/notbsd/linux/mod.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,12 @@ s! {
8787

8888
pub struct pthread_mutexattr_t {
8989
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
90-
target_arch = "mips64", target_arch = "s390x"))]
90+
target_arch = "mips64", target_arch = "s390x",
91+
target_arch = "sparc64"))]
9192
__align: [::c_int; 0],
9293
#[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
93-
target_arch = "mips64", target_arch = "s390x")))]
94+
target_arch = "mips64", target_arch = "s390x",
95+
target_arch = "sparc64")))]
9496
__align: [::c_long; 0],
9597
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
9698
}
@@ -248,8 +250,6 @@ pub const ABMON_10: ::nl_item = 0x20017;
248250
pub const ABMON_11: ::nl_item = 0x20018;
249251
pub const ABMON_12: ::nl_item = 0x20019;
250252

251-
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
252-
253253
pub const MON_1: ::nl_item = 0x2001A;
254254
pub const MON_2: ::nl_item = 0x2001B;
255255
pub const MON_3: ::nl_item = 0x2001C;
@@ -500,12 +500,8 @@ pub const EPOLLONESHOT: ::c_int = 0x40000000;
500500
pub const QFMT_VFS_OLD: ::c_int = 1;
501501
pub const QFMT_VFS_V0: ::c_int = 2;
502502

503-
pub const SFD_CLOEXEC: ::c_int = 0x080000;
504-
505503
pub const EFD_SEMAPHORE: ::c_int = 0x1;
506504

507-
pub const NCCS: usize = 32;
508-
509505
pub const LOG_NFACILITIES: ::c_int = 24;
510506

511507
pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;

src/unix/notbsd/linux/musl/mod.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,40 @@ s! {
8787
}
8888
}
8989

90+
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
91+
92+
pub const SFD_CLOEXEC: ::c_int = 0x080000;
93+
94+
pub const NCCS: usize = 32;
95+
96+
pub const O_TRUNC: ::c_int = 512;
97+
98+
pub const O_CLOEXEC: ::c_int = 0x80000;
99+
100+
pub const EBFONT: ::c_int = 59;
101+
pub const ENOSTR: ::c_int = 60;
102+
pub const ENODATA: ::c_int = 61;
103+
pub const ETIME: ::c_int = 62;
104+
pub const ENOSR: ::c_int = 63;
105+
pub const ENONET: ::c_int = 64;
106+
pub const ENOPKG: ::c_int = 65;
107+
pub const EREMOTE: ::c_int = 66;
108+
pub const ENOLINK: ::c_int = 67;
109+
pub const EADV: ::c_int = 68;
110+
pub const ESRMNT: ::c_int = 69;
111+
pub const ECOMM: ::c_int = 70;
112+
pub const EPROTO: ::c_int = 71;
113+
pub const EDOTDOT: ::c_int = 73;
114+
115+
pub const SA_NODEFER: ::c_int = 0x40000000;
116+
pub const SA_RESETHAND: ::c_int = 0x80000000;
117+
pub const SA_RESTART: ::c_int = 0x10000000;
118+
pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
119+
120+
pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
121+
122+
pub const EFD_CLOEXEC: ::c_int = 0x80000;
123+
90124
pub const BUFSIZ: ::c_uint = 1024;
91125
pub const TMP_MAX: ::c_uint = 10000;
92126
pub const FOPEN_MAX: ::c_uint = 1000;

src/unix/notbsd/linux/other/b32/mod.rs

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,201 @@ s! {
6363
}
6464
}
6565

66+
pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
67+
pub const TIOCSSOFTCAR: ::c_ulong = 0x541A;
68+
69+
pub const RLIMIT_NOFILE: ::c_int = 7;
70+
pub const RLIMIT_NPROC: ::c_int = 6;
71+
72+
pub const O_APPEND: ::c_int = 1024;
73+
pub const O_CREAT: ::c_int = 64;
74+
pub const O_EXCL: ::c_int = 128;
75+
pub const O_NOCTTY: ::c_int = 256;
76+
pub const O_NONBLOCK: ::c_int = 2048;
77+
pub const O_SYNC: ::c_int = 1052672;
78+
pub const O_RSYNC: ::c_int = 1052672;
79+
pub const O_DSYNC: ::c_int = 4096;
80+
pub const O_FSYNC: ::c_int = 0x101000;
81+
82+
pub const MAP_GROWSDOWN: ::c_int = 0x0100;
83+
84+
pub const EDEADLK: ::c_int = 35;
85+
pub const ENAMETOOLONG: ::c_int = 36;
86+
pub const ENOLCK: ::c_int = 37;
87+
pub const ENOSYS: ::c_int = 38;
88+
pub const ENOTEMPTY: ::c_int = 39;
89+
pub const ELOOP: ::c_int = 40;
90+
pub const ENOMSG: ::c_int = 42;
91+
pub const EIDRM: ::c_int = 43;
92+
pub const ECHRNG: ::c_int = 44;
93+
pub const EL2NSYNC: ::c_int = 45;
94+
pub const EL3HLT: ::c_int = 46;
95+
pub const EL3RST: ::c_int = 47;
96+
pub const ELNRNG: ::c_int = 48;
97+
pub const EUNATCH: ::c_int = 49;
98+
pub const ENOCSI: ::c_int = 50;
99+
pub const EL2HLT: ::c_int = 51;
100+
pub const EBADE: ::c_int = 52;
101+
pub const EBADR: ::c_int = 53;
102+
pub const EXFULL: ::c_int = 54;
103+
pub const ENOANO: ::c_int = 55;
104+
pub const EBADRQC: ::c_int = 56;
105+
pub const EBADSLT: ::c_int = 57;
106+
pub const EMULTIHOP: ::c_int = 72;
107+
pub const EOVERFLOW: ::c_int = 75;
108+
pub const ENOTUNIQ: ::c_int = 76;
109+
pub const EBADFD: ::c_int = 77;
110+
pub const EBADMSG: ::c_int = 74;
111+
pub const EREMCHG: ::c_int = 78;
112+
pub const ELIBACC: ::c_int = 79;
113+
pub const ELIBBAD: ::c_int = 80;
114+
pub const ELIBSCN: ::c_int = 81;
115+
pub const ELIBMAX: ::c_int = 82;
116+
pub const ELIBEXEC: ::c_int = 83;
117+
pub const EILSEQ: ::c_int = 84;
118+
pub const ERESTART: ::c_int = 85;
119+
pub const ESTRPIPE: ::c_int = 86;
120+
pub const EUSERS: ::c_int = 87;
121+
pub const ENOTSOCK: ::c_int = 88;
122+
pub const EDESTADDRREQ: ::c_int = 89;
123+
pub const EMSGSIZE: ::c_int = 90;
124+
pub const EPROTOTYPE: ::c_int = 91;
125+
pub const ENOPROTOOPT: ::c_int = 92;
126+
pub const EPROTONOSUPPORT: ::c_int = 93;
127+
pub const ESOCKTNOSUPPORT: ::c_int = 94;
128+
pub const EOPNOTSUPP: ::c_int = 95;
129+
pub const EPFNOSUPPORT: ::c_int = 96;
130+
pub const EAFNOSUPPORT: ::c_int = 97;
131+
pub const EADDRINUSE: ::c_int = 98;
132+
pub const EADDRNOTAVAIL: ::c_int = 99;
133+
pub const ENETDOWN: ::c_int = 100;
134+
pub const ENETUNREACH: ::c_int = 101;
135+
pub const ENETRESET: ::c_int = 102;
136+
pub const ECONNABORTED: ::c_int = 103;
137+
pub const ECONNRESET: ::c_int = 104;
138+
pub const ENOBUFS: ::c_int = 105;
139+
pub const EISCONN: ::c_int = 106;
140+
pub const ENOTCONN: ::c_int = 107;
141+
pub const ESHUTDOWN: ::c_int = 108;
142+
pub const ETOOMANYREFS: ::c_int = 109;
143+
pub const ETIMEDOUT: ::c_int = 110;
144+
pub const ECONNREFUSED: ::c_int = 111;
145+
pub const EHOSTDOWN: ::c_int = 112;
146+
pub const EHOSTUNREACH: ::c_int = 113;
147+
pub const EALREADY: ::c_int = 114;
148+
pub const EINPROGRESS: ::c_int = 115;
149+
pub const ESTALE: ::c_int = 116;
150+
pub const EDQUOT: ::c_int = 122;
151+
pub const ENOMEDIUM: ::c_int = 123;
152+
pub const EMEDIUMTYPE: ::c_int = 124;
153+
pub const ECANCELED: ::c_int = 125;
154+
pub const ENOKEY: ::c_int = 126;
155+
pub const EKEYEXPIRED: ::c_int = 127;
156+
pub const EKEYREVOKED: ::c_int = 128;
157+
pub const EKEYREJECTED: ::c_int = 129;
158+
pub const EOWNERDEAD: ::c_int = 130;
159+
pub const ENOTRECOVERABLE: ::c_int = 131;
160+
pub const EHWPOISON: ::c_int = 133;
161+
pub const ERFKILL: ::c_int = 132;
162+
163+
pub const SOL_SOCKET: ::c_int = 1;
164+
165+
pub const SO_REUSEADDR: ::c_int = 2;
166+
pub const SO_TYPE: ::c_int = 3;
167+
pub const SO_ERROR: ::c_int = 4;
168+
pub const SO_DONTROUTE: ::c_int = 5;
169+
pub const SO_BROADCAST: ::c_int = 6;
170+
pub const SO_SNDBUF: ::c_int = 7;
171+
pub const SO_RCVBUF: ::c_int = 8;
172+
pub const SO_KEEPALIVE: ::c_int = 9;
173+
pub const SO_OOBINLINE: ::c_int = 10;
174+
pub const SO_LINGER: ::c_int = 13;
175+
pub const SO_REUSEPORT: ::c_int = 15;
176+
pub const SO_ACCEPTCONN: ::c_int = 30;
177+
178+
pub const SA_ONSTACK: ::c_int = 0x08000000;
179+
pub const SA_SIGINFO: ::c_int = 0x00000004;
180+
pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
181+
182+
pub const SIGCHLD: ::c_int = 17;
183+
pub const SIGBUS: ::c_int = 7;
184+
pub const SIGUSR1: ::c_int = 10;
185+
pub const SIGUSR2: ::c_int = 12;
186+
pub const SIGCONT: ::c_int = 18;
187+
pub const SIGSTOP: ::c_int = 19;
188+
pub const SIGTSTP: ::c_int = 20;
189+
pub const SIGURG: ::c_int = 23;
190+
pub const SIGIO: ::c_int = 29;
191+
pub const SIGSYS: ::c_int = 31;
192+
pub const SIGSTKFLT: ::c_int = 16;
193+
pub const SIGUNUSED: ::c_int = 31;
194+
pub const SIGPOLL: ::c_int = 29;
195+
pub const SIGPWR: ::c_int = 30;
196+
pub const SIG_SETMASK: ::c_int = 2;
197+
pub const SIG_BLOCK: ::c_int = 0x000000;
198+
pub const SIG_UNBLOCK: ::c_int = 0x01;
199+
200+
pub const POLLWRNORM: ::c_short = 0x100;
201+
pub const POLLWRBAND: ::c_short = 0x200;
202+
203+
pub const O_ASYNC: ::c_int = 0x2000;
204+
pub const O_NDELAY: ::c_int = 0x800;
205+
206+
pub const PTRACE_DETACH: ::c_uint = 17;
207+
208+
pub const EFD_NONBLOCK: ::c_int = 0x800;
209+
210+
pub const F_GETLK: ::c_int = 5;
211+
pub const F_GETOWN: ::c_int = 9;
212+
pub const F_SETOWN: ::c_int = 8;
213+
pub const F_SETLK: ::c_int = 6;
214+
pub const F_SETLKW: ::c_int = 7;
215+
216+
pub const SFD_NONBLOCK: ::c_int = 0x0800;
217+
218+
pub const TIOCEXCL: ::c_ulong = 0x540C;
219+
pub const TIOCNXCL: ::c_ulong = 0x540D;
220+
pub const TIOCSCTTY: ::c_ulong = 0x540E;
221+
pub const TIOCSTI: ::c_ulong = 0x5412;
222+
pub const TIOCMGET: ::c_ulong = 0x5415;
223+
pub const TIOCMBIS: ::c_ulong = 0x5416;
224+
pub const TIOCMBIC: ::c_ulong = 0x5417;
225+
pub const TIOCMSET: ::c_ulong = 0x5418;
226+
pub const TIOCCONS: ::c_ulong = 0x541D;
227+
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
228+
229+
pub const SFD_CLOEXEC: ::c_int = 0x080000;
230+
231+
pub const NCCS: usize = 32;
232+
233+
pub const O_TRUNC: ::c_int = 512;
234+
235+
pub const O_CLOEXEC: ::c_int = 0x80000;
236+
237+
pub const EBFONT: ::c_int = 59;
238+
pub const ENOSTR: ::c_int = 60;
239+
pub const ENODATA: ::c_int = 61;
240+
pub const ETIME: ::c_int = 62;
241+
pub const ENOSR: ::c_int = 63;
242+
pub const ENONET: ::c_int = 64;
243+
pub const ENOPKG: ::c_int = 65;
244+
pub const EREMOTE: ::c_int = 66;
245+
pub const ENOLINK: ::c_int = 67;
246+
pub const EADV: ::c_int = 68;
247+
pub const ESRMNT: ::c_int = 69;
248+
pub const ECOMM: ::c_int = 70;
249+
pub const EPROTO: ::c_int = 71;
250+
pub const EDOTDOT: ::c_int = 73;
251+
252+
pub const SA_NODEFER: ::c_int = 0x40000000;
253+
pub const SA_RESETHAND: ::c_int = 0x80000000;
254+
pub const SA_RESTART: ::c_int = 0x10000000;
255+
pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
256+
257+
pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
258+
259+
pub const EFD_CLOEXEC: ::c_int = 0x80000;
260+
66261
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
67262
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
68263
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;

0 commit comments

Comments
 (0)