Skip to content

Commit 644929a

Browse files
committed
Corrections based on CI failures.
* idtype_t no longer an enum. * Darwin/x86-32 needs the $UNIX2003 thing. * Darwin, FreeBSD, and NetBSD all have different values for the new constants. * OpenBSD doesn't have this feature at all. (Hopefully we can get away with defining idtype_t anyway.)
1 parent 9d1e484 commit 644929a

File tree

5 files changed

+29
-10
lines changed

5 files changed

+29
-10
lines changed

src/unix/bsd/apple/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,11 @@ pub const LIO_READ: ::c_int = 1;
13631363
pub const LIO_WAIT: ::c_int = 2;
13641364
pub const LIO_NOWAIT: ::c_int = 1;
13651365

1366+
pub const WEXITED: ::c_int = 0x00000004;
1367+
pub const WSTOPPED: ::c_int = 0x00000008;
1368+
pub const WCONTINUED: ::c_int = 0x00000010;
1369+
pub const WNOWAIT: ::c_int = 0x00000020;
1370+
13661371
f! {
13671372
pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
13681373
status >> 8

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,12 @@ pub const TIOCSWINSZ: ::c_ulong = 0x80087467;
693693

694694
pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
695695

696+
pub const WSTOPPED: ::c_int = 2; // same as WUNTRACED
697+
pub const WCONTINUED: ::c_int = 4;
698+
pub const WNOWAIT: ::c_int = 8;
699+
pub const WEXITED: ::c_int = 16;
700+
pub const WTRAPPED: ::c_int = 32;
701+
696702
f! {
697703
pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
698704
status >> 8

src/unix/bsd/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,6 @@ pub const NOFLSH: ::tcflag_t = 0x80000000;
271271

272272
pub const WNOHANG: ::c_int = 0x00000001;
273273
pub const WUNTRACED: ::c_int = 0x00000002;
274-
pub const WEXITED: ::c_int = 0x00000004;
275-
pub const WSTOPPED: ::c_int = 0x00000008;
276-
pub const WCONTINUED: ::c_int = 0x00000010;
277-
pub const WNOWAIT: ::c_int = 0x00000020;
278274

279275
pub const RTLD_NOW: ::c_int = 0x2;
280276
pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void;

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,11 @@ pub const SIGEV_NONE: ::c_int = 0;
583583
pub const SIGEV_SIGNAL: ::c_int = 1;
584584
pub const SIGEV_THREAD: ::c_int = 2;
585585

586+
pub const WSTOPPED: ::c_int = 0x00000002; // same as WUNTRACED
587+
pub const WCONTINUED: ::c_int = 0x00000010;
588+
pub const WEXITED: ::c_int = 0x000000020;
589+
pub const WNOWAIT: ::c_int = 0x00010000;
590+
586591
extern {
587592
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
588593
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;

src/unix/mod.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ pub type cc_t = ::c_uchar;
1616
pub enum DIR {}
1717
pub enum locale_t {}
1818

19-
#[repr(C)]
20-
pub enum idtype_t {
21-
P_ALL = 0,
22-
P_PID = 1,
23-
P_PGID = 2,
24-
}
19+
// FIXME: This is technically wrong; idtype_t is specified as a C enum.
20+
// [ http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_wait.h.html ]
21+
// However, FFI doesn't currently know how to ABI-match a C enum
22+
// (rust#28925, rust#34641) and *probably* the underlying type will be
23+
// c_uint everywhere since all of the enumerators are representable by c_uint.
24+
pub type idtype_t = ::c_uint;
2525

2626
s! {
2727
pub struct group {
@@ -210,6 +210,10 @@ pub const PRIO_USER: ::c_int = 2;
210210
pub const PRIO_MIN: ::c_int = -20;
211211
pub const PRIO_MAX: ::c_int = 20;
212212

213+
pub const P_ALL: idtype_t = 0;
214+
pub const P_PID: idtype_t = 1;
215+
pub const P_PGID: idtype_t = 2;
216+
213217
cfg_if! {
214218
if #[cfg(dox)] {
215219
// on dox builds don't pull in anything
@@ -454,6 +458,9 @@ extern {
454458
link_name = "waitpid$UNIX2003")]
455459
pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int)
456460
-> pid_t;
461+
#[cfg(not(target_os = "openbsd"))] // " if " -- appease style checker
462+
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
463+
link_name = "waitid$UNIX2003")]
457464
pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
458465
options: ::c_int) -> ::c_int;
459466
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),

0 commit comments

Comments
 (0)