diff --git a/src/header/bits_nlink-t/cbindgen.toml b/src/header/bits_nlink-t/cbindgen.toml new file mode 100644 index 0000000000..da5a6581b6 --- /dev/null +++ b/src/header/bits_nlink-t/cbindgen.toml @@ -0,0 +1,17 @@ +# 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 nlink_t: +# - sys/stat.h +# - sys/types.h (where it should be defined) +sys_includes = [] +include_guard = "_RELIBC_BITS_NLINK_T_H" +language = "C" +style = "type" +no_includes = true +cpp_compat = true +[export] +include = ["nlink_t"] +[enum] +prefix_with_name = true diff --git a/src/header/bits_nlink-t/mod.rs b/src/header/bits_nlink-t/mod.rs new file mode 100644 index 0000000000..5d0052e336 --- /dev/null +++ b/src/header/bits_nlink-t/mod.rs @@ -0,0 +1,5 @@ +use crate::platform::types::c_ulong; + +/// Used for link counts. +#[allow(non_camel_case_types)] +pub type nlink_t = c_ulong; diff --git a/src/header/mod.rs b/src/header/mod.rs index ecd9451bc6..c67cee23d8 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -22,6 +22,8 @@ pub mod bits_iovec; pub mod bits_locale_t; #[path = "bits_mode-t/mod.rs"] pub mod bits_mode_t; +#[path = "bits_nlink-t/mod.rs"] +pub mod bits_nlink_t; #[path = "bits_off-t/mod.rs"] pub mod bits_off_t; #[path = "bits_pid-t/mod.rs"] diff --git a/src/header/sys_types_internal/cbindgen.toml b/src/header/sys_types_internal/cbindgen.toml index 2bd0e71446..6d2dd4f88e 100644 --- a/src/header/sys_types_internal/cbindgen.toml +++ b/src/header/sys_types_internal/cbindgen.toml @@ -8,6 +8,7 @@ after_includes = """ #include #include #include +#include #include #include #include @@ -26,7 +27,6 @@ no_includes = true [export] include = [ "reclen_t", - "nlink_t", "useconds_t", "u_char", "uchar", diff --git a/src/header/sys_types_internal/mod.rs b/src/header/sys_types_internal/mod.rs index 39e79d706b..755ce1e298 100644 --- a/src/header/sys_types_internal/mod.rs +++ b/src/header/sys_types_internal/mod.rs @@ -15,6 +15,7 @@ pub use crate::header::{ bits_id_t::id_t, bits_ino_t::ino_t, bits_mode_t::mode_t, + bits_nlink_t::nlink_t, bits_off_t::off_t, bits_pid_t::pid_t, bits_size_t::size_t, @@ -30,8 +31,6 @@ use crate::platform::types::{c_char, c_longlong, c_uchar, c_uint, c_ulong, c_ulo /// Used for directory entry lengths. pub type reclen_t = c_ushort; -/// Used for link counts. -pub type nlink_t = c_ulong; pub type useconds_t = c_uint; pub type u_char = c_uchar;