Skip to content

Commit 9aa6600

Browse files
committed
Merge pull request #133 from antonblanchard/powerpc64_merge
Add powerpc64 and powerpc64le support
2 parents 04d93c9 + c4f676b commit 9aa6600

File tree

8 files changed

+142
-14
lines changed

8 files changed

+142
-14
lines changed

src/unix/notbsd/linux/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ s! {
8484
}
8585

8686
pub struct pthread_mutexattr_t {
87-
#[cfg(target_arch = "x86_64")]
87+
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
88+
target_arch = "powerpc64le"))]
8889
__align: [::c_int; 0],
89-
#[cfg(not(target_arch = "x86_64"))]
90+
#[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
91+
target_arch = "powerpc64le")))]
9092
__align: [::c_long; 0],
9193
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
9294
}

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,17 @@ pub type wchar_t = u32;
44
pub const O_DIRECT: ::c_int = 0x10000;
55
pub const O_DIRECTORY: ::c_int = 0x4000;
66
pub const O_NOFOLLOW: ::c_int = 0x8000;
7+
8+
pub const MAP_LOCKED: ::c_int = 0x02000;
9+
pub const MAP_NORESERVE: ::c_int = 0x04000;
10+
11+
pub const EDEADLOCK: ::c_int = 35;
12+
13+
pub const SO_PEERCRED: ::c_int = 17;
14+
pub const SO_RCVLOWAT: ::c_int = 18;
15+
pub const SO_SNDLOWAT: ::c_int = 19;
16+
pub const SO_RCVTIMEO: ::c_int = 20;
17+
pub const SO_SNDTIMEO: ::c_int = 21;
18+
19+
pub const FIOCLEX: ::c_ulong = 0x5451;
20+
pub const FIONBIO: ::c_ulong = 0x5421;

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,17 @@ pub type wchar_t = i32;
44
pub const O_DIRECT: ::c_int = 0x4000;
55
pub const O_DIRECTORY: ::c_int = 0x10000;
66
pub const O_NOFOLLOW: ::c_int = 0x20000;
7+
8+
pub const MAP_LOCKED: ::c_int = 0x02000;
9+
pub const MAP_NORESERVE: ::c_int = 0x04000;
10+
11+
pub const EDEADLOCK: ::c_int = 35;
12+
13+
pub const SO_PEERCRED: ::c_int = 17;
14+
pub const SO_RCVLOWAT: ::c_int = 18;
15+
pub const SO_SNDLOWAT: ::c_int = 19;
16+
pub const SO_RCVTIMEO: ::c_int = 20;
17+
pub const SO_SNDTIMEO: ::c_int = 21;
18+
19+
pub const FIOCLEX: ::c_ulong = 0x5451;
20+
pub const FIONBIO: ::c_ulong = 0x5421;

src/unix/notbsd/linux/other/b64/aarch64.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ pub const O_DIRECT: ::c_int = 0x10000;
1212
pub const O_DIRECTORY: ::c_int = 0x4000;
1313
pub const O_NOFOLLOW: ::c_int = 0x8000;
1414

15+
pub const MAP_LOCKED: ::c_int = 0x02000;
16+
pub const MAP_NORESERVE: ::c_int = 0x04000;
17+
18+
pub const EDEADLOCK: ::c_int = 35;
19+
20+
pub const SO_PEERCRED: ::c_int = 17;
21+
pub const SO_RCVLOWAT: ::c_int = 18;
22+
pub const SO_SNDLOWAT: ::c_int = 19;
23+
pub const SO_RCVTIMEO: ::c_int = 20;
24+
pub const SO_SNDTIMEO: ::c_int = 21;
25+
26+
pub const FIOCLEX: ::c_ulong = 0x5451;
27+
pub const FIONBIO: ::c_ulong = 0x5421;
28+
1529
s! {
1630
pub struct stat {
1731
pub st_dev: ::dev_t,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ cfg_if! {
2222
if #[cfg(target_arch = "aarch64")] {
2323
mod aarch64;
2424
pub use self::aarch64::*;
25+
} else if #[cfg(any(target_arch = "powerpc64", target_arch = "powerpc64le"))] {
26+
mod powerpc64;
27+
pub use self::powerpc64::*;
2528
} else {
2629
mod x86_64;
2730
pub use self::x86_64::*;
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
//! PowerPC64-specific definitions for 64-bit linux-like values
2+
3+
pub type c_char = u8;
4+
pub type wchar_t = u32;
5+
pub type nlink_t = u64;
6+
pub type blksize_t = i64;
7+
8+
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
9+
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
10+
11+
pub const O_DIRECTORY: ::c_int = 0x4000;
12+
pub const O_NOFOLLOW: ::c_int = 0x8000;
13+
pub const O_DIRECT: ::c_int = 0x20000;
14+
15+
pub const MAP_LOCKED: ::c_int = 0x00080;
16+
pub const MAP_NORESERVE: ::c_int = 0x00040;
17+
18+
pub const EDEADLOCK: ::c_int = 58;
19+
20+
pub const SO_PEERCRED: ::c_int = 21;
21+
pub const SO_RCVLOWAT: ::c_int = 16;
22+
pub const SO_SNDLOWAT: ::c_int = 17;
23+
pub const SO_RCVTIMEO: ::c_int = 18;
24+
pub const SO_SNDTIMEO: ::c_int = 19;
25+
26+
pub const FIOCLEX: ::c_ulong = 0x20006601;
27+
pub const FIONBIO: ::c_ulong = 0x8004667e;
28+
29+
s! {
30+
pub struct stat {
31+
pub st_dev: ::dev_t,
32+
pub st_ino: ::ino_t,
33+
pub st_nlink: ::nlink_t,
34+
pub st_mode: ::mode_t,
35+
pub st_uid: ::uid_t,
36+
pub st_gid: ::gid_t,
37+
__pad0: ::c_int,
38+
pub st_rdev: ::dev_t,
39+
pub st_size: ::off_t,
40+
pub st_blksize: ::blksize_t,
41+
pub st_blocks: ::blkcnt_t,
42+
pub st_atime: ::time_t,
43+
pub st_atime_nsec: ::c_long,
44+
pub st_mtime: ::time_t,
45+
pub st_mtime_nsec: ::c_long,
46+
pub st_ctime: ::time_t,
47+
pub st_ctime_nsec: ::c_long,
48+
__unused: [::c_long; 3],
49+
}
50+
51+
pub struct stat64 {
52+
pub st_dev: ::dev_t,
53+
pub st_ino: ::ino64_t,
54+
pub st_nlink: ::nlink_t,
55+
pub st_mode: ::mode_t,
56+
pub st_uid: ::uid_t,
57+
pub st_gid: ::gid_t,
58+
__pad0: ::c_int,
59+
pub st_rdev: ::dev_t,
60+
pub st_size: ::off64_t,
61+
pub st_blksize: ::blksize_t,
62+
pub st_blocks: ::blkcnt64_t,
63+
pub st_atime: ::time_t,
64+
pub st_atime_nsec: ::c_long,
65+
pub st_mtime: ::time_t,
66+
pub st_mtime_nsec: ::c_long,
67+
pub st_ctime: ::time_t,
68+
pub st_ctime_nsec: ::c_long,
69+
__reserved: [::c_long; 3],
70+
}
71+
72+
pub struct pthread_attr_t {
73+
__size: [u64; 7]
74+
}
75+
}

src/unix/notbsd/linux/other/b64/x86_64.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ pub const O_DIRECT: ::c_int = 0x4000;
1212
pub const O_DIRECTORY: ::c_int = 0x10000;
1313
pub const O_NOFOLLOW: ::c_int = 0x20000;
1414

15+
pub const MAP_LOCKED: ::c_int = 0x02000;
16+
pub const MAP_NORESERVE: ::c_int = 0x04000;
17+
18+
pub const EDEADLOCK: ::c_int = 35;
19+
20+
pub const SO_PEERCRED: ::c_int = 17;
21+
pub const SO_RCVLOWAT: ::c_int = 18;
22+
pub const SO_SNDLOWAT: ::c_int = 19;
23+
pub const SO_RCVTIMEO: ::c_int = 20;
24+
pub const SO_SNDTIMEO: ::c_int = 21;
25+
26+
pub const FIOCLEX: ::c_ulong = 0x5451;
27+
pub const FIONBIO: ::c_ulong = 0x5421;
28+
1529
pub const PTRACE_GETFPREGS: ::c_uint = 14;
1630
pub const PTRACE_SETFPREGS: ::c_uint = 15;
1731
pub const PTRACE_GETFPXREGS: ::c_uint = 18;

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ pub const MAP_ANONYMOUS: ::c_int = 0x0020;
110110
pub const MAP_GROWSDOWN: ::c_int = 0x0100;
111111
pub const MAP_DENYWRITE: ::c_int = 0x0800;
112112
pub const MAP_EXECUTABLE: ::c_int = 0x01000;
113-
pub const MAP_LOCKED: ::c_int = 0x02000;
114-
pub const MAP_NORESERVE: ::c_int = 0x04000;
115113
pub const MAP_POPULATE: ::c_int = 0x08000;
116114
pub const MAP_NONBLOCK: ::c_int = 0x010000;
117115
pub const MAP_STACK: ::c_int = 0x020000;
@@ -138,7 +136,6 @@ pub const EXFULL: ::c_int = 54;
138136
pub const ENOANO: ::c_int = 55;
139137
pub const EBADRQC: ::c_int = 56;
140138
pub const EBADSLT: ::c_int = 57;
141-
pub const EDEADLOCK: ::c_int = EDEADLK;
142139
pub const EMULTIHOP: ::c_int = 72;
143140
pub const EOVERFLOW: ::c_int = 75;
144141
pub const ENOTUNIQ: ::c_int = 76;
@@ -217,11 +214,6 @@ pub const SO_KEEPALIVE: ::c_int = 9;
217214
pub const SO_OOBINLINE: ::c_int = 10;
218215
pub const SO_LINGER: ::c_int = 13;
219216
pub const SO_REUSEPORT: ::c_int = 15;
220-
pub const SO_PEERCRED: ::c_int = 17;
221-
pub const SO_RCVLOWAT: ::c_int = 18;
222-
pub const SO_SNDLOWAT: ::c_int = 19;
223-
pub const SO_RCVTIMEO: ::c_int = 20;
224-
pub const SO_SNDTIMEO: ::c_int = 21;
225217
pub const SO_ACCEPTCONN: ::c_int = 30;
226218

227219
pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15;
@@ -267,9 +259,6 @@ pub const SIG_UNBLOCK: ::c_int = 0x01;
267259
pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
268260
pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
269261

270-
pub const FIOCLEX: ::c_ulong = 0x5451;
271-
pub const FIONBIO: ::c_ulong = 0x5421;
272-
273262
pub const BUFSIZ: ::c_uint = 8192;
274263
pub const TMP_MAX: ::c_uint = 238328;
275264
pub const FOPEN_MAX: ::c_uint = 16;
@@ -443,7 +432,10 @@ cfg_if! {
443432
if #[cfg(any(target_arch = "x86", target_arch = "arm"))] {
444433
mod b32;
445434
pub use self::b32::*;
446-
} else if #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] {
435+
} else if #[cfg(any(target_arch = "x86_64",
436+
target_arch = "aarch64",
437+
target_arch = "powerpc64",
438+
target_arch = "powerpc64le"))] {
447439
mod b64;
448440
pub use self::b64::*;
449441
} else {

0 commit comments

Comments
 (0)