summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2013-06-01 04:05:26 +0000
committertedu <tedu@openbsd.org>2013-06-01 04:05:26 +0000
commit5636a1d2ee0e01a2d804948f1756be75737d3371 (patch)
tree6f968fb9a11b6b62cd50e5234c65da6a41502092
parentMake mutexes that get used in interrupts IPL_TTY instead of IPL_NONE. (diff)
downloadwireguard-openbsd-5636a1d2ee0e01a2d804948f1756be75737d3371.tar.xz
wireguard-openbsd-5636a1d2ee0e01a2d804948f1756be75737d3371.zip
some small style changes that are distracting me from seeing a real bug
-rw-r--r--sys/kern/kern_exit.c23
-rw-r--r--sys/kern/kern_sig.c25
2 files changed, 21 insertions, 27 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 5cccf33867e..a9acc650ac5 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.123 2013/05/07 19:26:25 guenther Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.124 2013/06/01 04:05:26 tedu Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -98,9 +98,8 @@ sys___threxit(struct proc *p, void *v, register_t *retval)
if (SCARG(uap, notdead) != NULL) {
pid_t zero = 0;
- if (copyout(&zero, SCARG(uap, notdead), sizeof(zero))) {
+ if (copyout(&zero, SCARG(uap, notdead), sizeof(zero)))
psignal(p, SIGSEGV);
- }
}
exit1(p, 0, EXIT_THREAD);
@@ -129,9 +128,9 @@ exit1(struct proc *p, int rv, int flags)
/* single-threaded? */
if (TAILQ_FIRST(&pr->ps_threads) == p &&
- TAILQ_NEXT(p, p_thr_link) == NULL)
+ TAILQ_NEXT(p, p_thr_link) == NULL) {
flags = EXIT_NORMAL;
- else {
+ } else {
/* nope, multi-threaded */
if (flags == EXIT_NORMAL)
single_thread_set(p, SINGLE_EXIT, 0);
@@ -159,20 +158,20 @@ exit1(struct proc *p, int rv, int flags)
TAILQ_REMOVE(&pr->ps_threads, p, p_thr_link);
if ((p->p_flag & P_THREAD) == 0) {
/* main thread gotta wait because it has the pid, et al */
- while (! TAILQ_EMPTY(&pr->ps_threads))
+ while (!TAILQ_EMPTY(&pr->ps_threads))
tsleep(&pr->ps_threads, PUSER, "thrdeath", 0);
if (pr->ps_flags & PS_PROFIL)
stopprofclock(pr);
- } else if (TAILQ_EMPTY(&pr->ps_threads))
+ } else if (TAILQ_EMPTY(&pr->ps_threads)) {
wakeup(&pr->ps_threads);
+ }
rup = pr->ps_ru;
if (rup == NULL) {
rup = pool_get(&rusage_pool, PR_WAITOK | PR_ZERO);
-
- if (pr->ps_ru == NULL)
+ if (pr->ps_ru == NULL) {
pr->ps_ru = rup;
- else {
+ } else {
pool_put(&rusage_pool, rup);
rup = pr->ps_ru;
}
@@ -205,7 +204,7 @@ exit1(struct proc *p, int rv, int flags)
if (sp->s_ttyp->t_pgrp)
pgsignal(sp->s_ttyp->t_pgrp,
SIGHUP, 1);
- (void) ttywait(sp->s_ttyp);
+ ttywait(sp->s_ttyp);
/*
* The tty could have been revoked
* if we blocked.
@@ -230,7 +229,7 @@ exit1(struct proc *p, int rv, int flags)
fixjobc(pr, pr->ps_pgrp, 0);
#ifdef ACCOUNTING
- (void)acct_process(p);
+ acct_process(p);
#endif
#ifdef KTRACE
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index fb7e0ee95f7..ad10883575e 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.151 2013/04/29 17:06:20 matthew Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.152 2013/06/01 04:05:26 tedu Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -863,11 +863,11 @@ ptsignal(struct proc *p, int signum, enum signal_type type)
*/
if (p->p_sigacts->ps_sigignore & mask)
return;
- if (p->p_sigmask & mask)
+ if (p->p_sigmask & mask) {
action = SIG_HOLD;
- else if (p->p_sigacts->ps_sigcatch & mask)
+ } else if (p->p_sigacts->ps_sigcatch & mask) {
action = SIG_CATCH;
- else {
+ } else {
action = SIG_DFL;
if (prop & SA_KILL && pr->ps_nice > NZERO)
@@ -886,9 +886,8 @@ ptsignal(struct proc *p, int signum, enum signal_type type)
atomic_setbits_int(&p->p_siglist, mask);
}
- if (prop & SA_CONT) {
+ if (prop & SA_CONT)
atomic_clearbits_int(&p->p_siglist, stopsigmask);
- }
if (prop & SA_STOP) {
atomic_clearbits_int(&p->p_siglist, contsigmask);
@@ -898,12 +897,10 @@ ptsignal(struct proc *p, int signum, enum signal_type type)
/*
* XXX delay processing of SA_STOP signals unless action == SIG_DFL?
*/
- if (prop & (SA_CONT | SA_STOP) && type != SPROPAGATED) {
- TAILQ_FOREACH(q, &pr->ps_threads, p_thr_link) {
+ if (prop & (SA_CONT | SA_STOP) && type != SPROPAGATED)
+ TAILQ_FOREACH(q, &pr->ps_threads, p_thr_link)
if (q != p)
ptsignal(q, signum, SPROPAGATED);
- }
- }
/*
* Defer further processing for signals which are held,
@@ -1137,7 +1134,6 @@ issignal(struct proc *p)
* to clear it from the pending mask.
*/
switch ((long)p->p_sigacts->ps_sigact[signum]) {
-
case (long)SIG_DFL:
/*
* Don't take default actions on system processes.
@@ -1181,7 +1177,6 @@ issignal(struct proc *p)
} else
goto keep;
/*NOTREACHED*/
-
case (long)SIG_IGN:
/*
* Masking above should prevent us ever trying
@@ -1192,7 +1187,6 @@ issignal(struct proc *p)
(pr->ps_flags & PS_TRACED) == 0)
printf("issignal\n");
break; /* == ignore */
-
default:
/*
* This signal has an action, let
@@ -1337,8 +1331,9 @@ postsig(int signum)
if (p->p_flag & P_SIGSUSPEND) {
atomic_clearbits_int(&p->p_flag, P_SIGSUSPEND);
returnmask = p->p_oldmask;
- } else
+ } else {
returnmask = p->p_sigmask;
+ }
p->p_sigmask |= ps->ps_catchmask[signum];
if ((ps->ps_sigreset & mask) != 0) {
ps->ps_sigcatch &= ~mask;
@@ -1564,7 +1559,7 @@ coredump_write(void *cookie, enum uio_seg segflg, const void *data, size_t len)
" at %lld failed: %d\n",
io->io_proc->p_pid, io->io_proc->p_comm,
segflg == UIO_USERSPACE ? "user" : "system",
- len, data, (long long) io->io_offset, error);
+ len, data, (long long)io->io_offset, error);
return (error);
}