Merge pull request #122 from brson/musl

Definitions for i686-unknown-linux-musl, arm and asmjs musl
This commit is contained in:
Alex Crichton 2016-01-29 17:10:36 -08:00
commit 86cd81ddc9
13 changed files with 232 additions and 97 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
target
Cargo.lock
*~

View File

@ -402,7 +402,9 @@ fn main() {
// just insert some padding.
(struct_ == "siginfo_t" && field == "_pad") ||
// musl names this __dummy1 but it's still there
(musl && struct_ == "glob_t" && field == "gl_flags")
(musl && struct_ == "glob_t" && field == "gl_flags") ||
// musl seems to define this as an *anonymous* bitfield
(musl && struct_ == "statvfs" && field == "__f_unused")
});
cfg.fn_cname(move |name, cname| {

View File

@ -23,6 +23,7 @@ pub type time64_t = i64;
pub type fsfilcnt_t = ::c_ulong;
pub type fsblkcnt_t = ::c_ulong;
pub type nfds_t = ::c_uint;
pub type rlim_t = c_ulong;
s! {
pub struct stat {
@ -468,6 +469,8 @@ pub const EFD_NONBLOCK: ::c_int = 0x800;
pub const F_GETLK: ::c_int = 5;
pub const F_GETOWN: ::c_int = 9;
pub const F_SETOWN: ::c_int = 8;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const TCGETS: ::c_int = 0x5401;
pub const TCSETS: ::c_int = 0x5402;

View File

@ -10,6 +10,9 @@ pub type ino_t = u32;
pub type blkcnt_t = i32;
pub type blksize_t = i32;
pub type nlink_t = u32;
pub type fsblkcnt_t = ::c_ulong;
pub type fsfilcnt_t = ::c_ulong;
pub type rlim_t = c_ulong;
s! {
pub struct stat {
@ -428,6 +431,8 @@ pub const EFD_NONBLOCK: ::c_int = 0x80;
pub const F_GETLK: ::c_int = 14;
pub const F_GETOWN: ::c_int = 23;
pub const F_SETOWN: ::c_int = 24;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const SFD_NONBLOCK: ::c_int = 0x80;

View File

@ -9,8 +9,6 @@ pub type ino64_t = u64;
pub type off64_t = i64;
pub type blkcnt64_t = i64;
pub type rlim64_t = u64;
pub type fsblkcnt_t = ::c_ulong;
pub type fsfilcnt_t = ::c_ulong;
pub type key_t = ::c_int;
pub type shmatt_t = ::c_ulong;
pub type mqd_t = ::c_int;

View File

@ -0,0 +1,2 @@
pub type c_char = u8;
pub type wchar_t = u32;

View File

@ -0,0 +1,2 @@
pub type c_char = u8;
pub type wchar_t = u32;

View File

@ -0,0 +1,97 @@
pub type c_long = i32;
pub type c_ulong = u32;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
pub const F_GETLK: ::c_int = 12;
pub const F_SETLK: ::c_int = 13;
pub const F_SETLKW: ::c_int = 14;
s! {
pub struct stat {
pub st_dev: ::dev_t,
__st_dev_padding: ::c_int,
__st_ino_truncated: ::c_long,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
__st_rdev_padding: ::c_int,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt_t,
pub st_atim: ::timespec,
pub st_mtim: ::timespec,
pub st_ctim: ::timespec,
pub st_ino: ::ino_t,
}
pub struct stat64 {
pub st_dev: ::dev_t,
__st_dev_padding: ::c_int,
__st_ino_truncated: ::c_long,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
__st_rdev_padding: ::c_int,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt_t,
pub st_atim: ::timespec,
pub st_mtim: ::timespec,
pub st_ctim: ::timespec,
pub st_ino: ::ino_t,
}
pub struct pthread_attr_t {
__size: [u32; 9]
}
pub struct sigset_t {
__val: [::c_ulong; 32],
}
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
pub shm_atime: ::time_t,
__unused1: ::c_int,
pub shm_dtime: ::time_t,
__unused2: ::c_int,
pub shm_ctime: ::time_t,
__unused3: ::c_int,
pub shm_cpid: ::pid_t,
pub shm_lpid: ::pid_t,
pub shm_nattch: ::c_ulong,
__pad1: ::c_ulong,
__pad2: ::c_ulong,
}
pub struct msghdr {
pub msg_name: *mut ::c_void,
pub msg_namelen: ::socklen_t,
pub msg_iov: *mut ::iovec,
pub msg_iovlen: ::c_int,
pub msg_control: *mut ::c_void,
pub msg_controllen: ::socklen_t,
pub msg_flags: ::c_int,
}
}
cfg_if! {
if #[cfg(any(target_arch = "x86"))] {
mod x86;
pub use self::x86::*;
} else if #[cfg(any(target_arch = "arm"))] {
mod arm;
pub use self::arm::*;
} else if #[cfg(any(target_arch = "asmjs"))] {
mod asmjs;
pub use self::asmjs::*;
} else { }
}

View File

@ -0,0 +1,2 @@
pub type c_char = i8;
pub type wchar_t = i32;

View File

@ -0,0 +1,88 @@
pub type c_char = i8;
pub type wchar_t = i32;
pub type c_long = i64;
pub type c_ulong = u64;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const F_GETLK: ::c_int = 5;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
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,
__pad0: ::c_int,
pub st_rdev: ::dev_t,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt_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,
__unused: [::c_long; 3],
}
pub struct stat64 {
pub st_dev: ::dev_t,
pub st_ino: ::ino64_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
__pad0: ::c_int,
pub st_rdev: ::dev_t,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt64_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,
__reserved: [::c_long; 3],
}
pub struct pthread_attr_t {
__size: [u64; 7]
}
pub struct sigset_t {
__val: [::c_ulong; 16],
}
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: ::c_ulong,
__pad1: ::c_ulong,
__pad2: ::c_ulong,
}
pub struct msghdr {
pub msg_name: *mut ::c_void,
pub msg_namelen: ::socklen_t,
pub msg_iov: *mut ::iovec,
pub msg_iovlen: ::c_int,
__pad1: ::c_int,
pub msg_control: *mut ::c_void,
pub msg_controllen: ::socklen_t,
__pad2: ::socklen_t,
pub msg_flags: ::c_int,
}
}

View File

@ -1,67 +1,17 @@
pub type c_long = i64;
pub type c_ulong = u64;
pub type clock_t = i64;
pub type time_t = i64;
pub type suseconds_t = i64;
pub type clock_t = c_long;
pub type time_t = c_long;
pub type suseconds_t = c_long;
pub type ino_t = u64;
pub type off_t = i64;
pub type blkcnt_t = i64;
pub type c_char = i8;
pub type wchar_t = i32;
pub type nlink_t = u64;
pub type blksize_t = i64;
pub type nlink_t = usize;
pub type blksize_t = c_long;
pub type fsblkcnt_t = ::c_ulonglong;
pub type fsfilcnt_t = ::c_ulonglong;
pub type rlim_t = ::c_ulonglong;
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,
__pad0: ::c_int,
pub st_rdev: ::dev_t,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt_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,
__unused: [::c_long; 3],
}
pub struct stat64 {
pub st_dev: ::dev_t,
pub st_ino: ::ino64_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
__pad0: ::c_int,
pub st_rdev: ::dev_t,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt64_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,
__reserved: [::c_long; 3],
}
pub struct pthread_attr_t {
__size: [u64; 7]
}
pub struct sigset_t {
__val: [::c_ulong; 16],
}
pub struct sigaction {
pub sa_sigaction: ::sighandler_t,
pub sa_mask: ::sigset_t,
@ -95,19 +45,6 @@ s! {
__unused2: ::c_long
}
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: ::c_ulong,
__pad1: ::c_ulong,
__pad2: ::c_ulong,
}
pub struct statfs {
pub f_type: ::c_ulong,
pub f_bsize: ::c_ulong,
@ -123,18 +60,6 @@ s! {
pub f_spare: [::c_ulong; 4],
}
pub struct msghdr {
pub msg_name: *mut ::c_void,
pub msg_namelen: ::socklen_t,
pub msg_iov: *mut ::iovec,
pub msg_iovlen: ::c_int,
__pad1: ::c_int,
pub msg_control: *mut ::c_void,
pub msg_controllen: ::socklen_t,
__pad2: ::socklen_t,
pub msg_flags: ::c_int,
}
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
@ -353,10 +278,6 @@ pub const SIG_UNBLOCK: ::c_int = 0x01;
pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
pub const _SC_2_C_VERSION: ::c_int = 96;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
pub const CPU_SETSIZE: ::c_int = 128;
@ -407,7 +328,6 @@ pub const PTRACE_SETREGS: ::c_uint = 13;
pub const EFD_NONBLOCK: ::c_int = 0x800;
pub const F_GETLK: ::c_int = 5;
pub const F_GETOWN: ::c_int = 9;
pub const F_SETOWN: ::c_int = 8;
@ -469,3 +389,15 @@ extern {
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
pub fn ptrace(request: ::c_int, ...) -> ::c_long;
}
cfg_if! {
if #[cfg(any(target_arch = "x86_64"))] {
mod b64;
pub use self::b64::*;
} else if #[cfg(any(target_arch = "x86",
target_arch = "arm",
target_arch = "asmjs"))] {
mod b32;
pub use self::b32::*;
} else { }
}

View File

@ -1,3 +1,7 @@
pub type fsblkcnt_t = ::c_ulong;
pub type fsfilcnt_t = ::c_ulong;
pub type rlim_t = c_ulong;
s! {
pub struct sigaction {
pub sa_sigaction: ::sighandler_t,
@ -354,6 +358,8 @@ pub const EFD_NONBLOCK: ::c_int = 0x800;
pub const F_GETLK: ::c_int = 5;
pub const F_GETOWN: ::c_int = 9;
pub const F_SETOWN: ::c_int = 8;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const SFD_NONBLOCK: ::c_int = 0x0800;

View File

@ -1,6 +1,5 @@
use dox::mem;
pub type rlim_t = c_ulong;
pub type sa_family_t = u16;
pub type pthread_key_t = ::c_uint;
pub type speed_t = ::c_uint;
@ -108,7 +107,8 @@ s! {
pub dli_saddr: *mut ::c_void,
}
#[cfg_attr(any(target_arch = "x86", target_arch = "x86_64"),
#[cfg_attr(any(all(target_arch = "x86", not(target_env = "musl")),
target_arch = "x86_64"),
repr(packed))]
pub struct epoll_event {
pub events: ::uint32_t,
@ -425,9 +425,6 @@ pub const CBAUD: ::tcflag_t = 0o0010017;
pub const EFD_CLOEXEC: ::c_int = 0x80000;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const MNT_FORCE: ::c_int = 0x1;
pub const Q_SYNC: ::c_int = 0x800001;