Merge branch 'split-ssizet' into 'master'

split out ssize_t from sys_types

See merge request redox-os/relibc!1277
This commit is contained in:
Jeremy Soller
2026-05-08 06:27:21 -06:00
5 changed files with 36 additions and 4 deletions
+25
View File
@@ -0,0 +1,25 @@
# 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 ssize_t:
# - aio.h
# - dirent.h
# - monetary.h
# - mqueue.h
# - stdio.h
# - sys/msg.h
# - sys/socket.h
# - sys/types.h (where it should be defined)
# - sys/uio.h
# - unistd.h
sys_includes = []
include_guard = "_RELIBC_BITS_SSIZE_T_H"
language = "C"
style = "type"
no_includes = true
cpp_compat = true
[export]
include = ["ssize_t"]
[enum]
prefix_with_name = true
+5
View File
@@ -0,0 +1,5 @@
use crate::platform::types::c_long;
/// Used for a count of bytes or an error indication.
#[allow(non_camel_case_types)]
pub type ssize_t = c_long;
+2
View File
@@ -15,6 +15,8 @@ pub mod bits_safamily_t;
pub mod bits_sigset_t;
#[path = "bits_socklen-t/mod.rs"]
pub mod bits_socklen_t;
#[path = "bits_ssize-t/mod.rs"]
pub mod bits_ssize_t;
#[path = "bits_suseconds-t/mod.rs"]
pub mod bits_suseconds_t;
#[path = "bits_time-t/mod.rs"]
+1 -1
View File
@@ -1,6 +1,7 @@
sys_includes = ["stddef.h"]
# TODO: figure out how to export void* type
after_includes = """
#include <bits/ssize-t.h>
#include <bits/suseconds-t.h>
#include <bits/time-t.h>
@@ -24,7 +25,6 @@ include = [
"off_t",
"pid_t",
"id_t",
"ssize_t",
"useconds_t",
"clock_t",
"clockid_t",
+3 -3
View File
@@ -7,7 +7,9 @@
//! <https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/types.h.html>
//! for the old specification.
pub use crate::header::{bits_suseconds_t::suseconds_t, bits_time_t::time_t};
pub use crate::header::{
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,
};
@@ -38,8 +40,6 @@ pub type off_t = c_longlong;
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;
/// Used for a count of bytes or an error indication.
pub type ssize_t = c_long;
pub type useconds_t = c_uint;
/// Used for system times in clock ticks or CLOCKS_PER_SEC.