diff options
author | 2011-11-06 01:43:50 +0000 | |
---|---|---|
committer | 2011-11-06 01:43:50 +0000 | |
commit | 5105d5e33f1c8981e5d548bd519b9144eccd69e1 (patch) | |
tree | d6dfc57307c37665be41362f630c4276fc83c739 | |
parent | Further on the road to working. (diff) | |
download | wireguard-openbsd-5105d5e33f1c8981e5d548bd519b9144eccd69e1.tar.xz wireguard-openbsd-5105d5e33f1c8981e5d548bd519b9144eccd69e1.zip |
union wait is dead, ancient history; stop using it
ok deraadt@
-rw-r--r-- | bin/csh/proc.c | 16 | ||||
-rw-r--r-- | games/sail/pl_1.c | 6 | ||||
-rw-r--r-- | usr.sbin/amd/amd/sched.c | 19 |
3 files changed, 21 insertions, 20 deletions
diff --git a/bin/csh/proc.c b/bin/csh/proc.c index 5f55b7cf6c3..0067cc80a1a 100644 --- a/bin/csh/proc.c +++ b/bin/csh/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.21 2009/10/27 23:59:21 deraadt Exp $ */ +/* $OpenBSD: proc.c,v 1.22 2011/11/06 01:43:50 guenther Exp $ */ /* $NetBSD: proc.c,v 1.9 1995/04/29 23:21:33 mycroft Exp $ */ /*- @@ -75,13 +75,13 @@ pchild(int notused) int pid; extern int insource; int save_errno = errno; - union wait w; + int w; int jobflags; struct rusage ru; loop: errno = 0; /* reset, just in case */ - pid = wait3(&w.w_status, + pid = wait3(&w, (setintr && (intty || insource) ? WNOHANG | WUNTRACED : WNOHANG), &ru); if (pid <= 0) { @@ -103,7 +103,7 @@ found: pp->p_flags &= ~(PRUNNING | PSTOPPED | PREPORTED); if (WIFSTOPPED(w)) { pp->p_flags |= PSTOPPED; - pp->p_reason = w.w_stopsig; + pp->p_reason = WSTOPSIG(w); } else { if (pp->p_flags & (PTIME | PPTIME) || adrof(STRtime)) @@ -111,16 +111,16 @@ found: pp->p_rusage = ru; if (WIFSIGNALED(w)) { - if (w.w_termsig == SIGINT) + if (WTERMSIG(w) == SIGINT) pp->p_flags |= PINTERRUPTED; else pp->p_flags |= PSIGNALED; - if (w.w_coredump) + if (WCOREDUMP(w)) pp->p_flags |= PDUMPED; - pp->p_reason = w.w_termsig; + pp->p_reason = WTERMSIG(w); } else { - pp->p_reason = w.w_retcode; + pp->p_reason = WEXITSTATUS(w); if (pp->p_reason != 0) pp->p_flags |= PAEXITED; else diff --git a/games/sail/pl_1.c b/games/sail/pl_1.c index a68e69a0e5c..f9a463744b4 100644 --- a/games/sail/pl_1.c +++ b/games/sail/pl_1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pl_1.c,v 1.9 2009/10/27 23:59:27 deraadt Exp $ */ +/* $OpenBSD: pl_1.c,v 1.10 2011/11/06 01:43:50 guenther Exp $ */ /* $NetBSD: pl_1.c,v 1.3 1995/04/22 10:37:07 cgd Exp $ */ /* @@ -124,13 +124,13 @@ void child(n) int n __attribute__((unused)); { - union wait status; + int status; int pid; int save_errno = errno; (void) signal(SIGCHLD, SIG_DFL); do { - pid = wait3((int *)&status, WNOHANG, (struct rusage *)0); + pid = waitpid((pid_t)-1, &status, WNOHANG); if (pid < 0 || (pid > 0 && !WIFSTOPPED(status))) hasdriver = 0; } while (pid > 0); diff --git a/usr.sbin/amd/amd/sched.c b/usr.sbin/amd/amd/sched.c index 38e37433aa7..4fdf6f2c23b 100644 --- a/usr.sbin/amd/amd/sched.c +++ b/usr.sbin/amd/amd/sched.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sched.c,v 1.13 2004/10/21 20:57:08 millert Exp $ */ +/* $OpenBSD: sched.c,v 1.14 2011/11/06 01:43:50 guenther Exp $ */ /* * Copyright (c) 1990 Jan-Simon Pendry @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)sched.c 8.1 (Berkeley) 6/6/93 - * $Id: sched.c,v 1.13 2004/10/21 20:57:08 millert Exp $ + * $Id: sched.c,v 1.14 2011/11/06 01:43:50 guenther Exp $ */ /* @@ -54,7 +54,7 @@ struct pjob { pid_t pid; /* Process ID of job */ cb_fun cb_fun; /* Callback function */ void *cb_closure; /* Closure for callback */ - union wait w; /* Status filled in by sigchld */ + int w; /* Status filled in by sigchld */ void *wchan; /* Wait channel */ }; @@ -193,24 +193,24 @@ wakeup_task(int rc, int term, void *cl) void sigchld(int sig) { - union wait w; + int w; int save_errno = errno; pid_t pid; #ifdef SYS5_SIGNALS if ((pid = wait(&w)) > 0) { #else - while ((pid = wait3((int *) &w, WNOHANG, (struct rusage *) 0)) > 0) { + while ((pid = waitpid((pid_t)-1, &w, WNOHANG)) > 0) { #endif /* SYS5_SIGNALS */ pjob *p, *p2; if (WIFSIGNALED(w)) plog(XLOG_ERROR, "Process %ld exited with signal %ld", - (long)pid, w.w_termsig); + (long)pid, WTERMSIG(w)); #ifdef DEBUG else dlog("Process %ld exited with status %ld", - (long)pid, w.w_retcode); + (long)pid, WEXITSTATUS(w)); #endif /* DEBUG */ for (p = FIRST(pjob, &proc_wait_list); @@ -263,8 +263,9 @@ do_task_notify(void) * Do callback if it exists */ if (p->cb_fun) - (*p->cb_fun)(p->w.w_retcode, - p->w.w_termsig, p->cb_closure); + (*p->cb_fun)(WIFEXITED(p->w) ? WEXITSTATUS(p->w) : 0, + WIFSIGNALED(p->w) ? WTERMSIG(p->w) : 0, + p->cb_closure); free((void *)p); } |