diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt index 91d601d50a711..4dcb5a2ea696a 100644 --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -414,6 +414,7 @@ add_header_macro( .llvm-libc-macros.signal_macros .llvm-libc-types.pid_t .llvm-libc-types.sig_atomic_t + .llvm-libc-types.sig_t .llvm-libc-types.sighandler_t .llvm-libc-types.siginfo_t .llvm-libc-types.sigset_t diff --git a/libc/include/llvm-libc-macros/linux/signal-macros.h b/libc/include/llvm-libc-macros/linux/signal-macros.h index e9fff447f9086..8532c423c395f 100644 --- a/libc/include/llvm-libc-macros/linux/signal-macros.h +++ b/libc/include/llvm-libc-macros/linux/signal-macros.h @@ -150,5 +150,9 @@ #define SI_TIMER (-2) // Expiration of a timer set by timer_settime() #define SI_ASYNCIO (-4) // Completion of an synchronous I/O request #define SI_MESGQ (-3) // Arrival of a message on an empty message queue +#define SI_SIGIO (-5) // Queued SIGIO, on older versions of Linux +#define SI_TKILL (-6) // Sent by tkill or tgkill +#define SI_ASYNCNL (-60) // Async name lookup completion +#define SI_KERNEL 128 // Sent by the kernel #endif // LLVM_LIBC_MACROS_LINUX_SIGNAL_MACROS_H diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index 1c999bfd0b857..69d62619f7979 100644 --- a/libc/include/llvm-libc-types/CMakeLists.txt +++ b/libc/include/llvm-libc-types/CMakeLists.txt @@ -122,6 +122,7 @@ add_header(rlim_t HDR rlim_t.h) add_header(sem_t HDR sem_t.h DEPENDS .__futex_word) add_header(time_t HDR time_t_64.h DEST_HDR time_t.h) add_header(timer_t HDR timer_t.h) +add_header(sig_t HDR sig_t.h) add_header(sighandler_t HDR sighandler_t.h) add_header(stack_t HDR stack_t.h DEPENDS .size_t) add_header(suseconds_t HDR suseconds_t.h) diff --git a/libc/include/llvm-libc-types/sig_t.h b/libc/include/llvm-libc-types/sig_t.h new file mode 100644 index 0000000000000..ad6b1aeb5617c --- /dev/null +++ b/libc/include/llvm-libc-types/sig_t.h @@ -0,0 +1,20 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// Definition of sig_t type. +/// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_TYPES_SIG_T_H +#define LLVM_LIBC_TYPES_SIG_T_H + +// BSD type for signal handlers. +typedef void (*sig_t)(int); + +#endif // LLVM_LIBC_TYPES_SIG_T_H diff --git a/libc/include/llvm-libc-types/siginfo_t.h b/libc/include/llvm-libc-types/siginfo_t.h index 20fdd461bb6df..67366e40b1ebc 100644 --- a/libc/include/llvm-libc-types/siginfo_t.h +++ b/libc/include/llvm-libc-types/siginfo_t.h @@ -33,7 +33,7 @@ typedef struct { /* POSIX.1b timers */ struct { int si_tid; /* timer id */ - int _overrun; /* overrun count */ + int si_overrun; /* overrun count */ union sigval si_sigval; /* same as below */ } _timer; diff --git a/libc/include/signal.yaml b/libc/include/signal.yaml index 7ab557875af71..307bbfedbec01 100644 --- a/libc/include/signal.yaml +++ b/libc/include/signal.yaml @@ -23,7 +23,12 @@ macros: types: - type_name: pid_t - type_name: sig_atomic_t + - type_name: sig_t + standards: + - bsd - type_name: sighandler_t + standards: + - gnu - type_name: siginfo_t - type_name: sigset_t - type_name: stack_t