Skip to content

Clean libc-test for apple targets #1274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
320 changes: 197 additions & 123 deletions libc-test/build.rs

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions libc-test/test/linux_fcntl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#![allow(bad_style, improper_ctypes, unused)]
#![allow(bad_style, improper_ctypes, unused, deprecated)]

extern crate libc;

use libc::*;

#[cfg(any(target_os = "linux", target_os = "android"))]
include!(concat!(env!("OUT_DIR"), "/linux_fcntl.rs"));

#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn main() {}
2 changes: 1 addition & 1 deletion libc-test/test/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(bad_style, improper_ctypes)]
#![allow(bad_style, improper_ctypes, deprecated)]
extern crate libc;

use libc::*;
Expand Down
15 changes: 15 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ s! {
}

pub struct sigaction {
// FIXME: this field is actually a union
pub sa_sigaction: ::sighandler_t,
pub sa_mask: sigset_t,
pub sa_flags: ::c_int,
Expand Down Expand Up @@ -2255,12 +2256,14 @@ pub const NOTE_NONE: ::uint32_t = 0x00000080;
pub const NOTE_EXIT: ::uint32_t = 0x80000000;
pub const NOTE_FORK: ::uint32_t = 0x40000000;
pub const NOTE_EXEC: ::uint32_t = 0x20000000;
#[deprecated(since="0.2.49", note="Deprecated since MacOSX 10.9")]
pub const NOTE_REAP: ::uint32_t = 0x10000000;
pub const NOTE_SIGNAL: ::uint32_t = 0x08000000;
pub const NOTE_EXITSTATUS: ::uint32_t = 0x04000000;
pub const NOTE_EXIT_DETAIL: ::uint32_t = 0x02000000;
pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
pub const NOTE_PCTRLMASK: ::uint32_t = 0xfff00000;
#[deprecated(since="0.2.49", note="Deprecated since MacOSX 10.9")]
pub const NOTE_EXIT_REPARENTED: ::uint32_t = 0x00080000;
pub const NOTE_EXIT_DETAIL_MASK: ::uint32_t = 0x00070000;
pub const NOTE_EXIT_DECRYPTFAIL: ::uint32_t = 0x00010000;
Expand Down Expand Up @@ -2466,7 +2469,9 @@ pub const KERN_KDSETRTCDEC: ::c_int = 15;
pub const KERN_KDGETENTROPY: ::c_int = 16;
pub const KERN_KDWRITETR: ::c_int = 17;
pub const KERN_KDWRITEMAP: ::c_int = 18;
#[deprecated(since = "0.2.49", note ="Removed in MacOSX 10.12")]
pub const KERN_KDENABLE_BG_TRACE: ::c_int = 19;
#[deprecated(since = "0.2.49", note ="Removed in MacOSX 10.12")]
pub const KERN_KDDISABLE_BG_TRACE: ::c_int = 20;
pub const KERN_KDREADCURTHRMAP: ::c_int = 21;
pub const KERN_KDSET_TYPEFILTER: ::c_int = 22;
Expand Down Expand Up @@ -2846,6 +2851,16 @@ f! {
}

extern {
#[deprecated(since="0.2.49", note="Deprecated in MacOSX 10.5")]
#[link_name = "daemon$1050"]
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
#[deprecated(since="0.2.49", note="Deprecated in MacOSX 10.10")]
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
#[deprecated(since="0.2.49", note="Deprecated in MacOSX 10.10")]
pub fn sem_init(sem: *mut sem_t,
pshared: ::c_int,
value: ::c_uint)
-> ::c_int;
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
Expand Down
8 changes: 8 additions & 0 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,14 @@ f! {
}

extern {
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
pub fn sem_init(sem: *mut sem_t,
pshared: ::c_int,
value: ::c_uint)
-> ::c_int;

pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;

pub fn accept4(s: ::c_int, addr: *mut ::sockaddr,
addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int;
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
Expand Down
1 change: 0 additions & 1 deletion src/unix/bsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,6 @@ extern {
pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int;
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
#[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
pub fn getpwnam_r(name: *const ::c_char,
Expand Down
7 changes: 7 additions & 0 deletions src/unix/bsd/netbsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,13 @@ pub const TIMER_ABSTIME: ::c_int = 1;

#[link(name = "util")]
extern {
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
pub fn sem_init(sem: *mut sem_t,
pshared: ::c_int,
value: ::c_uint)
-> ::c_int;

pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
vec: *mut ::c_char) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_getres50")]
Expand Down
6 changes: 6 additions & 0 deletions src/unix/haiku/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,12 @@ extern {

#[link(name = "bsd")]
extern {
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
pub fn sem_init(sem: *mut sem_t,
pshared: ::c_int,
value: ::c_uint)
-> ::c_int;

pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int;
pub fn clock_settime(clk_id: ::c_int, tp: *const ::timespec) -> ::c_int;
pub fn pthread_create(thread: *mut ::pthread_t,
Expand Down
6 changes: 6 additions & 0 deletions src/unix/hermit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,12 @@ f! {
}

extern {
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
pub fn sem_init(sem: *mut sem_t,
pshared: ::c_int,
value: ::c_uint)
-> ::c_int;

pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
pub fn labs(i: ::c_long) -> ::c_long;
Expand Down
5 changes: 0 additions & 5 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1021,16 +1021,11 @@ extern {
locale: *const ::c_char) -> *mut ::c_char;
pub fn localeconv() -> *mut lconv;

pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "sem_wait$UNIX2003")]
pub fn sem_wait(sem: *mut sem_t) -> ::c_int;
pub fn sem_trywait(sem: *mut sem_t) -> ::c_int;
pub fn sem_post(sem: *mut sem_t) -> ::c_int;
pub fn sem_init(sem: *mut sem_t,
pshared: ::c_int,
value: ::c_uint)
-> ::c_int;
pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;

Expand Down
6 changes: 6 additions & 0 deletions src/unix/newlib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,12 @@ f! {
}

extern {
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
pub fn sem_init(sem: *mut sem_t,
pshared: ::c_int,
value: ::c_uint)
-> ::c_int;

pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
pub fn labs(i: ::c_long) -> ::c_long;
Expand Down
6 changes: 6 additions & 0 deletions src/unix/notbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,12 @@ f! {
}

extern {
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
pub fn sem_init(sem: *mut sem_t,
pshared: ::c_int,
value: ::c_uint)
-> ::c_int;

pub fn fdatasync(fd: ::c_int) -> ::c_int;
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
vec: *mut ::c_uchar) -> ::c_int;
Expand Down
6 changes: 6 additions & 0 deletions src/unix/solarish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1557,6 +1557,12 @@ f! {
}

extern {
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
pub fn sem_init(sem: *mut sem_t,
pshared: ::c_int,
value: ::c_uint)
-> ::c_int;

pub fn abs(i: ::c_int) -> ::c_int;
pub fn acct(filename: *const ::c_char) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
Expand Down
6 changes: 6 additions & 0 deletions src/unix/uclibc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,12 @@ f! {
}

extern {
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
pub fn sem_init(sem: *mut sem_t,
pshared: ::c_int,
value: ::c_uint)
-> ::c_int;

pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
pub fn labs(i: ::c_long) -> ::c_long;
Expand Down