summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-12-06 01:20:34 +0000
committerbors <bors@rust-lang.org>2016-12-06 01:20:34 +0000
commit411cafc47c3ca1e7f89c3891ec76308918e33f00 (patch)
tree4ccbed3bf70bb1483a8dc46fc44c0b7a0b07983f
parent3274c923e4791e5b8451bfa5c02423d24a692bdf (diff)
parent51cc3b7d38fe5718a011d4f648da159ee88a6c77 (diff)
downloadrust-libc-411cafc47c3ca1e7f89c3891ec76308918e33f00.tar.gz
Auto merge of #464 - mneumann:dragonfly-fixes-2016-12, r=alexcrichton
Dragonfly fixes 2016-12 This fixes libc again for DragonFly.
-rw-r--r--libc-test/build.rs4
-rw-r--r--src/unix/bsd/freebsdlike/dragonfly/mod.rs68
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs49
-rw-r--r--src/unix/bsd/freebsdlike/mod.rs47
4 files changed, 115 insertions, 53 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 7b241dcb73..a48590462e 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -216,7 +216,7 @@ fn main() {
cfg.header("sys/ioctl_compat.h");
}
- if linux || freebsd || netbsd || apple {
+ if linux || freebsd || dragonfly || netbsd || apple {
cfg.header("aio.h");
}
@@ -315,7 +315,7 @@ fn main() {
"uuid_t" if dragonfly => true,
n if n.starts_with("pthread") => true,
// sem_t is a struct or pointer
- "sem_t" if openbsd || freebsd || rumprun => true,
+ "sem_t" if openbsd || freebsd || dragonfly || rumprun => true,
// windows-isms
n if n.starts_with("P") => true,
diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index 3a91bca008..7cf8afbd95 100644
--- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -14,7 +14,34 @@ pub type uuid_t = ::uuid;
pub type fsblkcnt_t = u64;
pub type fsfilcnt_t = u64;
+pub type sem_t = *mut sem;
+
+pub enum sem {}
+
s! {
+
+ pub struct exit_status {
+ pub e_termination: u16,
+ pub e_exit: u16
+ }
+
+ pub struct utmpx {
+ pub ut_name: [::c_char; 32],
+ pub ut_id: [::c_char; 4],
+
+ pub ut_line: [::c_char; 32],
+ pub ut_host: [::c_char; 256],
+
+ pub ut_unused: [u8; 16],
+ pub ut_session: u16,
+ pub ut_type: u16,
+ pub ut_pid: ::pid_t,
+ ut_exit: exit_status,
+ ut_ss: ::sockaddr_storage,
+ pub ut_tv: ::timeval,
+ pub ut_unused2: [u8; 16],
+ }
+
pub struct aiocb {
pub aio_fildes: ::c_int,
pub aio_offset: ::off_t,
@@ -47,11 +74,15 @@ s! {
pub struct sigevent {
pub sigev_notify: ::c_int,
- pub sigev_signo: ::c_int, //actually a union
+ // The union is 8-byte in size, so it is aligned at a 8-byte offset.
#[cfg(target_pointer_width = "64")]
__unused1: ::c_int,
+ pub sigev_signo: ::c_int, //actually a union
+ // pad the union
+ #[cfg(target_pointer_width = "64")]
+ __unused2: ::c_int,
pub sigev_value: ::sigval,
- __unused2: *mut ::c_void //actually a function pointer
+ __unused3: *mut ::c_void //actually a function pointer
}
pub struct statvfs {
@@ -271,7 +302,6 @@ pub const EVFILT_VNODE: ::int16_t = -4;
pub const EVFILT_PROC: ::int16_t = -5;
pub const EVFILT_SIGNAL: ::int16_t = -6;
pub const EVFILT_TIMER: ::int16_t = -7;
-pub const EVFILT_PROCDESC: ::int16_t = -8;
pub const EVFILT_USER: ::int16_t = -9;
pub const EVFILT_FS: ::int16_t = -10;
@@ -314,11 +344,41 @@ pub const NOTE_TRACK: ::uint32_t = 0x00000001;
pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
pub const NOTE_CHILD: ::uint32_t = 0x00000004;
-pub const MSG_NOSIGNAL: ::uint32_t = 0x400;
+pub const MSG_NOSIGNAL: ::c_int = 0x400;
+
+pub const EMPTY: ::c_short = 0;
+pub const RUN_LVL: ::c_short = 1;
+pub const BOOT_TIME: ::c_short = 2;
+pub const OLD_TIME: ::c_short = 3;
+pub const NEW_TIME: ::c_short = 4;
+pub const INIT_PROCESS: ::c_short = 5;
+pub const LOGIN_PROCESS: ::c_short = 6;
+pub const USER_PROCESS: ::c_short = 7;
+pub const DEAD_PROCESS: ::c_short = 8;
+
+pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
+pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
+pub const LC_MONETARY_MASK: ::c_int = (1 << 2);
+pub const LC_NUMERIC_MASK: ::c_int = (1 << 3);
+pub const LC_TIME_MASK: ::c_int = (1 << 4);
+pub const LC_MESSAGES_MASK: ::c_int = (1 << 5);
+pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
+ | LC_CTYPE_MASK
+ | LC_MESSAGES_MASK
+ | LC_MONETARY_MASK
+ | LC_NUMERIC_MASK
+ | LC_TIME_MASK;
extern {
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
+
+ pub fn setutxdb(_type: ::c_uint, file: *mut ::c_char) -> ::c_int;
+
+ pub fn aio_waitcomplete(iocbp: *mut *mut aiocb,
+ timeout: *mut ::timespec) -> ::c_int;
+
+ pub fn freelocale(loc: ::locale_t);
}
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index 9cd0a34ba2..47132121c1 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -5,11 +5,23 @@ pub type lwpid_t = i32;
pub type nlink_t = u16;
pub type blksize_t = u32;
pub type clockid_t = ::c_int;
+pub type sem_t = _sem;
pub type fsblkcnt_t = ::uint64_t;
pub type fsfilcnt_t = ::uint64_t;
s! {
+ pub struct utmpx {
+ pub ut_type: ::c_short,
+ pub ut_tv: ::timeval,
+ pub ut_id: [::c_char; 8],
+ pub ut_pid: ::pid_t,
+ pub ut_user: [::c_char; 32],
+ pub ut_line: [::c_char; 16],
+ pub ut_host: [::c_char; 128],
+ pub __ut_spare: [::c_char; 64],
+ }
+
pub struct aiocb {
pub aio_fildes: ::c_int,
pub aio_offset: ::off_t,
@@ -59,12 +71,18 @@ s! {
pub f_fsid: ::c_ulong,
pub f_namemax: ::c_ulong,
}
+
+ // internal structure has changed over time
+ pub struct _sem {
+ data: [u32; 4],
+ }
}
pub const SIGEV_THREAD_ID: ::c_int = 4;
pub const RAND_MAX: ::c_int = 0x7fff_fffd;
pub const PTHREAD_STACK_MIN: ::size_t = 2048;
+pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4;
pub const SIGSTKSZ: ::size_t = 34816;
pub const SF_NODISKIO: ::c_int = 0x00000001;
pub const SF_MNOWAIT: ::c_int = 0x00000002;
@@ -315,6 +333,29 @@ pub const CTL_P1003_1B_MAXID: ::c_int = 26;
pub const MSG_NOSIGNAL: ::c_int = 0x20000;
+pub const EMPTY: ::c_short = 0;
+pub const BOOT_TIME: ::c_short = 1;
+pub const OLD_TIME: ::c_short = 2;
+pub const NEW_TIME: ::c_short = 3;
+pub const USER_PROCESS: ::c_short = 4;
+pub const INIT_PROCESS: ::c_short = 5;
+pub const LOGIN_PROCESS: ::c_short = 6;
+pub const DEAD_PROCESS: ::c_short = 7;
+pub const SHUTDOWN_TIME: ::c_short = 8;
+
+pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
+pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
+pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
+pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
+pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
+pub const LC_TIME_MASK: ::c_int = (1 << 5);
+pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
+ | LC_CTYPE_MASK
+ | LC_MESSAGES_MASK
+ | LC_MONETARY_MASK
+ | LC_NUMERIC_MASK
+ | LC_TIME_MASK;
+
extern {
pub fn __error() -> *mut ::c_int;
@@ -332,6 +373,14 @@ extern {
pub fn mkostemps(template: *mut ::c_char,
suffixlen: ::c_int,
flags: ::c_int) -> ::c_int;
+
+ pub fn getutxuser(user: *const ::c_char) -> *mut utmpx;
+ pub fn setutxdb(_type: ::c_int, file: *const ::c_char) -> ::c_int;
+
+ pub fn aio_waitcomplete(iocbp: *mut *mut aiocb,
+ timeout: *mut ::timespec) -> ::ssize_t;
+
+ pub fn freelocale(loc: ::locale_t) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs
index 0e8d69adb8..9fa9ebad04 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -12,22 +12,10 @@ pub type tcflag_t = ::c_uint;
pub type speed_t = ::c_uint;
pub type nl_item = ::c_int;
pub type id_t = i64;
-pub type sem_t = _sem;
pub enum timezone {}
s! {
- pub struct utmpx {
- pub ut_type: ::c_short,
- pub ut_tv: ::timeval,
- pub ut_id: [::c_char; 8],
- pub ut_pid: ::pid_t,
- pub ut_user: [::c_char; 32],
- pub ut_line: [::c_char; 16],
- pub ut_host: [::c_char; 128],
- pub __ut_spare: [::c_char; 64],
- }
-
pub struct glob_t {
pub gl_pathc: ::size_t,
pub gl_matchc: ::size_t,
@@ -170,11 +158,6 @@ s! {
pub int_p_sign_posn: ::c_char,
pub int_n_sign_posn: ::c_char,
}
-
- // internal structure has changed over time
- pub struct _sem {
- data: [u32; 4],
- }
}
pub const AIO_LISTIO_MAX: ::c_int = 16;
@@ -192,29 +175,6 @@ pub const SIGEV_SIGNAL: ::c_int = 1;
pub const SIGEV_THREAD: ::c_int = 2;
pub const SIGEV_KEVENT: ::c_int = 3;
-pub const EMPTY: ::c_short = 0;
-pub const BOOT_TIME: ::c_short = 1;
-pub const OLD_TIME: ::c_short = 2;
-pub const NEW_TIME: ::c_short = 3;
-pub const USER_PROCESS: ::c_short = 4;
-pub const INIT_PROCESS: ::c_short = 5;
-pub const LOGIN_PROCESS: ::c_short = 6;
-pub const DEAD_PROCESS: ::c_short = 7;
-pub const SHUTDOWN_TIME: ::c_short = 8;
-
-pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
-pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
-pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
-pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
-pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
-pub const LC_TIME_MASK: ::c_int = (1 << 5);
-pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
- | LC_CTYPE_MASK
- | LC_MESSAGES_MASK
- | LC_MONETARY_MASK
- | LC_NUMERIC_MASK
- | LC_TIME_MASK;
-
pub const CODESET: ::nl_item = 0;
pub const D_T_FMT: ::nl_item = 1;
pub const D_FMT: ::nl_item = 2;
@@ -706,7 +666,6 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3;
-pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4;
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_ERRORCHECK;
pub const SCHED_FIFO: ::c_int = 1;
@@ -756,8 +715,6 @@ extern {
pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
pub fn setutxent();
- pub fn getutxuser(user: *const ::c_char) -> *mut utmpx;
- pub fn setutxdb(_type: ::c_int, file: *const ::c_char) -> ::c_int;
}
#[link(name = "util")]
@@ -772,9 +729,6 @@ extern {
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
- pub fn aio_waitcomplete(iocbp: *mut *mut aiocb,
- timeout: *mut ::timespec) -> ::ssize_t;
-
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
@@ -839,7 +793,6 @@ extern {
winp: *mut ::winsize) -> ::pid_t;
pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
pub fn duplocale(base: ::locale_t) -> ::locale_t;
- pub fn freelocale(loc: ::locale_t) -> ::c_int;
pub fn newlocale(mask: ::c_int,
locale: *const ::c_char,
base: ::locale_t) -> ::locale_t;