split out pthread types for threads header

This commit is contained in:
auronandace
2026-07-06 16:41:09 +01:00
parent 52bb3bbfe3
commit d7859174b7
11 changed files with 134 additions and 46 deletions
@@ -0,0 +1,16 @@
# 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 pthread_once_t:
# - pthread.h
# - sys/types.h (where it should be defined)
# - threads.h (not in spec but POSIX admits most implementations share definitions with pthread.h)
include_guard = "_RELIBC_BITS_PTHREAD_ONCE_T_H"
language = "C"
no_includes = true
cpp_compat = true
[export]
include = ["pthread_once_t"]
[enum]
prefix_with_name = true
+17
View File
@@ -0,0 +1,17 @@
//! `pthread_once_t` for `sys/types.h` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_types.h.html>.
use crate::{
platform::types::{c_int, c_uchar},
pthread_assert_equal_size,
};
/// Used for dynamic package initialization.
#[repr(C)]
pub union pthread_once_t {
__relibc_internal_size: [c_uchar; 4],
__relibc_internal_align: c_int,
}
pthread_assert_equal_size!(pthread_once_t, RlctOnce);