summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/compat/linux/linux_signal.c4
-rw-r--r--sys/kern/kern_exec.c4
-rw-r--r--sys/kern/kern_exit.c2
-rw-r--r--sys/kern/kern_sig.c38
-rw-r--r--sys/kern/kern_thr.c9
-rw-r--r--sys/sys/signalvar.h6
6 files changed, 41 insertions, 22 deletions
diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c
index 9cc05ed9..ca4bda1 100644
--- a/sys/compat/linux/linux_signal.c
+++ b/sys/compat/linux/linux_signal.c
@@ -501,7 +501,7 @@ linux_rt_sigtimedwait(struct thread *td,
/* Repost if we got an error. */
if (error && info.ksi_signo) {
PROC_LOCK(td->td_proc);
- tdsignal(td->td_proc, td, info.ksi_signo, &info);
+ tdksignal(td, info.ksi_signo, &info);
PROC_UNLOCK(td->td_proc);
} else
td->td_retval[0] = info.ksi_signo;
@@ -587,7 +587,7 @@ linux_do_tkill(struct thread *td, l_int tgid, l_int pid, l_int signum)
ksi.ksi_pid = proc->p_pid;
ksi.ksi_uid = proc->p_ucred->cr_ruid;
- error = tdsignal(p, NULL, ksi.ksi_signo, &ksi);
+ error = pksignal(p, ksi.ksi_signo, &ksi);
out:
PROC_UNLOCK(p);
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 149e6df..3a73f7d 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -755,13 +755,13 @@ interpret:
/*
* If tracing the process, trap to debugger so breakpoints
* can be set before the program executes.
- * Use tdsignal to deliver signal to current thread, use
+ * Use tdsignal to deliver signal to current thread, using
* psignal may cause the signal to be delivered to wrong thread
* because that thread will exit, remember we are going to enter
* single thread mode.
*/
if (p->p_flag & P_TRACED)
- tdsignal(p, td, SIGTRAP, NULL);
+ tdsignal(td, SIGTRAP);
/* clear "fork but no exec" flag, as we _are_ execing */
p->p_acflag &= ~AFORK;
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index af00f42..a781f8b 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -732,7 +732,7 @@ proc_reap(struct thread *td, struct proc *p, int *status, int options,
p->p_oppid = 0;
proc_reparent(p, t);
PROC_UNLOCK(p);
- tdsignal(t, NULL, SIGCHLD, p->p_ksi);
+ pksignal(t, SIGCHLD, p->p_ksi);
wakeup(t);
cv_broadcast(&p->p_pwait);
PROC_UNLOCK(t);
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 63fe81e..04c2ba7 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -107,6 +107,8 @@ static int killpg1(struct thread *td, int sig, int pgid, int all,
ksiginfo_t *ksi);
static int issignal(struct thread *td, int stop_allowed);
static int sigprop(int sig);
+static int tdsendsignal(struct proc *p, struct thread *td, int sig,
+ ksiginfo_t *ksi);
static void tdsigwakeup(struct thread *, int, sig_t, int);
static void sig_suspend_threads(struct thread *, struct proc *, int);
static int filt_sigattach(struct knote *kn);
@@ -1797,7 +1799,7 @@ sigqueue(struct thread *td, struct sigqueue_args *uap)
ksi.ksi_pid = td->td_proc->p_pid;
ksi.ksi_uid = td->td_ucred->cr_ruid;
ksi.ksi_value.sival_ptr = uap->value;
- error = tdsignal(p, NULL, ksi.ksi_signo, &ksi);
+ error = pksignal(p, ksi.ksi_signo, &ksi);
}
PROC_UNLOCK(p);
return (error);
@@ -1907,7 +1909,7 @@ trapsignal(struct thread *td, ksiginfo_t *ksi)
mtx_unlock(&ps->ps_mtx);
p->p_code = code; /* XXX for core dump/debugger */
p->p_sig = sig; /* XXX to verify code */
- tdsignal(p, td, sig, ksi);
+ tdsendsignal(p, td, sig, ksi);
}
PROC_UNLOCK(p);
}
@@ -1962,14 +1964,14 @@ psignal(struct proc *p, int sig)
ksiginfo_init(&ksi);
ksi.ksi_signo = sig;
ksi.ksi_code = SI_KERNEL;
- (void) tdsignal(p, NULL, sig, &ksi);
+ (void) tdsendsignal(p, NULL, sig, &ksi);
}
-void
+int
pksignal(struct proc *p, int sig, ksiginfo_t *ksi)
{
- (void) tdsignal(p, NULL, sig, ksi);
+ return (tdsendsignal(p, NULL, sig, ksi));
}
int
@@ -1992,11 +1994,29 @@ psignal_event(struct proc *p, struct sigevent *sigev, ksiginfo_t *ksi)
if (td == NULL)
return (ESRCH);
}
- return (tdsignal(p, td, ksi->ksi_signo, ksi));
+ return (tdsendsignal(p, td, ksi->ksi_signo, ksi));
}
-int
-tdsignal(struct proc *p, struct thread *td, int sig, ksiginfo_t *ksi)
+void
+tdsignal(struct thread *td, int sig)
+{
+ ksiginfo_t ksi;
+
+ ksiginfo_init(&ksi);
+ ksi.ksi_signo = sig;
+ ksi.ksi_code = SI_KERNEL;
+ (void) tdsendsignal(td->td_proc, td, sig, &ksi);
+}
+
+void
+tdksignal(struct thread *td, int sig, ksiginfo_t *ksi)
+{
+
+ (void) tdsendsignal(td->td_proc, td, sig, ksi);
+}
+
+static int
+tdsendsignal(struct proc *p, struct thread *td, int sig, ksiginfo_t *ksi)
{
sig_t action;
sigqueue_t *sigqueue;
@@ -2882,7 +2902,7 @@ sigparent(struct proc *p, int reason, int status)
if (KSI_ONQ(p->p_ksi))
return;
}
- tdsignal(p->p_pptr, NULL, SIGCHLD, p->p_ksi);
+ pksignal(p->p_pptr, SIGCHLD, p->p_ksi);
}
static void
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index 0b90dfc..d8f7a8e 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -326,7 +326,7 @@ thr_kill(struct thread *td, struct thr_kill_args *uap)
error = 0;
if (uap->sig == 0)
break;
- tdsignal(p, ttd, uap->sig, &ksi);
+ tdksignal(ttd, uap->sig, &ksi);
}
}
}
@@ -342,7 +342,7 @@ thr_kill(struct thread *td, struct thr_kill_args *uap)
else if (!_SIG_VALID(uap->sig))
error = EINVAL;
else
- tdsignal(p, ttd, uap->sig, &ksi);
+ tdksignal(ttd, uap->sig, &ksi);
}
PROC_UNLOCK(p);
return (error);
@@ -384,8 +384,7 @@ thr_kill2(struct thread *td, struct thr_kill2_args *uap)
error = 0;
if (uap->sig == 0)
break;
- tdsignal(p, ttd, uap->sig,
- &ksi);
+ tdksignal(ttd, uap->sig, &ksi);
}
}
}
@@ -401,7 +400,7 @@ thr_kill2(struct thread *td, struct thr_kill2_args *uap)
else if (!_SIG_VALID(uap->sig))
error = EINVAL;
else
- tdsignal(p, ttd, uap->sig, &ksi);
+ tdksignal(ttd, uap->sig, &ksi);
}
}
PROC_UNLOCK(p);
diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
index 552a835..286713d 100644
--- a/sys/sys/signalvar.h
+++ b/sys/sys/signalvar.h
@@ -330,7 +330,7 @@ int cursig(struct thread *td, int stop_allowed);
void execsigs(struct proc *p);
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);
+int 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, ksiginfo_t *ksi);
int postsig(int sig);
@@ -346,8 +346,8 @@ int sig_ffs(sigset_t *set);
void siginit(struct proc *p);
void signotify(struct thread *td);
void tdsigcleanup(struct thread *td);
-int tdsignal(struct proc *p, struct thread *td, int sig,
- ksiginfo_t *ksi);
+void tdsignal(struct thread *td, int sig);
+void tdksignal(struct thread *td, int sig, ksiginfo_t *ksi);
void trapsignal(struct thread *td, ksiginfo_t *);
int ptracestop(struct thread *td, int sig);
ksiginfo_t * ksiginfo_alloc(int);
OpenPOWER on IntegriCloud