split out pid_t from sys_types

This commit is contained in:
auronandace
2026-05-09 14:33:10 +01:00
parent a0a8629f17
commit 5e922ac626
5 changed files with 37 additions and 4 deletions
+27
View File
@@ -0,0 +1,27 @@
# 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 pid_t:
# - sched.h
# - signal.h
# - spawn.h (TODO not present in relibc)
# - sys/msg.h (TODO not present in relibc)
# - sys/sem.h (TODO not present in relibc)
# - sys/shm.h (TODO not present in relibc)
# - sys/types.h (where it should be defined)
# - sys/wait.h
# - termios.h
# - time.h
# - unistd.h
# - utmpx.h (TODO not present in relibc)
sys_includes = []
include_guard = "_RELIBC_BITS_PID_T_H"
language = "C"
style = "type"
no_includes = true
cpp_compat = true
[export]
include = ["pid_t"]
[enum]
prefix_with_name = true
+5
View File
@@ -0,0 +1,5 @@
use crate::platform::types::c_int;
/// Used for process IDs and process group IDs.
#[allow(non_camel_case_types)]
pub type pid_t = c_int;
+2
View File
@@ -10,6 +10,8 @@ pub mod bits_iovec;
pub mod bits_locale_t;
#[path = "bits_off-t/mod.rs"]
pub mod bits_off_t;
#[path = "bits_pid-t/mod.rs"]
pub mod bits_pid_t;
pub mod bits_pthread;
#[path = "bits_safamily-t/mod.rs"]
pub mod bits_safamily_t;
+1 -1
View File
@@ -3,6 +3,7 @@ sys_includes = ["stddef.h"]
# TODO: figure out how to export void* type
after_includes = """
#include <bits/off-t.h>
#include <bits/pid-t.h>
#include <bits/ssize-t.h>
#include <bits/suseconds-t.h>
#include <bits/time-t.h>
@@ -24,7 +25,6 @@ include = [
"uid_t",
"mode_t",
"nlink_t",
"pid_t",
"id_t",
"useconds_t",
"clock_t",
+2 -3
View File
@@ -8,7 +8,8 @@
//! for the old specification.
pub use crate::header::{
bits_off_t::off_t, bits_ssize_t::ssize_t, bits_suseconds_t::suseconds_t, bits_time_t::time_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,
};
use crate::platform::types::{
c_char, c_int, c_long, c_longlong, c_uchar, c_uint, c_ulong, c_ulonglong, c_ushort,
@@ -34,8 +35,6 @@ pub type mode_t = c_uint;
pub type mode_t = c_int;
/// Used for link counts.
pub type nlink_t = c_ulong;
/// Used for process IDs and process group IDs.
pub type pid_t = c_int;
/// Used as a general identifier; can be used to contain at least a pid_t, uid_t, or gid_t.
pub type id_t = c_uint;
pub type useconds_t = c_uint;