From 999001db98379198f250d1e51126256b562812a7 Mon Sep 17 00:00:00 2001 From: auronandace Date: Fri, 12 Jun 2026 18:22:29 +0100 Subject: [PATCH] move and document some constants --- src/header/limits/cbindgen.toml | 3 --- src/header/limits/mod.rs | 11 ++++++++++- src/header/unistd/sysconf/linux.rs | 3 --- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/header/limits/cbindgen.toml b/src/header/limits/cbindgen.toml index 8ef9934bb4..bb22970e84 100644 --- a/src/header/limits/cbindgen.toml +++ b/src/header/limits/cbindgen.toml @@ -1,9 +1,6 @@ # POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/limits.h.html # # There are no spec quotations relating to includes -after_includes = """ -#include // for ssize_t from sys/types.h -""" include_guard = "_RELIBC_LIMITS_H" language = "C" no_includes = true diff --git a/src/header/limits/mod.rs b/src/header/limits/mod.rs index e2c50e48b0..c7de1bb3e5 100644 --- a/src/header/limits/mod.rs +++ b/src/header/limits/mod.rs @@ -7,17 +7,26 @@ use crate::platform::types::{ c_ushort, ssize_t, }; +/// Maximum number of bytes in a filename (not including the terminating null +/// of a filename string). pub const NAME_MAX: usize = 255; pub const PASS_MAX: usize = 128; +/// Maximum number of bytes the implementation stores as a pathname in a +/// user-supplied buffer of unspecified size, including the terminating null +/// character. pub const PATH_MAX: usize = 4096; +/// Maximum number of simultaneous supplementary group IDs per process. pub const NGROUPS_MAX: usize = 65536; - /// Maximum number of `iovec` structures that one process has available for /// use with `readv()` or `writev()`. pub const IOV_MAX: c_int = 1024; /// Minimum required value for `IOV_MAX`. pub const _XOPEN_IOV_MAX: c_int = 16; +/// Minimum required value for `NAME_MAX`. +pub const _XOPEN_NAME_MAX: c_long = 255; +/// Minimum required value for `PATH_MAX`. +pub const _XOPEN_PATH_MAX: c_long = 1024; pub const CHAR_BIT: u32 = 8; pub const WORD_BIT: u32 = 32; diff --git a/src/header/unistd/sysconf/linux.rs b/src/header/unistd/sysconf/linux.rs index 8b7d8ead49..0976e9b20f 100644 --- a/src/header/unistd/sysconf/linux.rs +++ b/src/header/unistd/sysconf/linux.rs @@ -10,9 +10,6 @@ use crate::{ platform, }; -pub const _XOPEN_NAME_MAX: c_long = 255; -pub const _XOPEN_PATH_MAX: c_long = 1024; - pub const _SC_JOB_CONTROL: c_int = 7; pub const _SC_SAVED_IDS: c_int = 8; pub const _SC_PRIORITY_SCHEDULING: c_int = 10;