Subject: wait4 arrives in 2.11BSD (#126 - 3 of 4) Index: lib/ 2.11BSD Description: The wait4 syscall is not present in 2.11BSD. This means that 'waitpid' is also not present. The CGL_RTP kernel configuration option has not been known to work for years. Not too long ago i was informed that even if the 'rtp' capability were made operable it interacted very badly with the networking code. The 'rtp' option has moved from the deprecated to removed catagory. The quota system was needlessly complicated by emulation the p_quota member of the 4.3BSD proc structure. It is not necessary to have _both_ the p_quota (in 2.11 this was emulated with the parallel pxquota array) and u_quota entities. The p_quota emulation was removed with no ill effect. Repeat-By: Either by examination or by attempting to compile/link a program which uses 'wait4' or 'waitpid'. Fix: Apply the 4 parts (this is part 3) of the update kit, remake the kernel, reboot, and then remake the modified parts of libc.a This part (#3) contains the updates to several Makefiles in the /usr/src/lib directories, a small change to 'adb' to decode the wait4(2) syscall, addition to the lint library for wait4(2), and changes to the system call definition include files to define 'wait4' (and remove wait, wait3). The following files are modified: /usr/include/syscall.h Add 'wait4' (as syscall 7). Remove 'wait'and and 'rtp'. /usr/lib/lint/llib-lc Add definition for 'wait4'. /usr/src/bin/adb/opset.c Add 'wait4' to list of system calls recognized. Change 'wait' to "old wait". /usr/src/lib/libc/gen/Makefile 'wait', 'wait3' are now chapter 3 routines rather than system calls. 'waitpid', 'wait', 'wait3' are now in the "gen" directory (all 3 are written using 'wait4'). /usr/src/lib/libc/pdp/compat-2.9/Makefile 'rtp' was removed. /usr/src/lib/libc/pdp/sys/Makefile 'wait' and 'wait3' removed. 'wait4' added. /usr/src/lib/libc/pdp/sys/SYS.h The "return from syscall" logic was changed to save space in application programs. Previously normal system calls did: sys SYS_wait bcs error rts pc error: mov r0, _errno mov $-1,r0 rts pc This has been replaced with: sys SYS_wait jmp x_norm The common syscall exit point (x_norm) is defined _once_ now per program (rather than once per syscall) in _exit.s One extra instruction per system call is a small price to pay for a couple hundred bytes of text space per program. /usr/src/lib/libc/pdp/sys/_exit.s The common exit (x_norm) and error (x_error) entry points created. These provide a central exit point for syscalls as mentioned above. =================================cut here=================================== *** /usr/include/syscall.h.old Tue Jan 6 01:36:18 1987 --- /usr/include/syscall.h Mon Mar 15 18:20:43 1993 *************** *** 12,18 **** #define SYS_write 4 #define SYS_open 5 #define SYS_close 6 ! /* 7 is old: wait */ #define SYS_creat 8 #define SYS_link 9 #define SYS_unlink 10 --- 12,18 ---- #define SYS_write 4 #define SYS_open 5 #define SYS_close 6 ! #define SYS_wait4 7 #define SYS_creat 8 #define SYS_link 9 #define SYS_unlink 10 *************** *** 89,95 **** #define SYS_getpgrp 81 #define SYS_setpgrp 82 #define SYS_setitimer 83 ! #define SYS_wait 84 #define SYS_swapon 85 #define SYS_getitimer 86 #define SYS_gethostname 87 --- 89,95 ---- #define SYS_getpgrp 81 #define SYS_setpgrp 82 #define SYS_setitimer 83 ! /* 84 is old; wait,wait3 */ #define SYS_swapon 85 #define SYS_getitimer 86 #define SYS_gethostname 87 *************** *** 158,166 **** #define SYS_getsockname 150 /* ! * BSD2.10 special calls */ ! #define SYS_rtp 151 #define SYS_nostk 152 #define SYS_fetchi 153 #define SYS_ucall 154 --- 158,166 ---- #define SYS_getsockname 150 /* ! * BSD2.11 special calls */ ! /* 151 is unused */ #define SYS_nostk 152 #define SYS_fetchi 153 #define SYS_ucall 154 *** /usr/lib/lint/llib-lc.old Sat Aug 29 15:33:22 1987 --- /usr/lib/lint/llib-lc Sat Mar 13 18:11:24 1993 *************** *** 172,177 **** --- 172,179 ---- vhangup() { ; } int wait(s) union wait *s; { return(1); } int wait3( s, o, r) union wait *s; struct rusage *r; { return 1;} + int wait4( p, s, o, r) int p; union wait *s; int o; struct rusage *r; { return 1;} + int waitpid( p, s, o) int p; union wait *s; int o; { return 1;} int write(f, b, l) char *b; unsigned l; { return(l); } int writev( f, v, l) struct iovec *v; { return l; } *** /usr/src/bin/adb/opset.c.old Tue Jun 30 22:54:03 1992 --- /usr/src/bin/adb/opset.c Fri Mar 12 22:57:02 1993 *************** *** 143,149 **** "write", "open", "close", ! "old wait", "creat", "link", "unlink", --- 143,149 ---- "write", "open", "close", ! "wait4", "creat", "link", "unlink", *************** *** 220,226 **** "getpgrp", "setpgrp", "setitimer", ! "wait", "swapon", "getitimer", "gethostname", --- 220,226 ---- "getpgrp", "setpgrp", "setitimer", ! "old wait", "swapon", "getitimer", "gethostname", *** /usr/src/lib/libc/gen/Makefile.old Sun May 21 00:25:36 1989 --- /usr/src/lib/libc/gen/Makefile Fri Mar 12 22:28:31 1993 *************** *** 28,34 **** setenv.c seteuid.c setruid.c siglist.c signal.c siginterrupt.c \ sleep.c strcasecmp.c swab.c syslog.c system.c telldir.c time.c \ timezone.c ttyname.c ttyslot.c ualarm.c usleep.c valloc.c strdup.c \ ! strsep.c VAXSRC= abs.c bcmp.c bcopy.c bzero.c fabs.c ffs.c frexp.c index.c insque.c \ rindex.c remque.c strcat.c strcmp.c strcpy.c strlen.c strncat.c \ strncmp.c strncpy.c --- 28,34 ---- setenv.c seteuid.c setruid.c siglist.c signal.c siginterrupt.c \ sleep.c strcasecmp.c swab.c syslog.c system.c telldir.c time.c \ timezone.c ttyname.c ttyslot.c ualarm.c usleep.c valloc.c strdup.c \ ! strsep.c wait.c wait3.c waitpid.c VAXSRC= abs.c bcmp.c bcopy.c bzero.c fabs.c ffs.c frexp.c index.c insque.c \ rindex.c remque.c strcat.c strcmp.c strcpy.c strlen.c strncat.c \ strncmp.c strncpy.c *************** *** 42,48 **** setenv.o seteuid.o setruid.o siglist.o signal.o siginterrupt.o \ sleep.o strcasecmp.o swab.o syslog.o system.o telldir.o time.o \ timezone.o ttyname.o ttyslot.o ualarm.o usleep.o valloc.o strdup.o \ ! strsep.o VAXOBJ= abs.o bcmp.o bcopy.o bzero.o fabs.c ffs.o frexp.o index.o insque.o \ rindex.o remque.o strcat.o strcmp.o strcpy.o strlen.o strncat.o \ strncmp.o strncpy.o --- 42,48 ---- setenv.o seteuid.o setruid.o siglist.o signal.o siginterrupt.o \ sleep.o strcasecmp.o swab.o syslog.o system.o telldir.o time.o \ timezone.o ttyname.o ttyslot.o ualarm.o usleep.o valloc.o strdup.o \ ! strsep.o wait.o wait3.o waitpid.o VAXOBJ= abs.o bcmp.o bcopy.o bzero.o fabs.c ffs.o frexp.o index.o insque.o \ rindex.o remque.o strcat.o strcmp.o strcpy.o strlen.o strncat.o \ strncmp.o strncpy.o *************** *** 94,99 **** --- 94,103 ---- alarm.o: alarm.c /usr/include/sys/time.h /usr/include/time.h atoi.o: atoi.c atol.o: atol.c + abort.o: abort.c /usr/include/signal.h + alarm.o: alarm.c /usr/include/sys/time.h /usr/include/time.h + atoi.o: atoi.c + atol.o: atol.c calloc.o: calloc.c closedir.o: closedir.c /usr/include/sys/param.h /usr/include/sys/localopts.h closedir.o: /usr/include/machine/machparam.h /usr/include/signal.h *************** *** 200,205 **** --- 204,217 ---- valloc.o: valloc.c strdup.o: strdup.c /usr/include/sys/types.h /usr/include/stdio.h strsep.o: strsep.c /usr/include/stdio.h + wait.o: wait.c /usr/include/sys/types.h /usr/include/sys/time.h + wait.o: /usr/include/time.h /usr/include/sys/wait.h /usr/include/sys/resource.h + wait3.o: wait3.c /usr/include/sys/types.h /usr/include/sys/time.h + wait3.o: /usr/include/time.h /usr/include/sys/wait.h + wait3.o: /usr/include/sys/resource.h + waitpid.o: waitpid.c /usr/include/sys/types.h /usr/include/sys/time.h + waitpid.o: /usr/include/time.h /usr/include/sys/wait.h + waitpid.o: /usr/include/sys/resource.h # DEPENDENCIES MUST END AT END OF FILE # IF YOU PUT STUFF HERE IT WILL GO AWAY # see make depend above *** /usr/src/lib/libc/pdp/compat-2.9/Makefile.old Fri Aug 10 08:49:07 1990 --- /usr/src/lib/libc/pdp/compat-2.9/Makefile Fri Mar 12 19:09:28 1993 *************** *** 5,12 **** # # @(#)Makefile 5.6 (Berkeley) 1/25/87 # ! SRCS= fetchi.s fperr.s gldav.s l3.c loadav.c lock.s phys.s rtp.s ucall.s ! OBJS= fetchi.o fperr.o gldav.o l3.o loadav.o lock.o phys.o rtp.o ucall.o CFLAGS= -O ${DEFS} TAGSFILE=tags --- 5,12 ---- # # @(#)Makefile 5.7 (2.11BSD GTE) 3/15/93 # ! SRCS= fetchi.s fperr.s gldav.s l3.c loadav.c lock.s phys.s ucall.s ! OBJS= fetchi.o fperr.o gldav.o l3.o loadav.o lock.o phys.o ucall.o CFLAGS= -O ${DEFS} TAGSFILE=tags *************** *** 67,73 **** loadav.o: loadav.c lock.o: lock.s ./SYS.h /usr/include/syscall.h phys.o: phys.s ./SYS.h /usr/include/syscall.h - rtp.o: rtp.s ./SYS.h /usr/include/syscall.h ucall.o: ucall.s ./SYS.h /usr/include/syscall.h # DEPENDENCIES MUST END AT END OF FILE # IF YOU PUT STUFF HERE IT WILL GO AWAY --- 67,72 ---- *** /usr/src/lib/libc/pdp/sys/Makefile.old Fri Apr 6 09:56:38 1990 --- /usr/src/lib/libc/pdp/sys/Makefile Fri Mar 12 19:26:13 1993 *************** *** 21,27 **** setsockopt.s settimeofday.s shutdown.s sigblock.s sigpause.s \ sigreturn.s sigsetmask.s sigstack.s sigvec.s socket.s socketpair.s \ stat.s symlink.s sync.s truncate.s umask.s umount.s unlink.s \ ! utimes.s vfork.s vhangup.s wait.s wait3.s write.s writev.s OBJS= _exit.o accept.o access.o acct.o adjtime.o bind.o brk.o chdir.o \ chmod.o chown.o chroot.o close.o connect.o creat.o dup.o dup2.o \ execl.o execle.o execv.o execve.o fchmod.o fchown.o fcntl.o flock.o \ --- 21,27 ---- setsockopt.s settimeofday.s shutdown.s sigblock.s sigpause.s \ sigreturn.s sigsetmask.s sigstack.s sigvec.s socket.s socketpair.s \ stat.s symlink.s sync.s truncate.s umask.s umount.s unlink.s \ ! utimes.s vfork.s vhangup.s wait4.s write.s writev.s OBJS= _exit.o accept.o access.o acct.o adjtime.o bind.o brk.o chdir.o \ chmod.o chown.o chroot.o close.o connect.o creat.o dup.o dup2.o \ execl.o execle.o execv.o execve.o fchmod.o fchown.o fcntl.o flock.o \ *************** *** 38,44 **** setsockopt.o settimeofday.o shutdown.o sigblock.o sigpause.o \ sigreturn.o sigsetmask.o sigstack.o sigvec.o socket.o socketpair.o \ stat.o symlink.o sync.o truncate.o umask.o umount.o unlink.o \ ! utimes.o vfork.o vhangup.o wait.o wait3.o write.o writev.o CFLAGS= -O ${DEFS} TAGSFILE=tags --- 38,44 ---- setsockopt.o settimeofday.o shutdown.o sigblock.o sigpause.o \ sigreturn.o sigsetmask.o sigstack.o sigvec.o socket.o socketpair.o \ stat.o symlink.o sync.o truncate.o umask.o umount.o unlink.o \ ! utimes.o vfork.o vhangup.o wait4.o write.o writev.o CFLAGS= -O ${DEFS} TAGSFILE=tags *************** *** 202,209 **** utimes.o: utimes.s ./SYS.h /usr/include/syscall.h vfork.o: vfork.s ./SYS.h /usr/include/syscall.h vhangup.o: vhangup.s ./SYS.h /usr/include/syscall.h ! wait.o: wait.s ./SYS.h /usr/include/syscall.h ! wait3.o: wait3.s ./SYS.h /usr/include/syscall.h write.o: write.s ./SYS.h /usr/include/syscall.h writev.o: writev.s ./SYS.h /usr/include/syscall.h # DEPENDENCIES MUST END AT END OF FILE --- 202,208 ---- utimes.o: utimes.s ./SYS.h /usr/include/syscall.h vfork.o: vfork.s ./SYS.h /usr/include/syscall.h vhangup.o: vhangup.s ./SYS.h /usr/include/syscall.h ! wait4.o: wait4.s ./SYS.h /usr/include/syscall.h write.o: write.s ./SYS.h /usr/include/syscall.h writev.o: writev.s ./SYS.h /usr/include/syscall.h # DEPENDENCIES MUST END AT END OF FILE *** /usr/src/lib/libc/pdp/sys/SYS.h.old Thu May 7 00:48:43 1987 --- /usr/src/lib/libc/pdp/sys/SYS.h Sat Mar 13 21:21:43 1993 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)SYS.h 1.3 (Berkeley) 1/7/87 */ #include --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)SYS.h 1.4 (2.11BSD GTE) 3/13/93 */ #include *************** *** 39,63 **** SYS(s); \ EXIT_/**/r ! #define EXIT_norm bes error; \ ! rts pc; \ ! error: \ ! mov r0,_errno; \ ! mov $-1,r0; \ ! rts pc; ! #define EXIT_long bes error; \ ! rts pc; \ ! error: \ mov r0,_errno; \ mov $-1,r1; \ sxt r0; \ ! rts pc; ! #define EXIT_error mov r0,_errno; \ ! mov $-1,r0; \ ! rts pc; #define EXIT_noerror rts pc; --- 39,55 ---- SYS(s); \ EXIT_/**/r + .globl x_norm, x_error ! #define EXIT_norm jmp x_norm ! #define EXIT_long bcc 1f; \ mov r0,_errno; \ mov $-1,r1; \ sxt r0; \ ! 1: rts pc; ! #define EXIT_error jmp x_error #define EXIT_noerror rts pc; *** /usr/src/lib/libc/pdp/sys/_exit.s.old Thu Jan 29 05:52:01 1987 --- /usr/src/lib/libc/pdp/sys/_exit.s Sat Mar 13 21:19:59 1993 *************** *** 5,14 **** */ #ifdef SYSLIBC_SCCS ! _sccsid: <@(#)_exit.s 2.5 (Berkeley) 1/29/87\0> .even #endif SYSLIBC_SCCS #include "SYS.h" ! PSEUDO(_exit,exit,noerror) --- 5,25 ---- */ #ifdef SYSLIBC_SCCS ! _sccsid: <@(#)_exit.s 3.0 (2.11BSD GTE) 3/13/93\0> .even #endif SYSLIBC_SCCS #include "SYS.h" ! ENTRY(_exit) ! SYS(exit) ! /* NOTREACHED */ ! ! .globl x_norm ! .globl x_error ! x_norm: ! bcc 1f ! x_error: ! mov r0,_errno ! mov $-1,r0 ! 1: rts pc