mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-25 11:37:56 +00:00
9104847f21
changes in MD code are trivial, before this change, trapsignal and sendsig use discrete parameters, now they uses member fields of ksiginfo_t structure. For sendsig, this change allows us to pass POSIX realtime signal value to user code. 2. Remove cpu_thread_siginfo, it is no longer needed because we now always generate ksiginfo_t data and feed it to libpthread. 3. Add p_sigqueue to proc structure to hold shared signals which were blocked by all threads in the proc. 4. Add td_sigqueue to thread structure to hold all signals delivered to thread. 5. i386 and amd64 now return POSIX standard si_code, other arches will be fixed. 6. In this sigqueue implementation, pending signal set is kept as before, an extra siginfo list holds additional siginfo_t data for signals. kernel code uses psignal() still behavior as before, it won't be failed even under memory pressure, only exception is when deleting a signal, we should call sigqueue_delete to remove signal from sigqueue but not SIGDELSET. Current there is no kernel code will deliver a signal with additional data, so kernel should be as stable as before, a ksiginfo can carry more information, for example, allow signal to be delivered but throw away siginfo data if memory is not enough. SIGKILL and SIGSTOP have fast path in sigqueue_add, because they can not be caught or masked. The sigqueue() syscall allows user code to queue a signal to target process, if resource is unavailable, EAGAIN will be returned as specification said. Just before thread exits, signal queue memory will be freed by sigqueue_flush. Current, all signals are allowed to be queued, not only realtime signals. Earlier patch reviewed by: jhb, deischen Tested on: i386, amd64
68 lines
1.6 KiB
C
68 lines
1.6 KiB
C
/* $FreeBSD$ */
|
|
|
|
#ifndef _OSF1_SIGNAL_H
|
|
#define _OSF1_SIGNAL_H
|
|
|
|
#define OSF1_NSIG 64
|
|
|
|
#define OSF1_SIG_DFL 0
|
|
#define OSF1_SIG_ERR -1
|
|
#define OSF1_SIG_IGN 1
|
|
#define OSF1_SIG_HOLD 2
|
|
|
|
#define OSF1_SIGNO(a) ((a) & OSF1_SIGNO_MASK)
|
|
#define OSF1_SIGCALL(a) ((a) & ~OSF1_SIGNO_MASK)
|
|
|
|
#define OSF1_SIG_BLOCK 1
|
|
#define OSF1_SIG_UNBLOCK 2
|
|
#define OSF1_SIG_SETMASK 3
|
|
|
|
|
|
typedef u_long osf1_sigset_t;
|
|
typedef void (*osf1_handler_t)(int);
|
|
|
|
struct osf1_sigaction {
|
|
osf1_handler_t osa_handler;
|
|
osf1_sigset_t osa_mask;
|
|
int osa_flags;
|
|
};
|
|
|
|
struct osf1_sigaltstack {
|
|
caddr_t ss_sp;
|
|
int ss_flags;
|
|
size_t ss_size;
|
|
};
|
|
|
|
/* sa_flags */
|
|
#define OSF1_SA_ONSTACK 0x00000001
|
|
#define OSF1_SA_RESTART 0x00000002
|
|
#define OSF1_SA_NOCLDSTOP 0x00000004
|
|
#define OSF1_SA_NODEFER 0x00000008
|
|
#define OSF1_SA_RESETHAND 0x00000010
|
|
#define OSF1_SA_NOCLDWAIT 0x00000020
|
|
#define OSF1_SA_SIGINFO 0x00000040
|
|
|
|
/* ss_flags */
|
|
#define OSF1_SS_ONSTACK 0x00000001
|
|
#define OSF1_SS_DISABLE 0x00000002
|
|
|
|
|
|
#define OSF1_SIGNO_MASK 0x00FF
|
|
#define OSF1_SIGNAL_MASK 0x0000
|
|
#define OSF1_SIGDEFER_MASK 0x0100
|
|
#define OSF1_SIGHOLD_MASK 0x0200
|
|
#define OSF1_SIGRELSE_MASK 0x0400
|
|
#define OSF1_SIGIGNORE_MASK 0x0800
|
|
#define OSF1_SIGPAUSE_MASK 0x1000
|
|
|
|
|
|
extern int osf1_to_linux_sig[];
|
|
void bsd_to_osf1_sigaltstack(const struct sigaltstack *, struct osf1_sigaltstack *);
|
|
void bsd_to_osf1_sigset(const sigset_t *, osf1_sigset_t *);
|
|
void osf1_to_bsd_sigaltstack(const struct osf1_sigaltstack *, struct sigaltstack *);
|
|
void osf1_to_bsd_sigset(const osf1_sigset_t *, sigset_t *);
|
|
void osf1_sendsig(sig_t, struct ksiginfo *, sigset_t *);
|
|
|
|
|
|
#endif /* !_OSF1_SIGNAL_H */
|