summaryrefslogtreecommitdiffstats
path: root/sys/sys/signalvar.h
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2009-11-17 11:39:15 +0000
committerkib <kib@FreeBSD.org>2009-11-17 11:39:15 +0000
commit2d08f816e13d4eca3a96eb24f578541791a335e7 (patch)
treec59c7fddba5c77496f61d018fe1c5c004cf33224 /sys/sys/signalvar.h
parent45887d4e283c9ac9f5830e01dd3a82881571fded (diff)
downloadFreeBSD-src-2d08f816e13d4eca3a96eb24f578541791a335e7.zip
FreeBSD-src-2d08f816e13d4eca3a96eb24f578541791a335e7.tar.gz
Among signal generation syscalls, only sigqueue(2) is allowed by POSIX
to fail due to lack of resources to queue siginfo. Add KSI_SIGQ flag that allows sigqueue_add() to fail while trying to allocate memory for new siginfo. When the flag is not set, behaviour is the same as for KSI_TRAP: if memory cannot be allocated, set bit in sq_kill. KSI_TRAP is kept to preserve KBI. Add SI_KERNEL si_code, to be used in siginfo.si_code when signal is generated by kernel. Deliver siginfo when signal is generated by kill(2) family of syscalls (SI_USER with properly filled si_uid and si_pid), or by kernel (SI_KERNEL, mostly job control or SIGIO). Since KSI_SIGQ flag is not set for the ksi, low memory condition cause old behaviour. Keep psignal(9) KBI intact, but modify it to generate SI_KERNEL si_code. Pgsignal(9) and gsignal(9) now take ksi explicitely. Add pksignal(9) that behaves like psignal but takes ksi, and ddb kill command implemented as pksignal(..., ksi = NULL) to not do allocation while in debugger. While there, remove some register specifiers and use ANSI C prototypes. Reviewed by: davidxu MFC after: 1 month
Diffstat (limited to 'sys/sys/signalvar.h')
-rw-r--r--sys/sys/signalvar.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
index 65d9cf5..fd0fac3 100644
--- a/sys/sys/signalvar.h
+++ b/sys/sys/signalvar.h
@@ -233,7 +233,8 @@ typedef struct ksiginfo {
#define KSI_TRAP 0x01 /* Generated by trap. */
#define KSI_EXT 0x02 /* Externally managed ksi. */
#define KSI_INS 0x04 /* Directly insert ksi, not the copy */
-#define KSI_COPYMASK KSI_TRAP
+#define KSI_SIGQ 0x08 /* Generated by sigqueue, might ret EGAIN. */
+#define KSI_COPYMASK (KSI_TRAP|KSI_SIGQ)
#define KSI_ONQ(ksi) ((ksi)->ksi_sigq != NULL)
@@ -326,10 +327,11 @@ extern int kern_logsigexit; /* Sysctl variable kern.logsigexit */
*/
int cursig(struct thread *td, int stop_allowed);
void execsigs(struct proc *p);
-void gsignal(int pgid, int sig);
+void gsignal(int pgid, int sig, ksiginfo_t *ksi);
void killproc(struct proc *p, char *why);
+void pksignal(struct proc *p, int sig, ksiginfo_t *ksi);
void pgsigio(struct sigio **, int signum, int checkctty);
-void pgsignal(struct pgrp *pgrp, int sig, int checkctty);
+void pgsignal(struct pgrp *pgrp, int sig, int checkctty, ksiginfo_t *ksi);
int postsig(int sig);
void psignal(struct proc *p, int sig);
int psignal_event(struct proc *p, struct sigevent *, ksiginfo_t *);
OpenPOWER on IntegriCloud