From 1eed88923aacbd664ad501029d84444477ad41b7 Mon Sep 17 00:00:00 2001 From: auronandace Date: Mon, 13 Apr 2026 08:52:53 +0100 Subject: [PATCH] verify signal header includes --- include/bits/signal.h | 24 ------------------------ src/header/signal/cbindgen.toml | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 27 deletions(-) delete mode 100644 include/bits/signal.h diff --git a/include/bits/signal.h b/include/bits/signal.h deleted file mode 100644 index 6ce7a3480e..0000000000 --- a/include/bits/signal.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _BITS_SIGNAL_H -#define _BITS_SIGNAL_H - -#define SIG_DFL ((void (*)(int))0) -#define SIG_IGN ((void (*)(int))1) -#define SIG_ERR ((void (*)(int))-1) -#define SIG_HOLD ((void (*)(int))2) - -typedef struct siginfo siginfo_t; -typedef unsigned long long sigset_t; -typedef struct ucontext ucontext_t; -typedef struct mcontext mcontext_t; - -struct sigaction { - union { - void (*sa_handler)(int); - void (*sa_sigaction)(int, siginfo_t *, void *); - }; - int sa_flags; - void (*sa_restorer)(void); - sigset_t sa_mask; -}; - -#endif // _BITS_SIGNAL_H diff --git a/src/header/signal/cbindgen.toml b/src/header/signal/cbindgen.toml index acfecf56db..1b00793e87 100644 --- a/src/header/signal/cbindgen.toml +++ b/src/header/signal/cbindgen.toml @@ -1,8 +1,35 @@ -sys_includes = ["bits/signal.h", "stdint.h", "sys/types.h", "bits/pthread.h", "features.h"] +# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html +# +# Spec quotations relating to includes: +# - "The header shall define the pthread_t, size_t, and uid_t types as described in ." +# - "The header shall define the timespec structure as described in ." +# - "pid_t As described in ." +# - "The header shall define the pthread_attr_t type as described in ." +# - "Inclusion of the header may make visible all symbols from the header." +sys_includes = ["sys/types.h"] include_guard = "_RELIBC_SIGNAL_H" after_includes = """ -#include // for timespec -#include +#include // for timespec from time.h + +#define SIG_DFL ((void (*)(int))0) +#define SIG_IGN ((void (*)(int))1) +#define SIG_ERR ((void (*)(int))-1) +#define SIG_HOLD ((void (*)(int))2) + +typedef struct siginfo siginfo_t; +typedef unsigned long long sigset_t; +typedef struct ucontext ucontext_t; +typedef struct mcontext mcontext_t; + +struct sigaction { + union { + void (*sa_handler)(int); + void (*sa_sigaction)(int, siginfo_t *, void *); + }; + int sa_flags; + void (*sa_restorer)(void); + sigset_t sa_mask; +}; """ language = "C" style = "Tag"