Skip to content

Commit 3635c1a

Browse files
authored
Auto merge of rust-lang#377 - japaric:s390x, r=alexcrichton
add support for s390x tested by running libc-test on real s390x hardware. r? @alexcrichton
2 parents 955aa6d + 756d7ee commit 3635c1a

File tree

8 files changed

+233
-4
lines changed

8 files changed

+233
-4
lines changed

src/unix/notbsd/android/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ pub const USER_PROCESS: ::c_short = 7;
136136
pub const BUFSIZ: ::c_uint = 1024;
137137
pub const FILENAME_MAX: ::c_uint = 1024;
138138
pub const FOPEN_MAX: ::c_uint = 20;
139+
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
140+
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
139141
pub const L_tmpnam: ::c_uint = 1024;
140142
pub const TMP_MAX: ::c_uint = 308915776;
141143
pub const _PC_LINK_MAX: ::c_int = 1;

src/unix/notbsd/linux/mips.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ s! {
203203
pub const BUFSIZ: ::c_uint = 8192;
204204
pub const TMP_MAX: ::c_uint = 238328;
205205
pub const FOPEN_MAX: ::c_uint = 16;
206+
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
207+
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
206208
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
207209
pub const _SC_2_C_VERSION: ::c_int = 96;
208210
pub const RUSAGE_THREAD: ::c_int = 1;

src/unix/notbsd/linux/mips64.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ pub const O_APPEND: ::c_int = 8;
196196
pub const O_CREAT: ::c_int = 256;
197197
pub const O_EXCL: ::c_int = 1024;
198198
pub const O_NONBLOCK: ::c_int = 128;
199+
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
200+
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
199201
pub const PTHREAD_STACK_MIN: ::size_t = 131072;
200202
pub const RLIM_INFINITY: ::rlim_t = 0xffffffffffffffff;
201203
pub const SA_ONSTACK: ::c_int = 0x08000000;

src/unix/notbsd/linux/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ s! {
8686

8787
pub struct pthread_mutexattr_t {
8888
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
89-
target_arch = "mips64"))]
89+
target_arch = "mips64", target_arch = "s390x"))]
9090
__align: [::c_int; 0],
9191
#[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
92-
target_arch = "mips64")))]
92+
target_arch = "mips64", target_arch = "s390x")))]
9393
__align: [::c_long; 0],
9494
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
9595
}
@@ -670,6 +670,9 @@ cfg_if! {
670670
} else if #[cfg(any(target_arch = "mips", target_arch = "mipsel"))] {
671671
mod mips;
672672
pub use self::mips::*;
673+
} else if #[cfg(any(target_arch = "s390x"))] {
674+
mod s390x;
675+
pub use self::s390x::*;
673676
} else if #[cfg(any(target_arch = "mips64"))] {
674677
mod mips64;
675678
pub use self::mips64::*;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ pub const O_ACCMODE: ::c_int = 0o10000003;
7474
pub const O_NDELAY: ::c_int = O_NONBLOCK;
7575
pub const NI_MAXHOST: ::socklen_t = 255;
7676
pub const PTHREAD_STACK_MIN: ::size_t = 2048;
77+
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
78+
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
7779

7880
pub const RLIM_INFINITY: ::rlim_t = !0;
7981
pub const RLIMIT_RTTIME: ::c_int = 15;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
356356
pub const BUFSIZ: ::c_uint = 8192;
357357
pub const TMP_MAX: ::c_uint = 238328;
358358
pub const FOPEN_MAX: ::c_uint = 16;
359+
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
360+
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
359361
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
360362
pub const _SC_2_C_VERSION: ::c_int = 96;
361363
pub const RUSAGE_THREAD: ::c_int = 1;

src/unix/notbsd/linux/s390x.rs

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
pub type blkcnt_t = i64;
2+
pub type blksize_t = i64;
3+
pub type c_char = u8;
4+
pub type c_long = i64;
5+
pub type c_ulong = u64;
6+
pub type fsblkcnt_t = u64;
7+
pub type fsfilcnt_t = u64;
8+
pub type ino_t = u64;
9+
pub type nlink_t = u64;
10+
pub type off_t = i64;
11+
pub type rlim_t = u64;
12+
pub type suseconds_t = i64;
13+
pub type time_t = i64;
14+
pub type wchar_t = i32;
15+
16+
s! {
17+
pub struct stat {
18+
pub st_dev: ::dev_t,
19+
pub st_ino: ::ino_t,
20+
pub st_nlink: ::nlink_t,
21+
pub st_mode: ::mode_t,
22+
pub st_uid: ::uid_t,
23+
pub st_gid: ::gid_t,
24+
st_pad0: ::c_int,
25+
pub st_rdev: ::dev_t,
26+
pub st_size: ::off_t,
27+
pub st_atime: ::time_t,
28+
pub st_atime_nsec: ::c_long,
29+
pub st_mtime: ::time_t,
30+
pub st_mtime_nsec: ::c_long,
31+
pub st_ctime: ::time_t,
32+
pub st_ctime_nsec: ::c_long,
33+
pub st_blksize: ::blksize_t,
34+
pub st_blocks: ::blkcnt_t,
35+
__glibc_reserved: [::c_int; 5],
36+
}
37+
38+
pub struct stat64 {
39+
pub st_dev: ::dev_t,
40+
pub st_ino: ::ino_t,
41+
pub st_nlink: ::nlink_t,
42+
pub st_mode: ::mode_t,
43+
pub st_uid: ::uid_t,
44+
pub st_gid: ::gid_t,
45+
st_pad0: ::c_int,
46+
pub st_rdev: ::dev_t,
47+
pub st_size: ::off_t,
48+
pub st_atime: ::time_t,
49+
pub st_atime_nsec: ::c_long,
50+
pub st_mtime: ::time_t,
51+
pub st_mtime_nsec: ::c_long,
52+
pub st_ctime: ::time_t,
53+
pub st_ctime_nsec: ::c_long,
54+
pub st_blksize: ::blksize_t,
55+
pub st_blocks: ::blkcnt_t,
56+
__glibc_reserved: [::c_int; 5],
57+
}
58+
59+
pub struct pthread_attr_t {
60+
__size: [::c_ulong; 7]
61+
}
62+
63+
pub struct sigaction {
64+
pub sa_sigaction: ::sighandler_t,
65+
pub sa_flags: ::c_ulong,
66+
_restorer: *mut ::c_void,
67+
pub sa_mask: sigset_t,
68+
}
69+
70+
pub struct stack_t {
71+
pub ss_sp: *mut ::c_void,
72+
pub ss_flags: ::c_int,
73+
pub ss_size: ::size_t,
74+
}
75+
76+
pub struct sigset_t {
77+
__size: [::c_ulong; 16],
78+
}
79+
80+
pub struct siginfo_t {
81+
pub si_signo: ::c_int,
82+
pub si_errno: ::c_int,
83+
pub si_code: ::c_int,
84+
_pad: ::c_int,
85+
_pad2: [::c_long; 14],
86+
}
87+
88+
pub struct ipc_perm {
89+
pub __key: ::key_t,
90+
pub uid: ::uid_t,
91+
pub gid: ::gid_t,
92+
pub cuid: ::uid_t,
93+
pub cgid: ::gid_t,
94+
pub mode: ::c_uint,
95+
pub __seq: ::c_ushort,
96+
__pad1: ::c_ushort,
97+
__unused1: ::c_ulong,
98+
__unused2: ::c_ulong
99+
}
100+
101+
pub struct shmid_ds {
102+
pub shm_perm: ::ipc_perm,
103+
pub shm_segsz: ::size_t,
104+
pub shm_atime: ::time_t,
105+
pub shm_dtime: ::time_t,
106+
pub shm_ctime: ::time_t,
107+
pub shm_cpid: ::pid_t,
108+
pub shm_lpid: ::pid_t,
109+
pub shm_nattch: ::shmatt_t,
110+
__unused4: ::c_ulong,
111+
__unused5: ::c_ulong
112+
}
113+
114+
pub struct statfs {
115+
pub f_type: ::c_uint,
116+
pub f_bsize: ::c_uint,
117+
pub f_blocks: ::fsblkcnt_t,
118+
pub f_bfree: ::fsblkcnt_t,
119+
pub f_bavail: ::fsblkcnt_t,
120+
pub f_files: ::fsblkcnt_t,
121+
pub f_ffree: ::fsblkcnt_t,
122+
pub f_fsid: ::fsid_t,
123+
pub f_namelen: ::c_uint,
124+
pub f_frsize: ::c_uint,
125+
pub f_flags: ::c_uint,
126+
f_spare: [::c_uint; 4],
127+
}
128+
129+
pub struct msghdr {
130+
pub msg_name: *mut ::c_void,
131+
pub msg_namelen: ::socklen_t,
132+
pub msg_iov: *mut ::iovec,
133+
pub msg_iovlen: ::size_t,
134+
pub msg_control: *mut ::c_void,
135+
pub msg_controllen: ::size_t,
136+
pub msg_flags: ::c_int,
137+
}
138+
139+
pub struct termios {
140+
pub c_iflag: ::tcflag_t,
141+
pub c_oflag: ::tcflag_t,
142+
pub c_cflag: ::tcflag_t,
143+
pub c_lflag: ::tcflag_t,
144+
pub c_line: ::cc_t,
145+
pub c_cc: [::cc_t; ::NCCS],
146+
pub c_ispeed: ::speed_t,
147+
pub c_ospeed: ::speed_t,
148+
}
149+
150+
pub struct sysinfo {
151+
pub uptime: ::c_long,
152+
pub loads: [::c_ulong; 3],
153+
pub totalram: ::c_ulong,
154+
pub freeram: ::c_ulong,
155+
pub sharedram: ::c_ulong,
156+
pub bufferram: ::c_ulong,
157+
pub totalswap: ::c_ulong,
158+
pub freeswap: ::c_ulong,
159+
pub procs: ::c_ushort,
160+
pub pad: ::c_ushort,
161+
pub totalhigh: ::c_ulong,
162+
pub freehigh: ::c_ulong,
163+
pub mem_unit: ::c_uint,
164+
pub _f: [::c_char; 0],
165+
}
166+
167+
// FIXME this is actually a union
168+
pub struct sem_t {
169+
__size: [::c_char; 32],
170+
__align: [::c_long; 0],
171+
}
172+
}
173+
174+
pub const POSIX_FADV_DONTNEED: ::c_int = 6;
175+
pub const POSIX_FADV_NOREUSE: ::c_int = 7;
176+
177+
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
178+
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
179+
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
180+
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
181+
182+
pub const EADDRINUSE: ::c_int = 98;
183+
pub const EADDRNOTAVAIL: ::c_int = 99;
184+
pub const ECONNABORTED: ::c_int = 103;
185+
pub const ECONNREFUSED: ::c_int = 111;
186+
pub const ECONNRESET: ::c_int = 104;
187+
pub const EDEADLK: ::c_int = 35;
188+
pub const ENOSYS: ::c_int = 38;
189+
pub const ENOTCONN: ::c_int = 107;
190+
pub const ETIMEDOUT: ::c_int = 110;
191+
pub const FIOCLEX: ::c_ulong = 0x5451;
192+
pub const FIONBIO: ::c_ulong = 0x5421;
193+
pub const MAP_ANON: ::c_int = 0x20;
194+
pub const O_ACCMODE: ::c_int = 3;
195+
pub const O_APPEND: ::c_int = 1024;
196+
pub const O_CREAT: ::c_int = 64;
197+
pub const O_EXCL: ::c_int = 128;
198+
pub const O_NONBLOCK: ::c_int = 2048;
199+
pub const PTHREAD_STACK_MIN: ::size_t = 16384;
200+
pub const RLIM_INFINITY: ::rlim_t = 0xffffffffffffffff;
201+
pub const SA_ONSTACK: ::c_ulong = 0x08000000;
202+
pub const SA_SIGINFO: ::c_ulong = 4;
203+
pub const SIGBUS: ::c_int = 7;
204+
pub const SIGSTKSZ: ::size_t = 0x2000;
205+
pub const SIG_SETMASK: ::c_int = 2;
206+
pub const SOCK_DGRAM: ::c_int = 2;
207+
pub const SOCK_STREAM: ::c_int = 1;
208+
pub const SOL_SOCKET: ::c_int = 1;
209+
pub const SO_BROADCAST: ::c_int = 6;
210+
pub const SO_ERROR: ::c_int = 4;
211+
pub const SO_RCVTIMEO: ::c_int = 20;
212+
pub const SO_REUSEADDR: ::c_int = 2;
213+
pub const SO_SNDTIMEO: ::c_int = 21;
214+
215+
#[link(name = "util")]
216+
extern {
217+
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
218+
}

src/unix/notbsd/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,8 +613,6 @@ pub const POSIX_FADV_NORMAL: ::c_int = 0;
613613
pub const POSIX_FADV_RANDOM: ::c_int = 1;
614614
pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
615615
pub const POSIX_FADV_WILLNEED: ::c_int = 3;
616-
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
617-
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
618616

619617
pub const AT_FDCWD: ::c_int = -100;
620618
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;

0 commit comments

Comments
 (0)