split out clockid_t type from sys_types

This commit is contained in:
auronandace
2026-05-12 08:30:02 +01:00
parent aaaabaded3
commit 4f353e886e
5 changed files with 29 additions and 8 deletions
+17
View File
@@ -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 clockid_t:
# - sys/types.h (where it should be defined)
# - time.h
sys_includes = []
include_guard = "_RELIBC_BITS_CLOCKID_T_H"
language = "C"
style = "type"
no_includes = true
cpp_compat = true
[export]
include = ["clockid_t"]
[enum]
prefix_with_name = true
+5
View File
@@ -0,0 +1,5 @@
use crate::platform::types::c_int;
/// Used for clock ID type in the clock and timer functions.
#[allow(non_camel_case_types)]
pub type clockid_t = c_int;
+2
View File
@@ -7,6 +7,8 @@ pub mod assert;
pub mod bits_arpainet;
#[path = "bits_clock-t/mod.rs"]
pub mod bits_clock_t;
#[path = "bits_clockid-t/mod.rs"]
pub mod bits_clockid_t;
#[path = "bits_gid-t/mod.rs"]
pub mod bits_gid_t;
#[path = "bits_id-t/mod.rs"]
+1 -1
View File
@@ -3,6 +3,7 @@ sys_includes = ["stddef.h"]
# TODO: figure out how to export void* type
after_includes = """
#include <bits/clock-t.h>
#include <bits/clockid-t.h>
#include <bits/gid-t.h>
#include <bits/id-t.h>
#include <bits/off-t.h>
@@ -28,7 +29,6 @@ include = [
"mode_t",
"nlink_t",
"useconds_t",
"clockid_t",
"blkcnt_t",
"fsblkcnt_t",
"fsfilcnt_t",
+4 -7
View File
@@ -8,12 +8,12 @@
//! for the old specification.
pub use crate::header::{
bits_clock_t::clock_t, bits_gid_t::gid_t, bits_id_t::id_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,
bits_uid_t::uid_t,
bits_clock_t::clock_t, bits_clockid_t::clockid_t, bits_gid_t::gid_t, bits_id_t::id_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, bits_uid_t::uid_t,
};
use crate::platform::types::{
c_char, c_int, c_long, c_longlong, c_uchar, c_uint, c_ulong, c_ulonglong, c_ushort,
c_char, c_long, c_longlong, c_uchar, c_uint, c_ulong, c_ulonglong, c_ushort,
};
/// Used for block sizes.
@@ -34,9 +34,6 @@ pub type mode_t = c_int;
pub type nlink_t = c_ulong;
pub type useconds_t = c_uint;
/// Used for clock ID type in the clock and timer functions.
pub type clockid_t = c_int;
// timer_t in cbindgen after_includes (how to export void* type?)
/// Used for file block counts.