Merge branch 'split-clockt' into 'master'

split out clock_t from sys_types

See merge request redox-os/relibc!1306
This commit is contained in:
Jeremy Soller
2026-05-11 07:43:35 -06:00
5 changed files with 28 additions and 5 deletions
+18
View File
@@ -0,0 +1,18 @@
# 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 clock_t:
# - sys/times.h
# - sys/types.h (where it should be defined)
# - time.h
sys_includes = []
include_guard = "_RELIBC_BITS_CLOCK_T_H"
language = "C"
style = "type"
no_includes = true
cpp_compat = true
[export]
include = ["clock_t"]
[enum]
prefix_with_name = true
+5
View File
@@ -0,0 +1,5 @@
use crate::platform::types::c_long;
/// Used for system times in clock ticks or CLOCKS_PER_SEC.
#[allow(non_camel_case_types)]
pub type clock_t = c_long;
+2
View File
@@ -5,6 +5,8 @@ pub mod _fenv;
pub mod arpa_inet;
pub mod assert;
pub mod bits_arpainet;
#[path = "bits_clock-t/mod.rs"]
pub mod bits_clock_t;
#[path = "bits_gid-t/mod.rs"]
pub mod bits_gid_t;
pub mod bits_iovec;
+1 -1
View File
@@ -2,6 +2,7 @@
sys_includes = ["stddef.h"]
# TODO: figure out how to export void* type
after_includes = """
#include <bits/clock-t.h>
#include <bits/gid-t.h>
#include <bits/off-t.h>
#include <bits/pid-t.h>
@@ -27,7 +28,6 @@ include = [
"nlink_t",
"id_t",
"useconds_t",
"clock_t",
"clockid_t",
"blkcnt_t",
"fsblkcnt_t",
+2 -4
View File
@@ -8,8 +8,8 @@
//! for the old specification.
pub use crate::header::{
bits_gid_t::gid_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_gid_t::gid_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,
@@ -35,8 +35,6 @@ pub type nlink_t = c_ulong;
pub type id_t = c_uint;
pub type useconds_t = c_uint;
/// Used for system times in clock ticks or CLOCKS_PER_SEC.
pub type clock_t = c_long;
/// Used for clock ID type in the clock and timer functions.
pub type clockid_t = c_int;