diff --git a/src/header/bits_reclen-t/cbindgen.toml b/src/header/bits_reclen-t/cbindgen.toml new file mode 100644 index 0000000000..e7babc5a4a --- /dev/null +++ b/src/header/bits_reclen-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 reclen_t: +# - dirent.h +# - sys/types.h (where it should be defined) +sys_includes = [] +include_guard = "_RELIBC_BITS_RECLEN_T_H" +language = "C" +style = "type" +no_includes = true +cpp_compat = true +[export] +include = ["reclen_t"] +[enum] +prefix_with_name = true diff --git a/src/header/bits_reclen-t/mod.rs b/src/header/bits_reclen-t/mod.rs new file mode 100644 index 0000000000..84a70f0587 --- /dev/null +++ b/src/header/bits_reclen-t/mod.rs @@ -0,0 +1,5 @@ +use crate::platform::types::c_ushort; + +/// Used for directory entry lengths. +#[allow(non_camel_case_types)] +pub type reclen_t = c_ushort; diff --git a/src/header/mod.rs b/src/header/mod.rs index c67cee23d8..74f18749b1 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -29,6 +29,8 @@ pub mod bits_off_t; #[path = "bits_pid-t/mod.rs"] pub mod bits_pid_t; pub mod bits_pthread; +#[path = "bits_reclen-t/mod.rs"] +pub mod bits_reclen_t; #[path = "bits_safamily-t/mod.rs"] pub mod bits_safamily_t; #[path = "bits_sigset-t/mod.rs"] diff --git a/src/header/sys_types_internal/cbindgen.toml b/src/header/sys_types_internal/cbindgen.toml index 6d2dd4f88e..eb5a0744c0 100644 --- a/src/header/sys_types_internal/cbindgen.toml +++ b/src/header/sys_types_internal/cbindgen.toml @@ -11,6 +11,7 @@ after_includes = """ #include #include #include +#include #include #include #include // for blkcnt_t and blksize_t @@ -26,7 +27,6 @@ no_includes = true [export] include = [ - "reclen_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 755ce1e298..eded3a79f5 100644 --- a/src/header/sys_types_internal/mod.rs +++ b/src/header/sys_types_internal/mod.rs @@ -18,6 +18,7 @@ pub use crate::header::{ bits_nlink_t::nlink_t, bits_off_t::off_t, bits_pid_t::pid_t, + bits_reclen_t::reclen_t, bits_size_t::size_t, bits_ssize_t::ssize_t, bits_suseconds_t::suseconds_t, @@ -29,8 +30,6 @@ pub use crate::header::{ }; use crate::platform::types::{c_char, c_longlong, c_uchar, c_uint, c_ulong, c_ulonglong, c_ushort}; -/// Used for directory entry lengths. -pub type reclen_t = c_ushort; pub type useconds_t = c_uint; pub type u_char = c_uchar;