-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add waitid and related constants and types. #489
Changes from 2 commits
9d1e484
644929a
f1a91da
31d9779
f05e48c
984fb54
84bce94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,13 @@ pub type cc_t = ::c_uchar; | |
pub enum DIR {} | ||
pub enum locale_t {} | ||
|
||
// FIXME: This is technically wrong; idtype_t is specified as a C enum. | ||
// [ http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_wait.h.html ] | ||
// However, FFI doesn't currently know how to ABI-match a C enum | ||
// (rust#28925, rust#34641) and *probably* the underlying type will be | ||
// c_uint everywhere since all of the enumerators are representable by c_uint. | ||
pub type idtype_t = ::c_uint; | ||
|
||
s! { | ||
pub struct group { | ||
pub gr_name: *mut ::c_char, | ||
|
@@ -203,6 +210,10 @@ pub const PRIO_USER: ::c_int = 2; | |
pub const PRIO_MIN: ::c_int = -20; | ||
pub const PRIO_MAX: ::c_int = 20; | ||
|
||
pub const P_ALL: idtype_t = 0; | ||
pub const P_PID: idtype_t = 1; | ||
pub const P_PGID: idtype_t = 2; | ||
|
||
cfg_if! { | ||
if #[cfg(dox)] { | ||
// on dox builds don't pull in anything | ||
|
@@ -447,6 +458,11 @@ extern { | |
link_name = "waitpid$UNIX2003")] | ||
pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) | ||
-> pid_t; | ||
#[cfg(not(target_os = "openbsd"))] // " if " -- appease style checker | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could the definition here be pushed down into the various modules to avoid the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we defer that conversation until after I have something that works everywhere, please? I don't think the right tradeoff among tidiness, consistency with other stuff, and minimization of repetition will be apparent till then. |
||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
link_name = "waitid$UNIX2003")] | ||
pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, | ||
options: ::c_int) -> ::c_int; | ||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
link_name = "write$UNIX2003")] | ||
pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's ok to remove this FIXME, I don't think it's possible to fix such a fixme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the new rev, it still says this, but not as a FIXME. I think it's valuable to document that we are manually matching a C enum here. Especially as, it turns out, the underlying type differs on Android.