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