@@ -16,12 +16,19 @@ pub type cc_t = ::c_uchar;
16
16
pub enum DIR { }
17
17
pub enum locale_t { }
18
18
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 ]
19
+ // idtype_t is specified as a C enum:
20
+ // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_wait.h.html
21
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 ;
22
+ // (rust#28925, rust#34641).
23
+ cfg_if ! {
24
+ if #[ cfg( target_os = "openbsd" ) ] {
25
+ // idtype_t is not available
26
+ } else if #[ cfg( target_os = "android" ) ] {
27
+ pub type idtype_t = :: c_int;
28
+ } else {
29
+ pub type idtype_t = :: c_uint;
30
+ }
31
+ }
25
32
26
33
s ! {
27
34
pub struct group {
@@ -210,9 +217,21 @@ pub const PRIO_USER: ::c_int = 2;
210
217
pub const PRIO_MIN : :: c_int = -20 ;
211
218
pub const PRIO_MAX : :: c_int = 20 ;
212
219
213
- pub const P_ALL : idtype_t = 0 ;
214
- pub const P_PID : idtype_t = 1 ;
215
- pub const P_PGID : idtype_t = 2 ;
220
+ cfg_if ! {
221
+ if #[ cfg( target_os = "openbsd" ) ] {
222
+ // P_* constants are not available
223
+ } else if #[ cfg( target_os = "freebsd" ) ] {
224
+ // FreeBSD defines a great many more of these, and gives the
225
+ // standardized constants different values from everyone else.
226
+ pub const P_PID : idtype_t = 0 ;
227
+ pub const P_PGID : idtype_t = 2 ;
228
+ pub const P_ALL : idtype_t = 7 ;
229
+ } else {
230
+ pub const P_ALL : idtype_t = 0 ;
231
+ pub const P_PID : idtype_t = 1 ;
232
+ pub const P_PGID : idtype_t = 2 ;
233
+ }
234
+ }
216
235
217
236
cfg_if ! {
218
237
if #[ cfg( dox) ] {
@@ -458,7 +477,7 @@ extern {
458
477
link_name = "waitpid$UNIX2003" ) ]
459
478
pub fn waitpid ( pid : pid_t , status : * mut :: c_int , options : :: c_int )
460
479
-> pid_t ;
461
- #[ cfg( not( target_os = "openbsd" ) ) ] // " if " -- appease style checker
480
+ #[ cfg( not( any ( target_os = "openbsd" , target_os = "netbsd" ) ) ) ] // " if "
462
481
#[ cfg_attr( all( target_os = "macos" , target_arch = "x86" ) ,
463
482
link_name = "waitid$UNIX2003" ) ]
464
483
pub fn waitid ( idtype : idtype_t , id : id_t , infop : * mut :: siginfo_t ,
0 commit comments