summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-09-02 23:58:26 -0700
committerGitHub <noreply@github.com>2016-09-02 23:58:26 -0700
commit3635c1a9398160bb6540d7289b16a547be0f02b3 (patch)
tree98741db4602c21c39486a55c184a1aa55081617c
parent955aa6d7ab71f732109bf58c87891e95ae39a090 (diff)
parent756d7eeefe2d719fbf77667edf2477976aeb0aed (diff)
downloadrust-libc-3635c1a9398160bb6540d7289b16a547be0f02b3.tar.gz
Auto merge of #377 - japaric:s390x, r=alexcrichton
add support for s390x tested by running libc-test on real s390x hardware. r? @alexcrichton
-rw-r--r--src/unix/notbsd/android/mod.rs2
-rw-r--r--src/unix/notbsd/linux/mips.rs2
-rw-r--r--src/unix/notbsd/linux/mips64.rs2
-rw-r--r--src/unix/notbsd/linux/mod.rs7
-rw-r--r--src/unix/notbsd/linux/musl/mod.rs2
-rw-r--r--src/unix/notbsd/linux/other/mod.rs2
-rw-r--r--src/unix/notbsd/linux/s390x.rs218
-rw-r--r--src/unix/notbsd/mod.rs2
8 files changed, 233 insertions, 4 deletions
diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs
index 11013312b7..43e5e5a304 100644
--- a/src/unix/notbsd/android/mod.rs
+++ b/src/unix/notbsd/android/mod.rs
@@ -136,6 +136,8 @@ pub const USER_PROCESS: ::c_short = 7;
pub const BUFSIZ: ::c_uint = 1024;
pub const FILENAME_MAX: ::c_uint = 1024;
pub const FOPEN_MAX: ::c_uint = 20;
+pub const POSIX_FADV_DONTNEED: ::c_int = 4;
+pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const L_tmpnam: ::c_uint = 1024;
pub const TMP_MAX: ::c_uint = 308915776;
pub const _PC_LINK_MAX: ::c_int = 1;
diff --git a/src/unix/notbsd/linux/mips.rs b/src/unix/notbsd/linux/mips.rs
index a2143d5e20..17100961b6 100644
--- a/src/unix/notbsd/linux/mips.rs
+++ b/src/unix/notbsd/linux/mips.rs
@@ -203,6 +203,8 @@ s! {
pub const BUFSIZ: ::c_uint = 8192;
pub const TMP_MAX: ::c_uint = 238328;
pub const FOPEN_MAX: ::c_uint = 16;
+pub const POSIX_FADV_DONTNEED: ::c_int = 4;
+pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const _SC_2_C_VERSION: ::c_int = 96;
pub const RUSAGE_THREAD: ::c_int = 1;
diff --git a/src/unix/notbsd/linux/mips64.rs b/src/unix/notbsd/linux/mips64.rs
index 7c51dffba4..ed1423fb15 100644
--- a/src/unix/notbsd/linux/mips64.rs
+++ b/src/unix/notbsd/linux/mips64.rs
@@ -196,6 +196,8 @@ pub const O_APPEND: ::c_int = 8;
pub const O_CREAT: ::c_int = 256;
pub const O_EXCL: ::c_int = 1024;
pub const O_NONBLOCK: ::c_int = 128;
+pub const POSIX_FADV_DONTNEED: ::c_int = 4;
+pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const PTHREAD_STACK_MIN: ::size_t = 131072;
pub const RLIM_INFINITY: ::rlim_t = 0xffffffffffffffff;
pub const SA_ONSTACK: ::c_int = 0x08000000;
diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs
index 33738f4beb..eedb395bd2 100644
--- a/src/unix/notbsd/linux/mod.rs
+++ b/src/unix/notbsd/linux/mod.rs
@@ -86,10 +86,10 @@ s! {
pub struct pthread_mutexattr_t {
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
- target_arch = "mips64"))]
+ target_arch = "mips64", target_arch = "s390x"))]
__align: [::c_int; 0],
#[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
- target_arch = "mips64")))]
+ target_arch = "mips64", target_arch = "s390x")))]
__align: [::c_long; 0],
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
}
@@ -670,6 +670,9 @@ cfg_if! {
} else if #[cfg(any(target_arch = "mips", target_arch = "mipsel"))] {
mod mips;
pub use self::mips::*;
+ } else if #[cfg(any(target_arch = "s390x"))] {
+ mod s390x;
+ pub use self::s390x::*;
} else if #[cfg(any(target_arch = "mips64"))] {
mod mips64;
pub use self::mips64::*;
diff --git a/src/unix/notbsd/linux/musl/mod.rs b/src/unix/notbsd/linux/musl/mod.rs
index b9fb3d42f3..ab4d8af1f7 100644
--- a/src/unix/notbsd/linux/musl/mod.rs
+++ b/src/unix/notbsd/linux/musl/mod.rs
@@ -74,6 +74,8 @@ pub const O_ACCMODE: ::c_int = 0o10000003;
pub const O_NDELAY: ::c_int = O_NONBLOCK;
pub const NI_MAXHOST: ::socklen_t = 255;
pub const PTHREAD_STACK_MIN: ::size_t = 2048;
+pub const POSIX_FADV_DONTNEED: ::c_int = 4;
+pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const RLIM_INFINITY: ::rlim_t = !0;
pub const RLIMIT_RTTIME: ::c_int = 15;
diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs
index ac3e0c3979..39bd9574c0 100644
--- a/src/unix/notbsd/linux/other/mod.rs
+++ b/src/unix/notbsd/linux/other/mod.rs
@@ -356,6 +356,8 @@ pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
pub const BUFSIZ: ::c_uint = 8192;
pub const TMP_MAX: ::c_uint = 238328;
pub const FOPEN_MAX: ::c_uint = 16;
+pub const POSIX_FADV_DONTNEED: ::c_int = 4;
+pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const _SC_2_C_VERSION: ::c_int = 96;
pub const RUSAGE_THREAD: ::c_int = 1;
diff --git a/src/unix/notbsd/linux/s390x.rs b/src/unix/notbsd/linux/s390x.rs
new file mode 100644
index 0000000000..4c875aeff1
--- /dev/null
+++ b/src/unix/notbsd/linux/s390x.rs
@@ -0,0 +1,218 @@
+pub type blkcnt_t = i64;
+pub type blksize_t = i64;
+pub type c_char = u8;
+pub type c_long = i64;
+pub type c_ulong = u64;
+pub type fsblkcnt_t = u64;
+pub type fsfilcnt_t = u64;
+pub type ino_t = u64;
+pub type nlink_t = u64;
+pub type off_t = i64;
+pub type rlim_t = u64;
+pub type suseconds_t = i64;
+pub type time_t = i64;
+pub type wchar_t = i32;
+
+s! {
+ pub struct stat {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_nlink: ::nlink_t,
+ pub st_mode: ::mode_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ st_pad0: ::c_int,
+ pub st_rdev: ::dev_t,
+ pub st_size: ::off_t,
+ pub st_atime: ::time_t,
+ pub st_atime_nsec: ::c_long,
+ pub st_mtime: ::time_t,
+ pub st_mtime_nsec: ::c_long,
+ pub st_ctime: ::time_t,
+ pub st_ctime_nsec: ::c_long,
+ pub st_blksize: ::blksize_t,
+ pub st_blocks: ::blkcnt_t,
+ __glibc_reserved: [::c_int; 5],
+ }
+
+ pub struct stat64 {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_nlink: ::nlink_t,
+ pub st_mode: ::mode_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ st_pad0: ::c_int,
+ pub st_rdev: ::dev_t,
+ pub st_size: ::off_t,
+ pub st_atime: ::time_t,
+ pub st_atime_nsec: ::c_long,
+ pub st_mtime: ::time_t,
+ pub st_mtime_nsec: ::c_long,
+ pub st_ctime: ::time_t,
+ pub st_ctime_nsec: ::c_long,
+ pub st_blksize: ::blksize_t,
+ pub st_blocks: ::blkcnt_t,
+ __glibc_reserved: [::c_int; 5],
+ }
+
+ pub struct pthread_attr_t {
+ __size: [::c_ulong; 7]
+ }
+
+ pub struct sigaction {
+ pub sa_sigaction: ::sighandler_t,
+ pub sa_flags: ::c_ulong,
+ _restorer: *mut ::c_void,
+ pub sa_mask: sigset_t,
+ }
+
+ pub struct stack_t {
+ pub ss_sp: *mut ::c_void,
+ pub ss_flags: ::c_int,
+ pub ss_size: ::size_t,
+ }
+
+ pub struct sigset_t {
+ __size: [::c_ulong; 16],
+ }
+
+ pub struct siginfo_t {
+ pub si_signo: ::c_int,
+ pub si_errno: ::c_int,
+ pub si_code: ::c_int,
+ _pad: ::c_int,
+ _pad2: [::c_long; 14],
+ }
+
+ pub struct ipc_perm {
+ pub __key: ::key_t,
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub cuid: ::uid_t,
+ pub cgid: ::gid_t,
+ pub mode: ::c_uint,
+ pub __seq: ::c_ushort,
+ __pad1: ::c_ushort,
+ __unused1: ::c_ulong,
+ __unused2: ::c_ulong
+ }
+
+ pub struct shmid_ds {
+ pub shm_perm: ::ipc_perm,
+ pub shm_segsz: ::size_t,
+ pub shm_atime: ::time_t,
+ pub shm_dtime: ::time_t,
+ pub shm_ctime: ::time_t,
+ pub shm_cpid: ::pid_t,
+ pub shm_lpid: ::pid_t,
+ pub shm_nattch: ::shmatt_t,
+ __unused4: ::c_ulong,
+ __unused5: ::c_ulong
+ }
+
+ pub struct statfs {
+ pub f_type: ::c_uint,
+ pub f_bsize: ::c_uint,
+ pub f_blocks: ::fsblkcnt_t,
+ pub f_bfree: ::fsblkcnt_t,
+ pub f_bavail: ::fsblkcnt_t,
+ pub f_files: ::fsblkcnt_t,
+ pub f_ffree: ::fsblkcnt_t,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::c_uint,
+ pub f_frsize: ::c_uint,
+ pub f_flags: ::c_uint,
+ f_spare: [::c_uint; 4],
+ }
+
+ pub struct msghdr {
+ pub msg_name: *mut ::c_void,
+ pub msg_namelen: ::socklen_t,
+ pub msg_iov: *mut ::iovec,
+ pub msg_iovlen: ::size_t,
+ pub msg_control: *mut ::c_void,
+ pub msg_controllen: ::size_t,
+ pub msg_flags: ::c_int,
+ }
+
+ pub struct termios {
+ pub c_iflag: ::tcflag_t,
+ pub c_oflag: ::tcflag_t,
+ pub c_cflag: ::tcflag_t,
+ pub c_lflag: ::tcflag_t,
+ pub c_line: ::cc_t,
+ pub c_cc: [::cc_t; ::NCCS],
+ pub c_ispeed: ::speed_t,
+ pub c_ospeed: ::speed_t,
+ }
+
+ pub struct sysinfo {
+ pub uptime: ::c_long,
+ pub loads: [::c_ulong; 3],
+ pub totalram: ::c_ulong,
+ pub freeram: ::c_ulong,
+ pub sharedram: ::c_ulong,
+ pub bufferram: ::c_ulong,
+ pub totalswap: ::c_ulong,
+ pub freeswap: ::c_ulong,
+ pub procs: ::c_ushort,
+ pub pad: ::c_ushort,
+ pub totalhigh: ::c_ulong,
+ pub freehigh: ::c_ulong,
+ pub mem_unit: ::c_uint,
+ pub _f: [::c_char; 0],
+ }
+
+ // FIXME this is actually a union
+ pub struct sem_t {
+ __size: [::c_char; 32],
+ __align: [::c_long; 0],
+ }
+}
+
+pub const POSIX_FADV_DONTNEED: ::c_int = 6;
+pub const POSIX_FADV_NOREUSE: ::c_int = 7;
+
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
+
+pub const EADDRINUSE: ::c_int = 98;
+pub const EADDRNOTAVAIL: ::c_int = 99;
+pub const ECONNABORTED: ::c_int = 103;
+pub const ECONNREFUSED: ::c_int = 111;
+pub const ECONNRESET: ::c_int = 104;
+pub const EDEADLK: ::c_int = 35;
+pub const ENOSYS: ::c_int = 38;
+pub const ENOTCONN: ::c_int = 107;
+pub const ETIMEDOUT: ::c_int = 110;
+pub const FIOCLEX: ::c_ulong = 0x5451;
+pub const FIONBIO: ::c_ulong = 0x5421;
+pub const MAP_ANON: ::c_int = 0x20;
+pub const O_ACCMODE: ::c_int = 3;
+pub const O_APPEND: ::c_int = 1024;
+pub const O_CREAT: ::c_int = 64;
+pub const O_EXCL: ::c_int = 128;
+pub const O_NONBLOCK: ::c_int = 2048;
+pub const PTHREAD_STACK_MIN: ::size_t = 16384;
+pub const RLIM_INFINITY: ::rlim_t = 0xffffffffffffffff;
+pub const SA_ONSTACK: ::c_ulong = 0x08000000;
+pub const SA_SIGINFO: ::c_ulong = 4;
+pub const SIGBUS: ::c_int = 7;
+pub const SIGSTKSZ: ::size_t = 0x2000;
+pub const SIG_SETMASK: ::c_int = 2;
+pub const SOCK_DGRAM: ::c_int = 2;
+pub const SOCK_STREAM: ::c_int = 1;
+pub const SOL_SOCKET: ::c_int = 1;
+pub const SO_BROADCAST: ::c_int = 6;
+pub const SO_ERROR: ::c_int = 4;
+pub const SO_RCVTIMEO: ::c_int = 20;
+pub const SO_REUSEADDR: ::c_int = 2;
+pub const SO_SNDTIMEO: ::c_int = 21;
+
+#[link(name = "util")]
+extern {
+ pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
+}
diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs
index a3d60ca6cc..5f205c663e 100644
--- a/src/unix/notbsd/mod.rs
+++ b/src/unix/notbsd/mod.rs
@@ -613,8 +613,6 @@ pub const POSIX_FADV_NORMAL: ::c_int = 0;
pub const POSIX_FADV_RANDOM: ::c_int = 1;
pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
pub const POSIX_FADV_WILLNEED: ::c_int = 3;
-pub const POSIX_FADV_DONTNEED: ::c_int = 4;
-pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const AT_FDCWD: ::c_int = -100;
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;