mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 23:08:31 +00:00
Favor siginfo_t over struct siginfo
This commit is contained in:
parent
c638eabfe0
commit
deaef81463
20 changed files with 37 additions and 39 deletions
|
@ -421,7 +421,7 @@ static int __sigaction(int sig, const struct sigaction *act,
|
|||
* ctx->uc_mcontext.rip += xedd.length;
|
||||
* }
|
||||
*
|
||||
* void OnCrash(int sig, struct siginfo *si, void *vctx) {
|
||||
* void OnCrash(int sig, siginfo_t *si, void *vctx) {
|
||||
* struct ucontext *ctx = vctx;
|
||||
* SkipOverFaultingInstruction(ctx);
|
||||
* ContinueOnCrash(); // reinstall here in case *rip faults
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#ifdef __x86_64__
|
||||
|
||||
privileged void __sigenter_wsl(int sig, struct siginfo *info, ucontext_t *ctx) {
|
||||
privileged void __sigenter_wsl(int sig, siginfo_t *info, ucontext_t *ctx) {
|
||||
int rva, flags;
|
||||
rva = __sighandrvas[sig];
|
||||
if (rva >= kSigactionMinRva) {
|
||||
|
|
|
@ -43,7 +43,7 @@ privileged void __sigenter_netbsd(int sig, struct siginfo_netbsd *si,
|
|||
CheckLargeStackAllocation(&uc, sizeof(uc));
|
||||
#pragma GCC pop_options
|
||||
int rva, flags;
|
||||
struct siginfo si2;
|
||||
siginfo_t si2;
|
||||
rva = __sighandrvas[sig];
|
||||
if (rva >= kSigactionMinRva) {
|
||||
flags = __sighandflags[sig];
|
||||
|
|
|
@ -41,7 +41,7 @@ privileged void __sigenter_openbsd(int sig, struct siginfo_openbsd *openbsdinfo,
|
|||
#pragma GCC diagnostic ignored "-Wframe-larger-than="
|
||||
struct Goodies {
|
||||
ucontext_t uc;
|
||||
struct siginfo si;
|
||||
siginfo_t si;
|
||||
} g;
|
||||
CheckLargeStackAllocation(&g, sizeof(g));
|
||||
#pragma GCC pop_options
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
#include "libc/dce.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
|
||||
privileged void __siginfo2cosmo(struct siginfo *si,
|
||||
const union siginfo_meta *m) {
|
||||
privileged void __siginfo2cosmo(siginfo_t *si, const union siginfo_meta *m) {
|
||||
void *si_addr;
|
||||
int32_t si_signo;
|
||||
int32_t si_errno;
|
||||
|
@ -93,7 +92,7 @@ privileged void __siginfo2cosmo(struct siginfo *si,
|
|||
}
|
||||
}
|
||||
|
||||
*si = (struct siginfo){0};
|
||||
*si = (siginfo_t){0};
|
||||
si->si_signo = si_signo;
|
||||
si->si_errno = si_errno;
|
||||
si->si_code = si_code;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
COSMOPOLITAN_C_START_
|
||||
|
||||
typedef void (*sighandler_t)(int);
|
||||
typedef void (*sigaction_f)(int, struct siginfo *, void *);
|
||||
typedef void (*sigaction_f)(int, siginfo_t *, void *);
|
||||
|
||||
struct sigaction {
|
||||
union {
|
||||
|
|
|
@ -60,11 +60,11 @@ union metasigaction {
|
|||
struct sigaction_xnu_out xnu_out;
|
||||
};
|
||||
|
||||
void __sigenter_xnu(int, struct siginfo *, void *);
|
||||
void __sigenter_wsl(int, struct siginfo *, void *);
|
||||
void __sigenter_netbsd(int, struct siginfo *, void *);
|
||||
void __sigenter_freebsd(int, struct siginfo *, void *);
|
||||
void __sigenter_openbsd(int, struct siginfo *, void *);
|
||||
void __sigenter_xnu(int, siginfo_t *, void *);
|
||||
void __sigenter_wsl(int, siginfo_t *, void *);
|
||||
void __sigenter_netbsd(int, siginfo_t *, void *);
|
||||
void __sigenter_freebsd(int, siginfo_t *, void *);
|
||||
void __sigenter_openbsd(int, siginfo_t *, void *);
|
||||
|
||||
const char *DescribeSigaction(char[256], int, const struct sigaction *);
|
||||
#define DescribeSigaction(rc, sa) DescribeSigaction(alloca(256), rc, sa)
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
COSMOPOLITAN_C_START_
|
||||
|
||||
union siginfo_meta {
|
||||
struct siginfo linux;
|
||||
siginfo_t linux;
|
||||
struct siginfo_xnu xnu;
|
||||
struct siginfo_freebsd freebsd;
|
||||
struct siginfo_openbsd openbsd;
|
||||
struct siginfo_netbsd netbsd;
|
||||
};
|
||||
|
||||
void __siginfo2cosmo(struct siginfo *, const union siginfo_meta *);
|
||||
void __siginfo2cosmo(siginfo_t *, const union siginfo_meta *);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGINFO_META_INTERNAL_H_ */
|
||||
|
|
|
@ -8,7 +8,7 @@ extern bool32 g_isrunningundermake;
|
|||
|
||||
void __start_fatal(const char *, int);
|
||||
void __restore_tty(void);
|
||||
void __oncrash(int, struct siginfo *, void *);
|
||||
void __oncrash(int, siginfo_t *, void *);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_LOG_INTERNAL_H_ */
|
||||
|
|
|
@ -188,9 +188,9 @@ relegated static char *ShowSseRegisters(char *p, ucontext_t *ctx) {
|
|||
return p;
|
||||
}
|
||||
|
||||
void ShowCrashReportHook(int, int, int, struct siginfo *, ucontext_t *);
|
||||
void ShowCrashReportHook(int, int, int, siginfo_t *, ucontext_t *);
|
||||
|
||||
static relegated void ShowCrashReport(int err, int sig, struct siginfo *si,
|
||||
static relegated void ShowCrashReport(int err, int sig, siginfo_t *si,
|
||||
ucontext_t *ctx) {
|
||||
#pragma GCC push_options
|
||||
#pragma GCC diagnostic ignored "-Walloca-larger-than="
|
||||
|
@ -267,7 +267,7 @@ static inline void SpinUnlock(atomic_uint *lock) {
|
|||
atomic_store_explicit(lock, 0, memory_order_release);
|
||||
}
|
||||
|
||||
relegated void __oncrash(int sig, struct siginfo *si, void *arg) {
|
||||
relegated void __oncrash(int sig, siginfo_t *si, void *arg) {
|
||||
static atomic_uint lock;
|
||||
BLOCK_CANCELATION;
|
||||
SpinLock(&lock);
|
||||
|
|
|
@ -189,8 +189,7 @@ static relegated char *GetSymbolName(struct SymbolTable *st, int symbol) {
|
|||
return buf;
|
||||
}
|
||||
|
||||
static relegated void __oncrash_impl(int sig, struct siginfo *si,
|
||||
ucontext_t *ctx) {
|
||||
static relegated void __oncrash_impl(int sig, siginfo_t *si, ucontext_t *ctx) {
|
||||
#pragma GCC push_options
|
||||
#pragma GCC diagnostic ignored "-Walloca-larger-than="
|
||||
long size = __get_safe_size(10000, 4096);
|
||||
|
@ -389,7 +388,7 @@ static inline void SpinUnlock(atomic_uint *lock) {
|
|||
atomic_store_explicit(lock, 0, memory_order_release);
|
||||
}
|
||||
|
||||
relegated void __oncrash(int sig, struct siginfo *si, void *arg) {
|
||||
relegated void __oncrash(int sig, siginfo_t *si, void *arg) {
|
||||
static atomic_uint lock;
|
||||
BLOCK_CANCELATION;
|
||||
SpinLock(&lock);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue