Merge branch 'split-sigset-t' into 'master'

split out sigset_t from signal header

See merge request redox-os/relibc!1242
This commit is contained in:
Jeremy Soller
2026-04-29 06:51:47 -06:00
16 changed files with 50 additions and 21 deletions
+18
View File
@@ -0,0 +1,18 @@
# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html
#
# This type is split out to prevent importing all of signal.h into other headers.
#
# POSIX headers that require sigset_t:
# - poll.h
# - signal.h (where it should be defined)
# - sys/select.h
sys_includes = []
include_guard = "_RELIBC_BITS_SIGSET_T_H"
language = "C"
style = "type"
no_includes = true
cpp_compat = true
[export]
include = ["sigset_t"]
[enum]
prefix_with_name = true
+4
View File
@@ -0,0 +1,4 @@
use crate::platform::types::c_ulonglong;
#[allow(non_camel_case_types)]
pub type sigset_t = c_ulonglong;
+2
View File
@@ -11,6 +11,8 @@ pub mod bits_locale_t;
pub mod bits_pthread; pub mod bits_pthread;
#[path = "bits_safamily-t/mod.rs"] #[path = "bits_safamily-t/mod.rs"]
pub mod bits_safamily_t; pub mod bits_safamily_t;
#[path = "bits_sigset-t/mod.rs"]
pub mod bits_sigset_t;
#[path = "bits_socklen-t/mod.rs"] #[path = "bits_socklen-t/mod.rs"]
pub mod bits_socklen_t; pub mod bits_socklen_t;
pub mod bits_timespec; pub mod bits_timespec;
+1 -1
View File
@@ -7,9 +7,9 @@ use core::{mem, ptr, slice};
use crate::{ use crate::{
fs::File, fs::File,
header::{ header::{
bits_sigset_t::sigset_t,
bits_timespec::timespec, bits_timespec::timespec,
errno::EBADF, errno::EBADF,
signal::sigset_t,
sys_epoll::{ sys_epoll::{
EPOLL_CLOEXEC, EPOLL_CTL_ADD, EPOLLERR, EPOLLHUP, EPOLLIN, EPOLLNVAL, EPOLLOUT, EPOLL_CLOEXEC, EPOLL_CTL_ADD, EPOLLERR, EPOLLHUP, EPOLLIN, EPOLLNVAL, EPOLLOUT,
EPOLLPRI, EPOLLRDBAND, EPOLLRDNORM, EPOLLWRBAND, EPOLLWRNORM, epoll_create1, epoll_ctl, EPOLLPRI, EPOLLRDBAND, EPOLLRDNORM, EPOLLWRBAND, EPOLLWRNORM, epoll_create1, epoll_ctl,
+5 -3
View File
@@ -5,7 +5,9 @@
use core::{mem, ptr, slice}; use core::{mem, ptr, slice};
use crate::{ use crate::{
header::{fcntl, limits, pthread, signal, sys_ioctl, sys_wait, termios, unistd, utmp}, header::{
bits_sigset_t, fcntl, limits, pthread, signal, sys_ioctl, sys_wait, termios, unistd, utmp,
},
platform::{ platform::{
self, self,
types::{c_char, c_int, c_void}, types::{c_char, c_int, c_void},
@@ -69,8 +71,8 @@ pub unsafe extern "C" fn forkpty(
let mut p: [c_int; 2] = [0; 2]; let mut p: [c_int; 2] = [0; 2];
let mut cs = 0; let mut cs = 0;
let mut pid = -1; let mut pid = -1;
let mut set = signal::sigset_t::default(); let mut set = bits_sigset_t::sigset_t::default();
let mut oldset = signal::sigset_t::default(); let mut oldset = bits_sigset_t::sigset_t::default();
if unsafe { openpty(&raw mut m, &raw mut s, name, tio, ws) } < 0 { if unsafe { openpty(&raw mut m, &raw mut s, name, tio, ws) } < 0 {
return -1; return -1;
+1 -1
View File
@@ -9,6 +9,7 @@
sys_includes = ["sys/types.h"] sys_includes = ["sys/types.h"]
include_guard = "_RELIBC_SIGNAL_H" include_guard = "_RELIBC_SIGNAL_H"
after_includes = """ after_includes = """
#include <bits/sigset-t.h> // for sigset_t
#include <bits/timespec.h> // for timespec from time.h #include <bits/timespec.h> // for timespec from time.h
#define SIG_DFL ((void (*)(int))0) #define SIG_DFL ((void (*)(int))0)
@@ -17,7 +18,6 @@ after_includes = """
#define SIG_HOLD ((void (*)(int))2) #define SIG_HOLD ((void (*)(int))2)
typedef struct siginfo siginfo_t; typedef struct siginfo siginfo_t;
typedef unsigned long long sigset_t;
typedef struct ucontext ucontext_t; typedef struct ucontext ucontext_t;
typedef struct mcontext mcontext_t; typedef struct mcontext mcontext_t;
typedef long sig_atomic_t; typedef long sig_atomic_t;
+1 -3
View File
@@ -8,7 +8,7 @@ use cbitset::BitSet;
use crate::{ use crate::{
error::{Errno, ResultExt}, error::{Errno, ResultExt},
header::{bits_timespec::timespec, errno, setjmp}, header::{bits_sigset_t::sigset_t, bits_timespec::timespec, errno, setjmp},
platform::{ platform::{
self, ERRNO, Pal, PalSignal, Sys, self, ERRNO, Pal, PalSignal, Sys,
types::{ types::{
@@ -102,8 +102,6 @@ pub union sigval {
pub sival_ptr: *mut c_void, pub sival_ptr: *mut c_void,
} }
/// cbindgen:ignore
pub type sigset_t = c_ulonglong;
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>. /// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>.
/// cbindgen:ignore /// cbindgen:ignore
pub type siginfo_t = siginfo; pub type siginfo_t = siginfo;
+1 -1
View File
@@ -6,7 +6,7 @@ use core::ptr;
use crate::{ use crate::{
error::ResultExt, error::ResultExt,
header::signal::sigset_t, header::bits_sigset_t::sigset_t,
platform::{ platform::{
PalEpoll, Sys, PalEpoll, Sys,
types::{c_int, c_void}, types::{c_int, c_void},
+2 -2
View File
@@ -15,10 +15,12 @@ use crate::{
c_str::CStr, c_str::CStr,
error::{Errno, ResultExt}, error::{Errno, ResultExt},
header::{ header::{
bits_sigset_t::sigset_t,
bits_timespec::timespec, bits_timespec::timespec,
crypt::{crypt_data, crypt_r}, crypt::{crypt_data, crypt_r},
errno::{self, ENAMETOOLONG}, errno::{self, ENAMETOOLONG},
fcntl, limits, fcntl, limits,
signal::{sigprocmask, sigsuspend},
stdlib::getenv, stdlib::getenv,
sys_ioctl, sys_resource, sys_ioctl, sys_resource,
sys_select::timeval, sys_select::timeval,
@@ -50,8 +52,6 @@ use super::{
stdio::snprintf, stdio::snprintf,
}; };
use crate::header::signal::{sigprocmask, sigset_t, sigsuspend};
mod brk; mod brk;
mod getopt; mod getopt;
mod getpass; mod getpass;
+5 -2
View File
@@ -3,8 +3,11 @@ use core::mem;
use super::{Sys, e_raw}; use super::{Sys, e_raw};
use crate::{ use crate::{
error::Result, error::Result,
header::{signal::sigset_t, sys_epoll::epoll_event}, header::{bits_sigset_t::sigset_t, sys_epoll::epoll_event},
platform::{PalEpoll, types::*}, platform::{
PalEpoll,
types::{c_int, size_t},
},
}; };
impl PalEpoll for Sys { impl PalEpoll for Sys {
+3 -2
View File
@@ -15,10 +15,11 @@ use crate::header::sys_time::itimerval;
use crate::{ use crate::{
error::{Errno, Result}, error::{Errno, Result},
header::{ header::{
bits_sigset_t::sigset_t,
bits_timespec::timespec, bits_timespec::timespec,
signal::{ signal::{
SA_RESTORER, SI_QUEUE, SIGALRM, SIGEV_SIGNAL, sigaction, sigevent, siginfo_t, sigset_t, SA_RESTORER, SI_QUEUE, SIGALRM, SIGEV_SIGNAL, sigaction, sigevent, siginfo_t, sigval,
sigval, stack_t, stack_t,
}, },
time, time,
}, },
+1 -1
View File
@@ -1,6 +1,6 @@
use crate::{ use crate::{
error::Result, error::Result,
header::{signal::sigset_t, sys_epoll::epoll_event}, header::{bits_sigset_t::sigset_t, sys_epoll::epoll_event},
platform::{Pal, types::c_int}, platform::{Pal, types::c_int},
}; };
+2 -1
View File
@@ -7,8 +7,9 @@ use crate::header::sys_time::itimerval;
use crate::{ use crate::{
error::{Errno, Result}, error::{Errno, Result},
header::{ header::{
bits_sigset_t::sigset_t,
bits_timespec::timespec, bits_timespec::timespec,
signal::{sigaction, siginfo_t, sigset_t, sigval, stack_t}, signal::{sigaction, siginfo_t, sigval, stack_t},
}, },
}; };
+1 -1
View File
@@ -6,7 +6,7 @@ use super::{
use crate::{ use crate::{
error::Errno, error::Errno,
fs::File, fs::File,
header::{errno::*, fcntl::*, signal::sigset_t, sys_epoll::*}, header::{bits_sigset_t::sigset_t, errno::*, fcntl::*, sys_epoll::*},
io::prelude::*, io::prelude::*,
}; };
use core::{mem, slice}; use core::{mem, slice};
+1 -1
View File
@@ -1,9 +1,9 @@
use core::mem::size_of; use core::mem::size_of;
use crate::header::{ use crate::header::{
bits_sigset_t::sigset_t,
bits_timespec::timespec, bits_timespec::timespec,
fcntl::{O_CLOEXEC, O_CREAT, O_RDWR}, fcntl::{O_CLOEXEC, O_CREAT, O_RDWR},
signal::sigset_t,
}; };
use super::libredox::RawResult; use super::libredox::RawResult;
+2 -2
View File
@@ -7,12 +7,12 @@ use crate::header::sys_time::{ITIMER_REAL, itimerval};
use crate::{ use crate::{
error::{Errno, Result}, error::{Errno, Result},
header::{ header::{
bits_sigset_t::sigset_t,
bits_timespec::timespec, bits_timespec::timespec,
errno::{EINVAL, ENOSYS}, errno::{EINVAL, ENOSYS},
signal::{ signal::{
SIG_BLOCK, SIG_DFL, SIG_IGN, SIG_SETMASK, SIG_UNBLOCK, SIGALRM, SIGEV_SIGNAL, SIG_BLOCK, SIG_DFL, SIG_IGN, SIG_SETMASK, SIG_UNBLOCK, SIGALRM, SIGEV_SIGNAL,
SS_DISABLE, SS_ONSTACK, sigaction, sigevent, siginfo_t, sigset_t, sigval, stack_t, SS_DISABLE, SS_ONSTACK, sigaction, sigevent, siginfo_t, sigval, stack_t, ucontext_t,
ucontext_t,
}, },
time::{itimerspec, timer_internal_t}, time::{itimerspec, timer_internal_t},
}, },