Skip to content

Commit 07a9206

Browse files
committed
Merge pull request rust-lang#205 from alexcrichton/merge
Rebase a few PRs in the queue
2 parents 2a48d49 + 87d0076 commit 07a9206

File tree

10 files changed

+70
-11
lines changed

10 files changed

+70
-11
lines changed

libc-test/build.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ fn main() {
132132

133133
if linux {
134134
cfg.header("mqueue.h");
135+
cfg.header("ucontext.h");
135136
cfg.header("sys/signalfd.h");
136137
cfg.header("sys/xattr.h");
137138
cfg.header("sys/ipc.h");
@@ -350,10 +351,6 @@ fn main() {
350351
// they're implemented on rumprun yet, just let them slide for now.
351352
// Some of them look like they have headers but then don't have
352353
// corresponding actual definitions either...
353-
"backtrace" |
354-
"pthread_main_np" |
355-
"pthread_set_name_np" |
356-
"pthread_stackseg_np" |
357354
"shm_open" |
358355
"shm_unlink" |
359356
"syscall" |

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
))]
7575

7676
// Attributes needed when building as part of the standard library
77-
#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute))]
77+
#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute, cfg_target_vendor))]
7878
#![cfg_attr(stdbuild, no_std)]
7979
#![cfg_attr(stdbuild, staged_api)]
8080
#![cfg_attr(stdbuild, allow(warnings))]

src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ macro_rules! cfg_if {
2323
macro_rules! __cfg_if_items {
2424
(($($not:meta,)*) ; ) => {};
2525
(($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => {
26-
__cfg_if_apply! { cfg(all($($m,)* not(any($($not),*)))), $($it)* }
26+
__cfg_if_apply! { cfg(all(not(any($($not),*)), $($m,)*)), $($it)* }
2727
__cfg_if_items! { ($($not,)* $($m,)*) ; $($rest)* }
2828
}
2929
}

src/unix/bsd/openbsdlike/bitrig.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ extern {
227227
flags: ::c_int) -> ::c_int;
228228
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
229229
-> ::c_int;
230+
pub fn pthread_main_np() -> ::c_int;
231+
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
232+
pub fn pthread_stackseg_np(thread: ::pthread_t,
233+
sinfo: *mut ::stack_t) -> ::c_int;
230234
pub fn sysctl(name: *mut ::c_int,
231235
namelen: ::c_uint,
232236
oldp: *mut ::c_void,

src/unix/bsd/openbsdlike/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,10 @@ extern {
384384
pub fn __errno() -> *mut ::c_int;
385385
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
386386
-> ::c_int;
387-
pub fn pthread_main_np() -> ::c_int;
388-
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
389-
pub fn pthread_stackseg_np(thread: ::pthread_t,
390-
sinfo: *mut ::stack_t) -> ::c_int;
391387
pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
392388
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
393389
pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
390+
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
394391
}
395392

396393
cfg_if! {

src/unix/bsd/openbsdlike/openbsd.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ extern {
232232
flags: ::c_int) -> ::c_int;
233233
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
234234
-> ::c_int;
235+
pub fn pthread_main_np() -> ::c_int;
236+
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
237+
pub fn pthread_stackseg_np(thread: ::pthread_t,
238+
sinfo: *mut ::stack_t) -> ::c_int;
235239
pub fn sysctl(name: *const ::c_int,
236240
namelen: ::c_uint,
237241
oldp: *mut ::c_void,

src/unix/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ cfg_if! {
143143
} else if #[cfg(target_os = "emscripten")] {
144144
#[link(name = "c")]
145145
extern {}
146+
} else if #[cfg(all(target_vendor = "rumprun", target_os = "netbsd"))] {
147+
// Since we don't use -nodefaultlibs on Rumprun, libc is always pulled in
148+
// automatically by the linker. We avoid passing it explicitly, as it
149+
// causes some versions of binutils to crash with an assertion failure.
150+
#[link(name = "m")]
151+
extern {}
146152
} else if #[cfg(any(target_os = "macos",
147153
target_os = "ios",
148154
target_os = "android",
@@ -688,6 +694,7 @@ extern {
688694
pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
689695
pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
690696
pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char;
697+
pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
691698
}
692699

693700
cfg_if! {

src/unix/notbsd/linux/other/b32/x86.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,27 @@ pub const SO_SNDTIMEO: ::c_int = 21;
1818

1919
pub const FIOCLEX: ::c_ulong = 0x5451;
2020
pub const FIONBIO: ::c_ulong = 0x5421;
21+
22+
s! {
23+
24+
pub struct mcontext_t {
25+
__private: [u32; 22]
26+
}
27+
28+
pub struct ucontext_t {
29+
pub uc_flags: ::c_ulong,
30+
pub uc_link: *mut ucontext_t,
31+
pub uc_stack: ::stack_t,
32+
pub uc_mcontext: mcontext_t,
33+
pub uc_sigmask: ::sigset_t,
34+
__private: [u8; 112],
35+
}
36+
37+
}
38+
39+
extern {
40+
pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
41+
pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;
42+
pub fn makecontext(ucp: *mut ucontext_t, func: extern fn (), argc: ::c_int, ...);
43+
pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> ::c_int;
44+
}

src/unix/notbsd/linux/other/b64/x86_64.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,29 @@ s! {
7979
pub struct pthread_attr_t {
8080
__size: [u64; 7]
8181
}
82+
83+
}
84+
85+
s! {
86+
87+
pub struct mcontext_t {
88+
__private: [u64; 32],
89+
}
90+
91+
pub struct ucontext_t {
92+
pub uc_flags: ::c_ulong,
93+
pub uc_link: *mut ucontext_t,
94+
pub uc_stack: ::stack_t,
95+
pub uc_mcontext: mcontext_t,
96+
pub uc_sigmask: ::sigset_t,
97+
__private: [u8; 512],
98+
}
99+
100+
}
101+
102+
extern {
103+
pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
104+
pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;
105+
pub fn makecontext(ucp: *mut ucontext_t, func: extern fn (), argc: ::c_int, ...);
106+
pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> ::c_int;
82107
}

src/unix/notbsd/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,9 @@ extern {
653653
nr_segs: ::size_t,
654654
flags: ::c_uint) -> ::ssize_t;
655655

656-
pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
656+
pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
657657
advise: ::c_int) -> ::c_int;
658+
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
658659
}
659660

660661
cfg_if! {

0 commit comments

Comments
 (0)