split out timer_t from sys_types

This commit is contained in:
auronandace
2026-05-15 07:46:49 +01:00
parent 5e0867eae0
commit 08b6bba666
5 changed files with 26 additions and 5 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 timer_t:
# - sys/types.h (where it should be defined)
# - time.h
sys_includes = []
include_guard = "_RELIBC_BITS_TIMER_T_H"
language = "C"
style = "type"
no_includes = true
cpp_compat = true
[export]
include = ["timer_t"]
[enum]
prefix_with_name = true
+5
View File
@@ -0,0 +1,5 @@
use crate::platform::types::c_void;
/// Used for timer ID returned by timer_create()
#[allow(non_camel_case_types)]
pub type timer_t = *mut c_void;
+2
View File
@@ -40,6 +40,8 @@ pub mod bits_suseconds_t;
pub mod bits_sys_statvfs;
#[path = "bits_time-t/mod.rs"]
pub mod bits_time_t;
#[path = "bits_timer-t/mod.rs"]
pub mod bits_timer_t;
pub mod bits_timespec;
pub mod bits_timeval;
#[path = "bits_uid-t/mod.rs"]
+1 -3
View File
@@ -1,6 +1,5 @@
# stddef.h brings in size_t
sys_includes = ["stddef.h"]
# TODO: figure out how to export void* type
after_includes = """
#include <bits/clock-t.h>
#include <bits/clockid-t.h>
@@ -14,9 +13,8 @@ after_includes = """
#include <bits/suseconds-t.h>
#include <bits/sys/statvfs.h> // for fsblkcnt_t and fsfilcnt_t
#include <bits/time-t.h>
#include <bits/timer-t.h>
#include <bits/uid-t.h>
typedef void* timer_t;
"""
include_guard = "_RELIBC_SYS_TYPES_INTERNAL_H"
language = "C"
+1 -2
View File
@@ -20,6 +20,7 @@ pub use crate::header::{
bits_suseconds_t::suseconds_t,
bits_sys_statvfs::{fsblkcnt_t, fsfilcnt_t},
bits_time_t::time_t,
bits_timer_t::timer_t,
bits_uid_t::uid_t,
};
use crate::platform::types::{
@@ -36,8 +37,6 @@ pub type reclen_t = c_ushort;
pub type nlink_t = c_ulong;
pub type useconds_t = c_uint;
// timer_t in cbindgen after_includes (how to export void* type?)
/// Used for file block counts.
pub type blkcnt_t = c_longlong;