Subject: sigaction(2), sigsetops(3), and more missing in 2.11BSD (#385 - 1 of 4) Index: sys/kern_sig.c,libc/pdp/sys,... 2.11BSD Description: Sigaction(2), sigsetops(3) (sigaddset, sigdelset, ...), sigsuspend(2), sigpending(2), sigprocmask(2), ... are missing from 2.11BSD A couple programs were incorrectly specifying a 16bit mask to sigblock(2). creat(2), gethostid(2), sethostid(2) are system calls which duplicate newer means of accomplishing the same actions. The kernel still had a reference to 'gldav', a system call which was obsoleted a long time ago and which nothing in the system uses. Repeat-By: 1) Attempt to compile and run a program which contains any or all of the following: sigemptyset(&sigt); sigaddset(&sigt, SIGALRM); sigdelset(&sigt, SIGINT); sigaction(SIGALRM, &set, &oset); sigpending(&sigt); sigsuspend(&sigt); sigaltstack(&ss, &oss); less(1), sail(6) and hunt(6) used "sigblock(0)" instead of "sigblock(0L)". "open(name, O_CREAT|O_TRUNC|O_WRONLY, mode)" has been the correct way to create a file for some time now. Sysctl(2) can set and get the hostid. Thus there is no need for 3 extra system calls (creat, sethostid, gethostid). gldav(2) has been gone for a long time - it is time for the last vestiges in the kernel to go away also. 2) Observation. ;) Fix: This is update #385 and is part 1 of 4. Make sure you have parts 2, 3 and 4 (updates 386, 387 and 388) before beginning to install anything. This is a large update. The recommendation is made here (and will be repeated later) to back the system up before installing this update. Existing files are either renamed or deleted, thus there is the outside change of the system being unable to rebuild itself if something goes awry during the update process. Over 60 files are either deleted, added or changed. First a brief summary of what changes are made: The kernel changes are fairly large. A new module is added to the kernel which means that the kernel Makefiles are changed and the overlay layout may require adjustment. The 'u' structure changes (because the 'sigaltstack' structure is a different size than 'sigstack') which means that existing core dumps will likely not be readable by the debugger. Because the 'u' structure changes a small number of applications ('ps', 'adb', and a few others) will have to be recompiled. Changes to libc.a include: 1) creating a compat-43 (4.3BSD compatibility) directory, it contains creat.c (open(2) replacemewnt for the creat syscall), sethostid.c and gethostid.c (replacements for get/set-hostid written using _sysctl(2)) and the new sigcompat.c which implements the 4.3BSD signal routines in terms of the new signal calls (sigaction, sigsuspend, sigprocmask). 2) addition of all the new signal system calls: sigprocmask, sigaction and so on 3) abort(3) is replaced with a new version which uses the new signal calls. In the applications: 1) 'less', 'sail', and 'hunt' now specify signal masks correctly. 2) 'pstat' prints the 'F'lags field in hex rather than octal. Also the 'sigmask' (mask of pending signals) is printed out as a new field at the end of the line in the 'pstat -p' output. 3) 'adb' has been updated with the new system calls and the old 'gldav' removed. In the manpages: 1) New man pages for sigaction, sigaltstack, sigpending, sigprocmask, sigsetops, sigsuspend. 2) Updated manpages: sigpause, sigsetmask, sigstack, sigblock, and sigvec. In the kernel: 1) A new module "kern_sig2.c" is added. This contains all the new signal handling routines. The existing "kern_sig.c" is retained is patched to contain the '4.3 compatibility' code (and a few common routines). At some time in the future most of kern_sig.c may go away. 2) A new include file 'signalvar.h' is added. 3) The modules kern_exec.c, init_systent.c, syscalls.c, kern_sig.c, kern_synch.c, init_main.c, kern_sysctl.c, pdp/machdep.c, pdp/trap.c and pdp/kern_pdp.c are patched to support the new signal semantics. The FP error handling has been greatly simplified (16 bytes of D space were saved at the same time) and made more useful - see pdp/trap.c for more details. 4) Include files modified are: sys/h/signal.h (obviously), user.h, proc.h (serverl obsolete flag bits were removed and one redefined for use with the new signal logic), param.h, pdp/fperr.h (the FP error codes were moved here from signal.h). The complete manifest of files which are changed, removed, updated is below. The extension .RM indicates a file which is removed, .NEW a new file which is being added to the system, and .old a file which is being patched. It is possible that a file can be in more than one category. For example a file which moves from one directory to another and is patched will show up as a ".RM" and a ".old". MANIFEST of changed files: ========================== /usr/include/syscall.h.old /usr/src/sys/conf/Make.sys.old /usr/src/sys/conf/Make.sunix.old /usr/src/sys/conf/Make.nsunix.old /usr/src/sys/conf/Make.unix.old /usr/src/sys/sys/kern_sig2.c.NEW /usr/src/sys/sys/kern_exec.c.old /usr/src/sys/sys/init_sysent.c.old /usr/src/sys/sys/syscalls.c.old /usr/src/sys/sys/kern_sig.c.old /usr/src/sys/sys/kern_synch.c.old /usr/src/sys/sys/init_main.c.old /usr/src/sys/sys/kern_sysctl.c.old /usr/src/sys/h/signalvar.h.NEW /usr/src/sys/h/signal.h.old /usr/src/sys/h/user.h.old /usr/src/sys/h/proc.h.old /usr/src/sys/h/param.h.old /usr/src/sys/pdp/machdep.c.old /usr/src/sys/pdp/trap.c.old /usr/src/sys/pdp/kern_pdp.c.old /usr/src/sys/pdp/fperr.h.old /usr/src/sys/GENERIC/Makefile.old /usr/src/sys/GENERIC/Make.sys.old /usr/src/bin/adb/opset.c.old /usr/src/games/sail/main.c.old /usr/src/games/sail/machdep.h.old /usr/src/games/hunt/driver.c.old /usr/src/lib/libc/gen/siginterrupt.c.NEW /usr/src/lib/libc/gen/signal.c.NEW /usr/src/lib/libc/gen/sigsetops.c.NEW /usr/src/lib/libc/gen/signal.c.RM /usr/src/lib/libc/gen/Makefile.old /usr/src/lib/libc/gen/siginterrupt.c.RM /usr/src/lib/libc/gen/abort.c.RM /usr/src/lib/libc/gen/abort.c.NEW /usr/src/lib/libc/pdp/gen/setjmp.s.old /usr/src/lib/libc/pdp/sys/sigvec.s.RM /usr/src/lib/libc/pdp/sys/sigaction.s.NEW /usr/src/lib/libc/pdp/sys/Makefile.old /usr/src/lib/libc/compat-4.1/pause.c.old /usr/src/lib/libc/Makefile.old /usr/src/lib/libc/compat-43.NEW /usr/src/local/less/signal.c.old /usr/src/man/man2/sigblock.2.old /usr/src/man/man2/Makefile.old /usr/src/man/man2/sigpause.2.old /usr/src/man/man2/sigaction.2.NEW /usr/src/man/man2/sigaltstack.2.NEW /usr/src/man/man2/sigpending.2.NEW /usr/src/man/man2/sigprocmask.2.NEW /usr/src/man/man2/sigsetmask.2.old /usr/src/man/man2/sigvec.2.old /usr/src/man/man2/sigsuspend.2.NEW /usr/src/man/man2/sigstack.2.old /usr/src/man/man3/sigsetops.3.NEW /usr/src/man/man3/Makefile.old /usr/src/new/crash/crashsubs.c.old /usr/src/share/adb/u.old /usr/src/share/lint/llib-lc.old /usr/src/usr.sbin/pstat/pstat.c.old /usr/src/usr.sbin/pstat/pstat.8.old /VERSION.old The update kit consists of 4 parts: Update Part Contents ------ ---- -------- 385 1 This part. Introduction, Manifests, Instructions, helper shell script(s). 386 2 Shar archive of new files added to the system. 387 3 First of two patch files. 388 4 Second of two patch files. At the end of this file is a shell script to be run BEFORE parts 2 thru 4 are used. NOTE: The commands in the script below may be run manually. The 4 files mentioned in it *MUST* either be REMOVED or RENAMED before attempting to unpack the shar archive in part 2. This is because un-sharing the archive will NOT overwrite existing files and the installation process will fail. The script issues 4 'rm' commands. If you would prefer to RENAME ('mv') the files instead of deleting them then you will need to edit the script and comment out the 'rm' and uncomment the 'mv' lines. And now the moment you've been waiting for - the blow by blow directions. NOW is a GOOD time to back up the system if you wish to and have not already done so. MAKE SURE you have all 4 parts (385 thru 388). Ready? Ok - let's proceed. From part 1 (#385) extract the shell script by cutting where indicated and saving to a file (/tmp/385) and running "sh /tmp/385". This will produce the file /tmp/385.sh. NOW IS WHEN you decide if you want to delete the 4 files or rename them. EDIT /tmp/385.sh to suit personal preference BUT MAKE SURE THE 4 FILES are DELETED or RENAMED before proceeding further. All done? Great! The easy part is over ;-) For purposes of the following it is assumed that parts 2,3 and 4 (386, 387 and 388) are present in /tmp. If you are using a different directory then subsitute the appropriate directory. cd /tmp edit 386, 387 and 388 and cut where indicated sh 386 It is a good idea to capture the output of the patch processing so that the output can be carefully studied for failures. Use the 'script program for this: script patch.log patch -p0 < 387 patch -p0 < 388 exit (instead of 'exit' it may be necessary to use control-D (^D) if you are using 'sh' instead of 'csh') INSPECT patch.log for any patches which failed to apply. FIX any failures now - if you don't then it is likely that files will not compile/link successfully later. If there are parts of patches which do not apply cleanly I'd appreciate hearing about it. That wasn't _too_ hard, was it? The next step is to rebuild the kernel. The GENERIC kernel directory is updated by the patches performed above. There are TWO files in EACH kernel directory that need to be updated. In PSEUDO csh syntax: cd /sys foreach K in (EACH_KERNEL_DIRECTORY) cd $K cp ../conf/Make.sys Make.sys edit Makefile and add kern_sig2.o where it will fit end What this means is that for all the kernel directories (EXCEPT the GENERIC one which is already done for you) you need to copy in conf/Make.sys AND update 'Makefile'. The change to 'Makefile' consists of adding 'kern_sig2.c' where it will fit. Kern_sig2.o is 1336 bytes of code so find an overlay which has 1336 bytes left (overlays can be a max of 8192 bytes). If the base segment and all currently used overlays do not have room for kern_sig2.o then use the next available overlay (a max of 15 are supported). The 'size' command is your friend at this stage ;) It is possible that kern_sig2.o can go in the same overlay as kern_sig.o - use 'size' to find out. Now it's time to rebuild the kernel. The new kernel MUST be in place before any of the utilities are rebuilt. The new kernel supports both the new signal calls _and_ the old calls (obviously previous kernels only support the old calls). BE CERTAIN TO perform a "make clean" so that no old objects are accidentally used!! cd /sys/YOUR_KERNEL make clean make Go grab a bier, soda or coffee and come back in about an hour ;) Now the C library is compiled and installed (but no applications are done at this time): cd /usr/src/lib/libc make clean Time for another coffee break - this will take about an hour and a half. make make install Now the system is rebooted with the new kernel: mv /unix /ounix mv /netnix /onetnix mv unix netnix / chmod 744 /netnix /unix (the above assume a networking kernel. If you run a non-networked kernel then omit the 'netnix' from the commands) fastboot It is simpler (but a little more time consuming) to reinstall chapters 2 and 3 of the man pages than to format individual pages and create the necessary links: cd /usr/src/man/man2 make clean make make install cd /usr/src/man/man3 make clean make make install There is a small number of applications which access kernel data structures and thus must be recompiled: cd /usr/src/bin rm ps make ps install -s -m 2755 -g kmem ps /bin cd adb make clean make make install cd /usr/src/usr.sbin/pstat make clean make make install cd /usr/src/libexec/identd make clean make make install cd /usr/src/ucb rm w gcore make gcore w install -s -m 2755 -g kmem w gcore /usr/ucb rm /usr/ucb/uptime ln /usr/ucb/w /usr/ucb/uptime cd /usr/src/usr.bin/fstat make clean make make install Three other applications had fixes applied: cd /usr/src/games/sail make clean make make install cd /usr/src/games/hunt make clean make make install cd /usr/src/local/less make clean make make install One last item - the lint libraries need to be rebuilt to incorporate the latest changes: cd /usr/src/share/lint make install cd /usr/src/usr.bin/lint ./libs Optional: A bit of cleanup might be a good idea now. The following will clean up the debris left from compiling the libraries, man- pages, and the various utilities: cd /usr/src/ make clean At this time you may wish to recompile and install the GENERIC kernel (typically kept in /genunix): cd /sys/GENERIC make clean make install -m 744 unix /genunix All done. Enjoy! To take full advantage of the new routines (the new signal.c module in libc.a is about 188 bytes of D space smaller than the old) you may want to rebuild the entire system from sources. This takes between 21 and 25 hours on an 11/73 with fast disks. Until the entire system is rebuilt only those programs compiled above or those you compile after rebooting the new kernel will take advantage of the new signal handling - existing binaries will use the compatibility routines in the kernel. As always this and previous updates to 2.11BSD are available via anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the directory /pub/2.11BSD. ===========================cut here======================== #!/bin/sh # This is a shell archive (produced by GNU sharutils 4.2). # To extract the files from this archive, save it to some FILE, remove # everything before the `!/bin/sh' line above, then type `sh FILE'. # # Made on 1997-09-14 17:31 PDT by . # Source directory was `/users/sms/KIT'. # # Existing files will *not* be overwritten unless `-c' is specified. # This format requires very little intelligence at unshar time. # "if test", "echo", "mkdir", and "sed" may be needed. # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 458 -rwxr-x--x /tmp/385.sh # echo=echo if mkdir _sh18869; then $echo 'x -' 'creating lock directory' else $echo 'failed to create lock directory' exit 1 fi # ============= /tmp/385.sh ============== if test ! -d '/tmp'; then $echo 'x -' 'creating directory' '/tmp' mkdir '/tmp' fi if test -f '/tmp/385.sh' && test "$first_param" != -c; then $echo 'x -' SKIPPING '/tmp/385.sh' '(file already exists)' else $echo 'x -' extracting '/tmp/385.sh' '(text)' sed 's/^X//' << 'SHAR_EOF' > '/tmp/385.sh' && X#!/bin/sh -x X Xrm /usr/src/lib/libc/gen/signal.c Xrm /usr/src/lib/libc/gen/siginterrupt.c Xrm /usr/src/lib/libc/gen/abort.c Xrm /usr/src/lib/libc/pdp/sys/sigvec.s X X#mv /usr/src/lib/libc/gen/signal.c /usr/src/lib/libc/gen/signal.c.old X#mv /usr/src/lib/libc/gen/siginterrupt.c /usr/src/lib/libc/gen/siginterrupt.c.old X#mv /usr/src/lib/libc/gen/abort.c /usr/src/lib/libc/gen/abort.c.old X#mv /usr/src/lib/libc/pdp/sys/sigvec.s /usr/src/lib/libc/pdp/sys/sigvec.s.old SHAR_EOF : || $echo 'restore of' '/tmp/385.sh' 'failed' fi rm -fr _sh18869 exit 0