From owner-freebsd-arch Sat Jun 1 22: 3:12 2002 Delivered-To: freebsd-arch@freebsd.org Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by hub.freebsd.org (Postfix) with ESMTP id 0874B37B401 for ; Sat, 1 Jun 2002 22:03:01 -0700 (PDT) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id g52518N00893 for arch@FreeBSD.org; Sun, 2 Jun 2002 01:01:08 -0400 (EDT) (envelope-from mike) Date: Sun, 2 Jun 2002 01:01:08 -0400 From: Mike Barcroft To: arch@FreeBSD.org Subject: Removing wait union Message-ID: <20020602010108.B16166@espresso.q9media.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="oC1+HKm2/end4ao3" Content-Disposition: inline Organization: The FreeBSD Project Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --oC1+HKm2/end4ao3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Does anyone have any objections to removing the deprecated 4.2/4.3BSD wait union in ? It's been deprecating since Rev 1.1 and there are only a few consumers in the base system. Attached are two patches, one to removing it from and the other to remove its consumers. Changes to lpd(8) sent directly to its maintainer. Best regards, Mike Barcroft --oC1+HKm2/end4ao3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="waith.diff" Remove the deprecated 4.2/4.3BSD wait union. Index: wait.h =================================================================== RCS file: /work/repo/src/sys/sys/wait.h,v retrieving revision 1.16 diff -u -r1.16 wait.h --- wait.h 1 Jun 2002 21:07:10 -0000 1.16 +++ wait.h 2 Jun 2002 04:43:35 -0000 @@ -37,6 +37,8 @@ #ifndef _SYS_WAIT_H_ #define _SYS_WAIT_H_ +#include + /* * This file holds definitions relevant to the wait4 system call and the * alternate interfaces that use it (wait, wait3, waitpid). @@ -86,71 +88,16 @@ #define WLINUXCLONE 0x80000000 /* Wait for kthread spawned from linux_clone. */ #endif -#if __BSD_VISIBLE -/* POSIX extensions and 4.2/4.3 compatibility: */ - /* * Tokens for special values of the "pid" parameter to wait4. */ +#if __BSD_VISIBLE #define WAIT_ANY (-1) /* any process */ #define WAIT_MYPGRP 0 /* any process in my process group */ - -#include - -/* - * Deprecated: - * Structure of the information in the status word returned by wait4. - * If w_stopval==WSTOPPED, then the second structure describes - * the information returned, else the first. - */ -union wait { - int w_status; /* used in syscall */ - /* - * Terminated process status. - */ - struct { -#if _BYTE_ORDER == _LITTLE_ENDIAN - unsigned int w_Termsig:7, /* termination signal */ - w_Coredump:1, /* core dump indicator */ - w_Retcode:8, /* exit code if w_termsig==0 */ - w_Filler:16; /* upper bits filler */ -#endif -#if _BYTE_ORDER == _BIG_ENDIAN - unsigned int w_Filler:16, /* upper bits filler */ - w_Retcode:8, /* exit code if w_termsig==0 */ - w_Coredump:1, /* core dump indicator */ - w_Termsig:7; /* termination signal */ -#endif - } w_T; - /* - * Stopped process status. Returned only for traced children unless - * requested with the WUNTRACED option bit. - */ - struct { -#if _BYTE_ORDER == _LITTLE_ENDIAN - unsigned int w_Stopval:8, /* == W_STOPPED if stopped */ - w_Stopsig:8, /* signal that stopped us */ - w_Filler:16; /* upper bits filler */ -#endif -#if _BYTE_ORDER == _BIG_ENDIAN - unsigned int w_Filler:16, /* upper bits filler */ - w_Stopsig:8, /* signal that stopped us */ - w_Stopval:8; /* == W_STOPPED if stopped */ -#endif - } w_S; -}; -#define w_termsig w_T.w_Termsig -#define w_coredump w_T.w_Coredump -#define w_retcode w_T.w_Retcode -#define w_stopval w_S.w_Stopval -#define w_stopsig w_S.w_Stopsig - -#define WSTOPPED _WSTOPPED #endif /* __BSD_VISIBLE */ #ifndef _KERNEL #include -#include __BEGIN_DECLS struct rusage; /* forward declaration */ --oC1+HKm2/end4ao3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="waitu.diff" Use POSIX macros for wait(2)-style status information instead of the deprecated 4.2/4.3BSD wait union. Fix some nearby pid_t/int confusion. Index: games/cribbage/instr.c =================================================================== RCS file: /work/repo/src/games/cribbage/instr.c,v retrieving revision 1.5 diff -u -r1.5 instr.c --- games/cribbage/instr.c 12 Dec 1999 03:04:15 -0000 1.5 +++ games/cribbage/instr.c 2 Jun 2002 04:46:42 -0000 @@ -58,8 +58,8 @@ instructions() { struct stat sb; - union wait pstat; pid_t pid; + int pstat; char *pager, *path; if (stat(_PATH_INSTR, &sb)) { @@ -84,7 +84,7 @@ do { pid = waitpid(pid, (int *)&pstat, 0); } while (pid == -1 && errno == EINTR); - if (pid == -1 || pstat.w_status) + if (pid == -1 || WEXITSTATUS(pstat) || WTERMSIG(pstat)) exit(1); } } Index: games/sail/pl_1.c =================================================================== RCS file: /work/repo/src/games/sail/pl_1.c,v retrieving revision 1.2 diff -u -r1.2 pl_1.c --- games/sail/pl_1.c 30 Nov 1999 03:49:36 -0000 1.2 +++ games/sail/pl_1.c 2 Jun 2002 04:47:55 -0000 @@ -126,8 +126,8 @@ void child() { - union wait status; - int pid; + pid_t pid; + int status; (void) signal(SIGCHLD, SIG_IGN); do { Index: gnu/lib/libdialog/raw_popen.c =================================================================== RCS file: /work/repo/src/gnu/lib/libdialog/raw_popen.c,v retrieving revision 1.3 diff -u -r1.3 raw_popen.c --- gnu/lib/libdialog/raw_popen.c 9 Jul 2001 09:23:38 -0000 1.3 +++ gnu/lib/libdialog/raw_popen.c 2 Jun 2002 01:03:41 -0000 @@ -131,8 +131,7 @@ raw_pclose(FILE *iop) { register struct pid *cur, *last; - int omask; - union wait pstat; + int omask, pstat; pid_t pid; (void)fclose(iop); @@ -158,5 +157,5 @@ last->next = cur->next; free(cur); - return (pid == -1 ? -1 : pstat.w_status); + return (pid == -1 ? -1 : pstat); } Index: usr.bin/rlogin/rlogin.c =================================================================== RCS file: /work/repo/src/usr.bin/rlogin/rlogin.c,v retrieving revision 1.32 diff -u -r1.32 rlogin.c --- usr.bin/rlogin/rlogin.c 8 May 2002 00:46:30 -0000 1.32 +++ usr.bin/rlogin/rlogin.c 2 Jun 2002 04:50:45 -0000 @@ -468,16 +468,16 @@ void catch_child(int signo __unused) { - union wait status; - int pid; + pid_t pid; + int status; for (;;) { - pid = wait3((int *)&status, WNOHANG|WUNTRACED, NULL); + pid = wait3(&status, WNOHANG|WUNTRACED, NULL); if (pid == 0) return; /* if the child (reader) dies, just quit */ if (pid < 0 || (pid == child && !WIFSTOPPED(status))) - done((int)(status.w_termsig | status.w_retcode)); + done(WTERMSIG(status) | WEXITSTATUS(status)); } /* NOTREACHED */ } Index: usr.bin/script/script.c =================================================================== RCS file: /work/repo/src/usr.bin/script/script.c,v retrieving revision 1.18 diff -u -r1.18 script.c --- usr.bin/script/script.c 22 Mar 2002 01:42:27 -0000 1.18 +++ usr.bin/script/script.c 2 Jun 2002 02:30:34 -0000 @@ -209,11 +209,11 @@ void finish() { - int die, e, pid; - union wait status; + pid_t pid; + int die, e, status; die = e = 0; - while ((pid = wait3((int *)&status, WNOHANG, 0)) > 0) + while ((pid = wait3(&status, WNOHANG, 0)) > 0) if (pid == child) { die = 1; if (WIFEXITED(status)) Index: usr.bin/window/wwchild.c =================================================================== RCS file: /work/repo/src/usr.bin/window/wwchild.c,v retrieving revision 1.4 diff -u -r1.4 wwchild.c --- usr.bin/window/wwchild.c 17 May 2001 09:38:48 -0000 1.4 +++ usr.bin/window/wwchild.c 2 Jun 2002 04:51:38 -0000 @@ -48,10 +48,9 @@ void wwchild() { - int olderrno; register struct ww **wp; - union wait w; - int pid; + pid_t pid; + int olderrno, w; char collected = 0; olderrno = errno; --oC1+HKm2/end4ao3-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message