2022-03-25 14:11:44 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_CALLS_SIGNALS_INTERNAL_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_CALLS_SIGNALS_INTERNAL_H_
|
2022-10-13 20:44:41 +00:00
|
|
|
#include "libc/atomic.h"
|
2022-03-25 14:11:44 +00:00
|
|
|
#include "libc/calls/struct/sigset.h"
|
2022-04-12 12:20:17 +00:00
|
|
|
#include "libc/calls/ucontext.h"
|
2022-03-25 14:11:44 +00:00
|
|
|
|
2022-10-13 20:44:41 +00:00
|
|
|
#define __SIG_QUEUE_LENGTH 32
|
2023-08-19 13:41:06 +00:00
|
|
|
#define __SIG_POLLING_INTERVAL_MS 20
|
2022-04-12 12:20:17 +00:00
|
|
|
#define __SIG_LOGGING_INTERVAL_MS 1700
|
2022-03-25 14:11:44 +00:00
|
|
|
|
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
COSMOPOLITAN_C_START_
|
|
|
|
|
2022-04-12 15:05:22 +00:00
|
|
|
struct Signal {
|
|
|
|
struct Signal *next;
|
|
|
|
bool used;
|
2022-10-13 20:44:41 +00:00
|
|
|
int tid;
|
2022-04-12 15:05:22 +00:00
|
|
|
int sig;
|
|
|
|
int si_code;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Signals {
|
2022-10-13 20:44:41 +00:00
|
|
|
uint64_t sigmask; /* only if tls is disabled */
|
2022-04-12 15:05:22 +00:00
|
|
|
struct Signal *queue;
|
|
|
|
struct Signal mem[__SIG_QUEUE_LENGTH];
|
|
|
|
};
|
|
|
|
|
2022-06-11 08:59:26 +00:00
|
|
|
extern struct Signals __sig;
|
2022-10-13 20:44:41 +00:00
|
|
|
extern atomic_long __sig_count;
|
2022-04-12 15:05:22 +00:00
|
|
|
|
2023-07-30 15:55:01 +00:00
|
|
|
bool __sig_check(int);
|
|
|
|
bool __sig_handle(int, int, int, ucontext_t *);
|
2023-07-24 15:31:54 +00:00
|
|
|
int __sig_add(int, int, int);
|
|
|
|
int __sig_mask(int, const sigset_t *, sigset_t *);
|
|
|
|
int __sig_raise(int, int);
|
|
|
|
void __sig_check_ignore(const int, const unsigned);
|
|
|
|
void __sig_pending(sigset_t *);
|
|
|
|
int __sig_is_applicable(struct Signal *);
|
2022-03-25 14:11:44 +00:00
|
|
|
|
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_CALLS_SIGNALS_INTERNAL_H_ */
|