Skip to content

Commit 460fb13

Browse files
committed
Auto merge of #1031 - dusxmt:add-platform-linux-musl-ppc32, r=alexcrichton
Add linux musl powerpc (32-bit) support This change adds support for musl on 32-bit powerpc. Most of the general constants in src/unix/notbsd/linux/musl/b32/mod.rs were different from those of the powerpc port, so I moved them over to the individual architecture-specific submodules. The same with the ipc_perm structure.
2 parents 4dd6665 + 0163a7c commit 460fb13

File tree

6 files changed

+1127
-85
lines changed

6 files changed

+1127
-85
lines changed

src/unix/notbsd/linux/musl/b32/arm.rs

+85
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ s! {
5252
pub ss_size: ::size_t
5353
}
5454

55+
pub struct ipc_perm {
56+
pub __ipc_perm_key: ::key_t,
57+
pub uid: ::uid_t,
58+
pub gid: ::gid_t,
59+
pub cuid: ::uid_t,
60+
pub cgid: ::gid_t,
61+
pub mode: ::mode_t,
62+
pub __seq: ::c_int,
63+
__unused1: ::c_long,
64+
__unused2: ::c_long
65+
}
66+
5567
pub struct shmid_ds {
5668
pub shm_perm: ::ipc_perm,
5769
pub shm_segsz: ::size_t,
@@ -151,6 +163,9 @@ s! {
151163
}
152164
}
153165

166+
pub const SIGSTKSZ: ::size_t = 8192;
167+
pub const MINSIGSTKSZ: ::size_t = 2048;
168+
154169
pub const O_DIRECT: ::c_int = 0x10000;
155170
pub const O_DIRECTORY: ::c_int = 0x4000;
156171
pub const O_NOFOLLOW: ::c_int = 0x8000;
@@ -165,6 +180,76 @@ pub const RLIMIT_NOFILE: ::c_int = 7;
165180
pub const RLIMIT_AS: ::c_int = 9;
166181
pub const RLIMIT_NPROC: ::c_int = 6;
167182
pub const RLIMIT_MEMLOCK: ::c_int = 8;
183+
pub const RLIMIT_NLIMITS: ::c_int = 16;
184+
185+
pub const MCL_CURRENT: ::c_int = 0x0001;
186+
pub const MCL_FUTURE: ::c_int = 0x0002;
187+
pub const CBAUD: ::tcflag_t = 0o0010017;
188+
pub const TAB1: ::c_int = 0x00000800;
189+
pub const TAB2: ::c_int = 0x00001000;
190+
pub const TAB3: ::c_int = 0x00001800;
191+
pub const CR1: ::c_int = 0x00000200;
192+
pub const CR2: ::c_int = 0x00000400;
193+
pub const CR3: ::c_int = 0x00000600;
194+
pub const FF1: ::c_int = 0x00008000;
195+
pub const BS1: ::c_int = 0x00002000;
196+
pub const VT1: ::c_int = 0x00004000;
197+
pub const VWERASE: usize = 14;
198+
pub const VREPRINT: usize = 12;
199+
pub const VSUSP: usize = 10;
200+
pub const VSTART: usize = 8;
201+
pub const VSTOP: usize = 9;
202+
pub const VDISCARD: usize = 13;
203+
pub const VTIME: usize = 5;
204+
pub const IXON: ::tcflag_t = 0x00000400;
205+
pub const IXOFF: ::tcflag_t = 0x00001000;
206+
pub const ONLCR: ::tcflag_t = 0x4;
207+
pub const CSIZE: ::tcflag_t = 0x00000030;
208+
pub const CS6: ::tcflag_t = 0x00000010;
209+
pub const CS7: ::tcflag_t = 0x00000020;
210+
pub const CS8: ::tcflag_t = 0x00000030;
211+
pub const CSTOPB: ::tcflag_t = 0x00000040;
212+
pub const CREAD: ::tcflag_t = 0x00000080;
213+
pub const PARENB: ::tcflag_t = 0x00000100;
214+
pub const PARODD: ::tcflag_t = 0x00000200;
215+
pub const HUPCL: ::tcflag_t = 0x00000400;
216+
pub const CLOCAL: ::tcflag_t = 0x00000800;
217+
pub const ECHOKE: ::tcflag_t = 0x00000800;
218+
pub const ECHOE: ::tcflag_t = 0x00000010;
219+
pub const ECHOK: ::tcflag_t = 0x00000020;
220+
pub const ECHONL: ::tcflag_t = 0x00000040;
221+
pub const ECHOPRT: ::tcflag_t = 0x00000400;
222+
pub const ECHOCTL: ::tcflag_t = 0x00000200;
223+
pub const ISIG: ::tcflag_t = 0x00000001;
224+
pub const ICANON: ::tcflag_t = 0x00000002;
225+
pub const PENDIN: ::tcflag_t = 0x00004000;
226+
pub const NOFLSH: ::tcflag_t = 0x00000080;
227+
pub const CIBAUD: ::tcflag_t = 0o02003600000;
228+
pub const CBAUDEX: ::tcflag_t = 0o010000;
229+
pub const VSWTC: usize = 7;
230+
pub const OLCUC: ::tcflag_t = 0o000002;
231+
pub const NLDLY: ::tcflag_t = 0o000400;
232+
pub const CRDLY: ::tcflag_t = 0o003000;
233+
pub const TABDLY: ::tcflag_t = 0o014000;
234+
pub const BSDLY: ::tcflag_t = 0o020000;
235+
pub const FFDLY: ::tcflag_t = 0o100000;
236+
pub const VTDLY: ::tcflag_t = 0o040000;
237+
pub const XTABS: ::tcflag_t = 0o014000;
238+
pub const B57600: ::speed_t = 0o010001;
239+
pub const B115200: ::speed_t = 0o010002;
240+
pub const B230400: ::speed_t = 0o010003;
241+
pub const B460800: ::speed_t = 0o010004;
242+
pub const B500000: ::speed_t = 0o010005;
243+
pub const B576000: ::speed_t = 0o010006;
244+
pub const B921600: ::speed_t = 0o010007;
245+
pub const B1000000: ::speed_t = 0o010010;
246+
pub const B1152000: ::speed_t = 0o010011;
247+
pub const B1500000: ::speed_t = 0o010012;
248+
pub const B2000000: ::speed_t = 0o010013;
249+
pub const B2500000: ::speed_t = 0o010014;
250+
pub const B3000000: ::speed_t = 0o010015;
251+
pub const B3500000: ::speed_t = 0o010016;
252+
pub const B4000000: ::speed_t = 0o010017;
168253

169254
pub const O_APPEND: ::c_int = 1024;
170255
pub const O_CREAT: ::c_int = 64;

src/unix/notbsd/linux/musl/b32/mips.rs

+85
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ s! {
5454
pub ss_flags: ::c_int,
5555
}
5656

57+
pub struct ipc_perm {
58+
pub __ipc_perm_key: ::key_t,
59+
pub uid: ::uid_t,
60+
pub gid: ::gid_t,
61+
pub cuid: ::uid_t,
62+
pub cgid: ::gid_t,
63+
pub mode: ::mode_t,
64+
pub __seq: ::c_int,
65+
__unused1: ::c_long,
66+
__unused2: ::c_long
67+
}
68+
5769
pub struct shmid_ds {
5870
pub shm_perm: ::ipc_perm,
5971
pub shm_segsz: ::size_t,
@@ -162,6 +174,9 @@ s! {
162174
}
163175
}
164176

177+
pub const SIGSTKSZ: ::size_t = 8192;
178+
pub const MINSIGSTKSZ: ::size_t = 2048;
179+
165180
pub const O_DIRECT: ::c_int = 0o100000;
166181
pub const O_DIRECTORY: ::c_int = 0o200000;
167182
pub const O_NOFOLLOW: ::c_int = 0o400000;
@@ -176,6 +191,76 @@ pub const RLIMIT_NOFILE: ::c_int = 5;
176191
pub const RLIMIT_AS: ::c_int = 6;
177192
pub const RLIMIT_NPROC: ::c_int = 8;
178193
pub const RLIMIT_MEMLOCK: ::c_int = 9;
194+
pub const RLIMIT_NLIMITS: ::c_int = 16;
195+
196+
pub const MCL_CURRENT: ::c_int = 0x0001;
197+
pub const MCL_FUTURE: ::c_int = 0x0002;
198+
pub const CBAUD: ::tcflag_t = 0o0010017;
199+
pub const TAB1: ::c_int = 0x00000800;
200+
pub const TAB2: ::c_int = 0x00001000;
201+
pub const TAB3: ::c_int = 0x00001800;
202+
pub const CR1: ::c_int = 0x00000200;
203+
pub const CR2: ::c_int = 0x00000400;
204+
pub const CR3: ::c_int = 0x00000600;
205+
pub const FF1: ::c_int = 0x00008000;
206+
pub const BS1: ::c_int = 0x00002000;
207+
pub const VT1: ::c_int = 0x00004000;
208+
pub const VWERASE: usize = 14;
209+
pub const VREPRINT: usize = 12;
210+
pub const VSUSP: usize = 10;
211+
pub const VSTART: usize = 8;
212+
pub const VSTOP: usize = 9;
213+
pub const VDISCARD: usize = 13;
214+
pub const VTIME: usize = 5;
215+
pub const IXON: ::tcflag_t = 0x00000400;
216+
pub const IXOFF: ::tcflag_t = 0x00001000;
217+
pub const ONLCR: ::tcflag_t = 0x4;
218+
pub const CSIZE: ::tcflag_t = 0x00000030;
219+
pub const CS6: ::tcflag_t = 0x00000010;
220+
pub const CS7: ::tcflag_t = 0x00000020;
221+
pub const CS8: ::tcflag_t = 0x00000030;
222+
pub const CSTOPB: ::tcflag_t = 0x00000040;
223+
pub const CREAD: ::tcflag_t = 0x00000080;
224+
pub const PARENB: ::tcflag_t = 0x00000100;
225+
pub const PARODD: ::tcflag_t = 0x00000200;
226+
pub const HUPCL: ::tcflag_t = 0x00000400;
227+
pub const CLOCAL: ::tcflag_t = 0x00000800;
228+
pub const ECHOKE: ::tcflag_t = 0x00000800;
229+
pub const ECHOE: ::tcflag_t = 0x00000010;
230+
pub const ECHOK: ::tcflag_t = 0x00000020;
231+
pub const ECHONL: ::tcflag_t = 0x00000040;
232+
pub const ECHOPRT: ::tcflag_t = 0x00000400;
233+
pub const ECHOCTL: ::tcflag_t = 0x00000200;
234+
pub const ISIG: ::tcflag_t = 0x00000001;
235+
pub const ICANON: ::tcflag_t = 0x00000002;
236+
pub const PENDIN: ::tcflag_t = 0x00004000;
237+
pub const NOFLSH: ::tcflag_t = 0x00000080;
238+
pub const CIBAUD: ::tcflag_t = 0o02003600000;
239+
pub const CBAUDEX: ::tcflag_t = 0o010000;
240+
pub const VSWTC: usize = 7;
241+
pub const OLCUC: ::tcflag_t = 0o000002;
242+
pub const NLDLY: ::tcflag_t = 0o000400;
243+
pub const CRDLY: ::tcflag_t = 0o003000;
244+
pub const TABDLY: ::tcflag_t = 0o014000;
245+
pub const BSDLY: ::tcflag_t = 0o020000;
246+
pub const FFDLY: ::tcflag_t = 0o100000;
247+
pub const VTDLY: ::tcflag_t = 0o040000;
248+
pub const XTABS: ::tcflag_t = 0o014000;
249+
pub const B57600: ::speed_t = 0o010001;
250+
pub const B115200: ::speed_t = 0o010002;
251+
pub const B230400: ::speed_t = 0o010003;
252+
pub const B460800: ::speed_t = 0o010004;
253+
pub const B500000: ::speed_t = 0o010005;
254+
pub const B576000: ::speed_t = 0o010006;
255+
pub const B921600: ::speed_t = 0o010007;
256+
pub const B1000000: ::speed_t = 0o010010;
257+
pub const B1152000: ::speed_t = 0o010011;
258+
pub const B1500000: ::speed_t = 0o010012;
259+
pub const B2000000: ::speed_t = 0o010013;
260+
pub const B2500000: ::speed_t = 0o010014;
261+
pub const B3000000: ::speed_t = 0o010015;
262+
pub const B3500000: ::speed_t = 0o010016;
263+
pub const B4000000: ::speed_t = 0o010017;
179264

180265
pub const O_APPEND: ::c_int = 0o010;
181266
pub const O_CREAT: ::c_int = 0o400;

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

+4-84
Original file line numberDiff line numberDiff line change
@@ -32,96 +32,13 @@ s! {
3232
pub struct sem_t {
3333
__val: [::c_int; 4],
3434
}
35-
36-
pub struct ipc_perm {
37-
pub __ipc_perm_key: ::key_t,
38-
pub uid: ::uid_t,
39-
pub gid: ::gid_t,
40-
pub cuid: ::uid_t,
41-
pub cgid: ::gid_t,
42-
pub mode: ::mode_t,
43-
pub __seq: ::c_int,
44-
__unused1: ::c_long,
45-
__unused2: ::c_long
46-
}
4735
}
4836

49-
pub const SIGSTKSZ: ::size_t = 8192;
50-
pub const MINSIGSTKSZ: ::size_t = 2048;
51-
5237
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
5338
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
5439

55-
pub const RLIMIT_NLIMITS: ::c_int = 16;
5640
pub const TIOCINQ: ::c_int = ::FIONREAD;
57-
pub const MCL_CURRENT: ::c_int = 0x0001;
58-
pub const MCL_FUTURE: ::c_int = 0x0002;
59-
pub const CBAUD: ::tcflag_t = 0o0010017;
60-
pub const TAB1: ::c_int = 0x00000800;
61-
pub const TAB2: ::c_int = 0x00001000;
62-
pub const TAB3: ::c_int = 0x00001800;
63-
pub const CR1: ::c_int = 0x00000200;
64-
pub const CR2: ::c_int = 0x00000400;
65-
pub const CR3: ::c_int = 0x00000600;
66-
pub const FF1: ::c_int = 0x00008000;
67-
pub const BS1: ::c_int = 0x00002000;
68-
pub const VT1: ::c_int = 0x00004000;
69-
pub const VWERASE: usize = 14;
70-
pub const VREPRINT: usize = 12;
71-
pub const VSUSP: usize = 10;
72-
pub const VSTART: usize = 8;
73-
pub const VSTOP: usize = 9;
74-
pub const VDISCARD: usize = 13;
75-
pub const VTIME: usize = 5;
76-
pub const IXON: ::tcflag_t = 0x00000400;
77-
pub const IXOFF: ::tcflag_t = 0x00001000;
78-
pub const ONLCR: ::tcflag_t = 0x4;
79-
pub const CSIZE: ::tcflag_t = 0x00000030;
80-
pub const CS6: ::tcflag_t = 0x00000010;
81-
pub const CS7: ::tcflag_t = 0x00000020;
82-
pub const CS8: ::tcflag_t = 0x00000030;
83-
pub const CSTOPB: ::tcflag_t = 0x00000040;
84-
pub const CREAD: ::tcflag_t = 0x00000080;
85-
pub const PARENB: ::tcflag_t = 0x00000100;
86-
pub const PARODD: ::tcflag_t = 0x00000200;
87-
pub const HUPCL: ::tcflag_t = 0x00000400;
88-
pub const CLOCAL: ::tcflag_t = 0x00000800;
89-
pub const ECHOKE: ::tcflag_t = 0x00000800;
90-
pub const ECHOE: ::tcflag_t = 0x00000010;
91-
pub const ECHOK: ::tcflag_t = 0x00000020;
92-
pub const ECHONL: ::tcflag_t = 0x00000040;
93-
pub const ECHOPRT: ::tcflag_t = 0x00000400;
94-
pub const ECHOCTL: ::tcflag_t = 0x00000200;
95-
pub const ISIG: ::tcflag_t = 0x00000001;
96-
pub const ICANON: ::tcflag_t = 0x00000002;
97-
pub const PENDIN: ::tcflag_t = 0x00004000;
98-
pub const NOFLSH: ::tcflag_t = 0x00000080;
99-
pub const CIBAUD: ::tcflag_t = 0o02003600000;
100-
pub const CBAUDEX: ::tcflag_t = 0o010000;
101-
pub const VSWTC: usize = 7;
102-
pub const OLCUC: ::tcflag_t = 0o000002;
103-
pub const NLDLY: ::tcflag_t = 0o000400;
104-
pub const CRDLY: ::tcflag_t = 0o003000;
105-
pub const TABDLY: ::tcflag_t = 0o014000;
106-
pub const BSDLY: ::tcflag_t = 0o020000;
107-
pub const FFDLY: ::tcflag_t = 0o100000;
108-
pub const VTDLY: ::tcflag_t = 0o040000;
109-
pub const XTABS: ::tcflag_t = 0o014000;
110-
pub const B57600: ::speed_t = 0o010001;
111-
pub const B115200: ::speed_t = 0o010002;
112-
pub const B230400: ::speed_t = 0o010003;
113-
pub const B460800: ::speed_t = 0o010004;
114-
pub const B500000: ::speed_t = 0o010005;
115-
pub const B576000: ::speed_t = 0o010006;
116-
pub const B921600: ::speed_t = 0o010007;
117-
pub const B1000000: ::speed_t = 0o010010;
118-
pub const B1152000: ::speed_t = 0o010011;
119-
pub const B1500000: ::speed_t = 0o010012;
120-
pub const B2000000: ::speed_t = 0o010013;
121-
pub const B2500000: ::speed_t = 0o010014;
122-
pub const B3000000: ::speed_t = 0o010015;
123-
pub const B3500000: ::speed_t = 0o010016;
124-
pub const B4000000: ::speed_t = 0o010017;
41+
12542
extern {
12643
pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
12744
}
@@ -136,6 +53,9 @@ cfg_if! {
13653
} else if #[cfg(any(target_arch = "arm"))] {
13754
mod arm;
13855
pub use self::arm::*;
56+
} else if #[cfg(any(target_arch = "powerpc"))] {
57+
mod powerpc;
58+
pub use self::powerpc::*;
13959
} else {
14060
// Unknown target_arch
14161
}

0 commit comments

Comments
 (0)