diff --git a/src/header/bits_pid-t/cbindgen.toml b/src/header/bits_pid-t/cbindgen.toml new file mode 100644 index 0000000000..3f351c6130 --- /dev/null +++ b/src/header/bits_pid-t/cbindgen.toml @@ -0,0 +1,27 @@ +# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_types.h.html +# +# This type is split out to prevent importing all of sys/types.h into other headers. +# +# POSIX headers that require pid_t: +# - sched.h +# - signal.h +# - spawn.h (TODO not present in relibc) +# - sys/msg.h (TODO not present in relibc) +# - sys/sem.h (TODO not present in relibc) +# - sys/shm.h (TODO not present in relibc) +# - sys/types.h (where it should be defined) +# - sys/wait.h +# - termios.h +# - time.h +# - unistd.h +# - utmpx.h (TODO not present in relibc) +sys_includes = [] +include_guard = "_RELIBC_BITS_PID_T_H" +language = "C" +style = "type" +no_includes = true +cpp_compat = true +[export] +include = ["pid_t"] +[enum] +prefix_with_name = true diff --git a/src/header/bits_pid-t/mod.rs b/src/header/bits_pid-t/mod.rs new file mode 100644 index 0000000000..7f76911ea0 --- /dev/null +++ b/src/header/bits_pid-t/mod.rs @@ -0,0 +1,5 @@ +use crate::platform::types::c_int; + +/// Used for process IDs and process group IDs. +#[allow(non_camel_case_types)] +pub type pid_t = c_int; diff --git a/src/header/mod.rs b/src/header/mod.rs index 458bf9d12b..bdfb84e6e9 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -10,6 +10,8 @@ pub mod bits_iovec; pub mod bits_locale_t; #[path = "bits_off-t/mod.rs"] pub mod bits_off_t; +#[path = "bits_pid-t/mod.rs"] +pub mod bits_pid_t; pub mod bits_pthread; #[path = "bits_safamily-t/mod.rs"] pub mod bits_safamily_t; diff --git a/src/header/sys_types_internal/cbindgen.toml b/src/header/sys_types_internal/cbindgen.toml index b13b70703c..dd83e05aa1 100644 --- a/src/header/sys_types_internal/cbindgen.toml +++ b/src/header/sys_types_internal/cbindgen.toml @@ -3,6 +3,7 @@ sys_includes = ["stddef.h"] # TODO: figure out how to export void* type after_includes = """ #include +#include #include #include #include @@ -24,7 +25,6 @@ include = [ "uid_t", "mode_t", "nlink_t", - "pid_t", "id_t", "useconds_t", "clock_t", diff --git a/src/header/sys_types_internal/mod.rs b/src/header/sys_types_internal/mod.rs index e401f4133d..1fc2b6369f 100644 --- a/src/header/sys_types_internal/mod.rs +++ b/src/header/sys_types_internal/mod.rs @@ -8,7 +8,8 @@ //! for the old specification. pub use crate::header::{ - bits_off_t::off_t, bits_ssize_t::ssize_t, bits_suseconds_t::suseconds_t, bits_time_t::time_t, + bits_off_t::off_t, bits_pid_t::pid_t, bits_ssize_t::ssize_t, bits_suseconds_t::suseconds_t, + bits_time_t::time_t, }; use crate::platform::types::{ c_char, c_int, c_long, c_longlong, c_uchar, c_uint, c_ulong, c_ulonglong, c_ushort, @@ -34,8 +35,6 @@ pub type mode_t = c_uint; pub type mode_t = c_int; /// Used for link counts. pub type nlink_t = c_ulong; -/// Used for process IDs and process group IDs. -pub type pid_t = c_int; /// Used as a general identifier; can be used to contain at least a pid_t, uid_t, or gid_t. pub type id_t = c_uint; pub type useconds_t = c_uint;