Subject: man(1) fails to compile, sig* compat use in libc, more (#430) Index: src/ucb/man/man.c,others 2.11BSD Description: During the biannual recompile of the system from sources it was noticed that: 1) man(1) contained a lingering reference to MACHINE. That #define no longer exists because the machine type is now determined at runtime rather than compile time. 2) libc used the signal compatibility routines internally. Repeat-By: 1) cd /usr/src/ucb/man make 2) Observation. The file /usr/src/lib/libc/gen/popen.c is one example. Fix: As usual this update started out with just the fix to 'man.c' but quickly grew to encompass additional changes. While 'libc' needs to _provide_ the compatiblity routines such as 'sigblock' it should not _use_ them itself. This is more to avoid overhead than anything else. Programs will work but more slowly than need be. Also, new programs which use libc (and most programs do ;)) *and* the new system calls will end up being larger than necessary due to inclusion of both the new functions and the old compatibility code. A good portion of this update is aimed at cleaning up 'libc'. A few more applications were also updated to use the new syscalls that have been added over the past year or two. These include 'ar', 'mail' for example and a couple games. And now for a Christmas present :) After applying this update PLEASE recompile the entire system from sources! Beginning in 2000 the process of removing (or at least reducing the amountof ) 4.2/4.3BSD compatibility code from the kernel will begin. Over time the kernel has acquired quite a bit of code aimed at keeping older binaries running. On machines with large address spaces this is not a problem but on a 16 bit machine there comes a time when at least some compatibility has be removed to make room for new features. On a 11/73 using a SCSI adaptor and a 1gb HP disk it took about 24 hours to recompile the entire system from sources. This was about 4 hours better than the last time this was done because a couple mount options were used on /usr before starting the 'make'. If the system is on an UPS you can safely use the 'async' option to mount - this greatly reduces the amount of I/O the system does to update directories as files are created/removed. The other option which is completely safe to use is "noaccesstime". If you do not care to have the last accessed time set on each source file as it is compiled (and when was the last time you looked at the 'access' time anyhow? ;-)) use the "noaccesstime". Not updating the accesstimes on all the files that are read (and the .h files are read repeatedly) saves quite a bit of I/O time. The following files are updated by this kit: /usr/src/ucb/man/man.c /usr/src/lib/libc/gen/popen.c /usr/src/lib/libc/gen/system.c /usr/src/lib/libc/net/rcmd.c /usr/src/usr.lib/libI77/f77_abort.c /usr/src/usr.lib/libI77/fio.h /usr/src/usr.lib/libcurses/Makefile /usr/src/usr.lib/libcurses/tstp.c /usr/src/usr.sbin/dev_mkdb/dev_mkdb.c /usr/src/usr.sbin/update/update.c /usr/src/bin/ar/misc.c /usr/src/bin/disklabel/disklabel.c /usr/src/bin/mail.c /usr/src/libexec/ftpd/popen.c /usr/src/games/atc/Makefile /usr/src/games/atc/update.c /usr/src/games/battlestar/com6.c /usr/src/games/warp/sig.c /VERSION To apply this update cut where indicated and save to a file (/tmp/430) and then: patch -p0 < /tmp/430 Next: mount -u -o noaccesstime,async /usr or mount -u -o noaccesstime /usr Use the first if you trust your power supplier or feel lucky otherwise use the second form. Then: cd /usr/src make clean It is OK to ^C the next part if you need to do the rebuild over multiple days - it will take 10 or 15 minutes to march thru the parts that have already been done but it should work. I did it in two steps, about 2/3 on the first day and the remaining part on the second day. make build >& /usr/tmp/log The top level Makefile (/usr/src/Makefile) contains a good description of the build process. You can monitor the progress with "tail -f /usr/tmp/log". EXAMINE the log file (/usr/tmp/log) before running the next step. You should see no failures! "grep Error /usr/tmp/log" and "grep Exit /usr/tmp/log" should not show any errors (lines which contain 'warning' or 'ignored' are fine - those are conditions the Makefiles expected). If you see any "not remade" or similar errors investigate before performing the install step. make installsrc Then reboot the system. And finally clean up: cd /usr/src make clean Merry Christmas and a Happy New Year! As always this and previous updates to 2.11BSD are available via anonymous FTP to either FTP.TO.GD-ES.COM or MOE.2BSD.COM in the directory /pub/2.11BSD. ------------------------------cut here---------------------------- *** /usr/src/ucb/man/man.c.old Mon Dec 26 15:34:32 1988 --- /usr/src/ucb/man/man.c Fri Nov 26 11:54:46 1999 *************** *** 15,35 **** * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ ! #ifndef lint char copyright[] = "@(#) Copyright (c) 1987 Regents of the University of California.\n\ All rights reserved.\n"; ! #endif /* not lint */ #ifndef lint ! static char sccsid[] = "@(#)man.c 5.17 (Berkeley) 6/29/88"; #endif /* not lint */ #include #include #include #include #include #define DEF_PAGER "/usr/ucb/more -s" #define DEF_PATH "/usr/man:/usr/new/man:/usr/local/man" --- 15,37 ---- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ ! #if !defined(lint) && defined(DOSCCS) char copyright[] = "@(#) Copyright (c) 1987 Regents of the University of California.\n\ All rights reserved.\n"; ! #endif #ifndef lint ! static char sccsid[] = "@(#)man.c 5.17.1 (2.11BSD) 1999/11/26"; #endif /* not lint */ #include #include #include + #include #include #include + #include #define DEF_PAGER "/usr/ucb/more -s" #define DEF_PATH "/usr/man:/usr/new/man:/usr/local/man" *************** *** 130,136 **** else pager = DEF_PAGER; if (!(machine = getenv("MACHINE"))) ! machine = MACHINE; if (!defpath && !(defpath = getenv("MANPATH"))) defpath = DEF_PATH; locpath = LOCAL_PATH; --- 132,138 ---- else pager = DEF_PAGER; if (!(machine = getenv("MACHINE"))) ! setmachine(); if (!defpath && !(defpath = getenv("MANPATH"))) defpath = DEF_PATH; locpath = LOCAL_PATH; *************** *** 428,433 **** --- 430,448 ---- fprintf(stderr, "%s: Command not found.\n", name); exit(1); } + + /* + * This is done in a function by itself because 'uname()' uses a 640 + * structure which we do not want permanently allocated on main()'s stack. + */ + setmachine() + { + struct utsname foo; + + if (uname(&foo) < 0) + strcpy(foo.machine, "?"); + machine = strdup(foo.machine); + } /* * usage -- *** /usr/src/lib/libc/gen/popen.c.old Sat Mar 13 01:37:54 1993 --- /usr/src/lib/libc/gen/popen.c Sun Oct 24 09:33:49 1999 *************** *** 35,41 **** */ #if defined(LIBC_SCCS) && !defined(lint) ! static char sccsid[] = "@(#)popen.c 5.15 (Berkeley) 2/23/91"; #endif /* LIBC_SCCS and not lint */ #include --- 35,41 ---- */ #if defined(LIBC_SCCS) && !defined(lint) ! static char sccsid[] = "@(#)popen.c 5.15.1 (2.11BSD) 1999/10/24"; #endif /* LIBC_SCCS and not lint */ #include *************** *** 45,51 **** #include static int *pids; - extern int errno; FILE * popen(program, type) --- 45,50 ---- *************** *** 108,114 **** FILE *iop; { register int fdes; ! long omask; union wait pstat; register int pid; --- 107,113 ---- FILE *iop; { register int fdes; ! sigset_t omask, nmask; union wait pstat; register int pid; *************** *** 120,130 **** if (pids == NULL || pids[fdes = fileno(iop)] == 0) return (-1); (void) fclose(iop); ! omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP)); do { pid = waitpid(pids[fdes], (int *) &pstat, 0); } while (pid == -1 && errno == EINTR); ! (void) sigsetmask(omask); pids[fdes] = 0; return (pid == -1 ? -1 : pstat.w_status); } --- 119,133 ---- if (pids == NULL || pids[fdes = fileno(iop)] == 0) return (-1); (void) fclose(iop); ! sigemptyset(&nmask); ! sigaddset(&nmask, SIGINT); ! sigaddset(&nmask, SIGQUIT); ! sigaddset(&nmask, SIGHUP); ! (void) sigprocmask(SIG_BLOCK, &nmask, &omask); do { pid = waitpid(pids[fdes], (int *) &pstat, 0); } while (pid == -1 && errno == EINTR); ! (void) sigprocmask(SIG_SETMASK, &omask, NULL); pids[fdes] = 0; return (pid == -1 ? -1 : pstat.w_status); } *** /usr/src/lib/libc/gen/system.c.old Sat Mar 13 01:40:41 1993 --- /usr/src/lib/libc/gen/system.c Sun Oct 24 09:34:07 1999 *************** *** 32,38 **** */ #if defined(LIBC_SCCS) && !defined(lint) ! static char sccsid[] = "@(#)system.c 5.10 (Berkeley) 2/23/91"; #endif /* LIBC_SCCS and not lint */ #include --- 32,38 ---- */ #if defined(LIBC_SCCS) && !defined(lint) ! static char sccsid[] = "@(#)system.c 5.10.1 (2.11BSD) 1999/10/24"; #endif /* LIBC_SCCS and not lint */ #include *************** *** 45,65 **** { union wait pstat; register int pid; ! long omask; int (*intsave)(), (*quitsave)(); if (!command) /* just checking... */ return(1); ! omask = sigblock(sigmask(SIGCHLD)); switch(pid = vfork()) { case -1: /* error */ ! (void)sigsetmask(omask); pstat.w_status = 0; pstat.w_retcode = 127; return(pstat.w_status); case 0: /* child */ ! (void)sigsetmask(omask); execl("/bin/sh", "sh", "-c", command, (char *)NULL); _exit(127); } --- 45,67 ---- { union wait pstat; register int pid; ! sigset_t omask, nmask; int (*intsave)(), (*quitsave)(); if (!command) /* just checking... */ return(1); ! sigemptyset(&nmask); ! sigaddset(&nmask, SIGCHLD); ! (void)sigprocmask(SIG_BLOCK, &nmask, &omask); switch(pid = vfork()) { case -1: /* error */ ! (void)sigprocmask(SIG_SETMASK, &omask, NULL); pstat.w_status = 0; pstat.w_retcode = 127; return(pstat.w_status); case 0: /* child */ ! (void)sigprocmask(SIG_SETMASK, &omask, NULL); execl("/bin/sh", "sh", "-c", command, (char *)NULL); _exit(127); } *************** *** 66,72 **** intsave = signal(SIGINT, SIG_IGN); quitsave = signal(SIGQUIT, SIG_IGN); pid = waitpid(pid, (int *)&pstat, 0); ! (void)sigsetmask(omask); (void)signal(SIGINT, intsave); (void)signal(SIGQUIT, quitsave); return(pid == -1 ? -1 : pstat.w_status); --- 68,74 ---- intsave = signal(SIGINT, SIG_IGN); quitsave = signal(SIGQUIT, SIG_IGN); pid = waitpid(pid, (int *)&pstat, 0); ! (void)sigprocmask(SIG_SETMASK, &omask, NULL); (void)signal(SIGINT, intsave); (void)signal(SIGQUIT, quitsave); return(pid == -1 ? -1 : pstat.w_status); *** /usr/src/lib/libc/net/rcmd.c.old Tue Sep 19 09:56:47 1989 --- /usr/src/lib/libc/net/rcmd.c Sun Oct 24 09:59:59 1999 *************** *** 16,27 **** */ #if defined(LIBC_SCCS) && !defined(lint) ! static char sccsid[] = "@(#)rcmd.c 5.20 (Berkeley) 1/24/89"; #endif /* LIBC_SCCS and not lint */ #include #include #include #include #include #include --- 16,28 ---- */ #if defined(LIBC_SCCS) && !defined(lint) ! static char sccsid[] = "@(#)rcmd.c 5.20.1 (2.11BSD) 1999/10/24"; #endif /* LIBC_SCCS and not lint */ #include #include #include + #include #include #include #include *************** *** 33,41 **** #include #include - extern errno; - char *index(); - rcmd(ahost, rport, locuser, remuser, cmd, fd2p) char **ahost; u_short rport; --- 34,39 ---- *************** *** 43,49 **** int *fd2p; { int s, timo = 1, pid; ! long oldmask; struct sockaddr_in sin, sin2, from; char c; int lport = IPPORT_RESERVED - 1; --- 41,47 ---- int *fd2p; { int s, timo = 1, pid; ! sigset_t oldmask, nmask; struct sockaddr_in sin, sin2, from; char c; int lport = IPPORT_RESERVED - 1; *************** *** 57,63 **** return (-1); } *ahost = hp->h_name; ! oldmask = sigblock(sigmask(SIGURG)); for (;;) { s = rresvport(&lport); if (s < 0) { --- 55,64 ---- return (-1); } *ahost = hp->h_name; ! sigemptyset(&nmask); ! sigaddset(&nmask, SIGURG); ! (void)sigprocmask(SIG_BLOCK, &nmask, &oldmask); ! for (;;) { s = rresvport(&lport); if (s < 0) { *************** *** 65,71 **** fprintf(stderr, "socket: All ports in use\n"); else perror("rcmd: socket"); ! sigsetmask(oldmask); return (-1); } fcntl(s, F_SETOWN, pid); --- 66,72 ---- fprintf(stderr, "socket: All ports in use\n"); else perror("rcmd: socket"); ! sigprocmask(SIG_SETMASK, &oldmask, NULL); return (-1); } fcntl(s, F_SETOWN, pid); *************** *** 99,105 **** continue; } perror(hp->h_name); ! sigsetmask(oldmask); return (-1); } lport--; --- 100,106 ---- continue; } perror(hp->h_name); ! sigprocmask(SIG_SETMASK, &oldmask, NULL); return (-1); } lport--; *************** *** 166,172 **** } goto bad2; } ! sigsetmask(oldmask); return (s); bad2: if (lport) --- 167,173 ---- } goto bad2; } ! sigprocmask(SIG_SETMASK, &oldmask, NULL); return (s); bad2: if (lport) *************** *** 173,179 **** (void) close(*fd2p); bad: (void) close(s); ! sigsetmask(oldmask); return (-1); } --- 174,180 ---- (void) close(*fd2p); bad: (void) close(s); ! sigprocmask(SIG_SETMASK, &oldmask, NULL); return (-1); } *** /usr/src/usr.lib/libI77/f77_abort.c.old Sun Dec 25 23:47:10 1988 --- /usr/src/usr.lib/libI77/f77_abort.c Sun Oct 24 11:32:50 1999 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)f77_abort.c 5.2 7/12/85 * * all f77 aborts eventually call f77_abort. * f77_abort cleans up open files and terminates with a dump if needed, --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)f77_abort.c 5.2.1 (2.11BSD) 1999/10/24 * * all f77 aborts eventually call f77_abort. * f77_abort cleans up open files and terminates with a dump if needed, *************** *** 14,20 **** #include #include "fio.h" - extern int errno; #ifndef pdp11 char *getenv(); int _lg_flag; /* _lg_flag is non-zero if -lg was specified to ld */ --- 14,19 ---- *************** *** 23,28 **** --- 22,28 ---- f77_abort( nargs, err_val, act_core ) { int core_dump; + sigset_t set; #ifndef pdp11 /* * The f77_dump_flag is really unnecessary to begin with and not *************** *** 35,41 **** #endif signal(SIGILL, SIG_DFL); ! sigsetmask(0L); /* don't block */ #ifdef pdp11 /* --- 35,43 ---- #endif signal(SIGILL, SIG_DFL); ! (void)sigemptyset(&set); ! (void)sigaddset(&set, SIGILL); ! (void)sigprocmask(SIG_UNBLOCK, &set, NULL); /* don't block */ #ifdef pdp11 /* *** /usr/src/usr.lib/libI77/fio.h.old Wed Feb 18 01:09:41 1987 --- /usr/src/usr.lib/libI77/fio.h Sun Oct 24 11:35:30 1999 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)fio.h 5.1 (Berkeley) 6/7/85 */ /* --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)fio.h 5.1.1 (2.11BSD) 1999/10/24 */ /* *************** *** 22,30 **** #define MAXINTLENGTH 32 /* to accomodate binary format */ - long ftell(); - - extern int errno; extern ioflag init; extern flag reading,external,sequential,formatted; extern int (*getn)(),(*putn)(),(*ungetn)(); /*for formatted io*/ --- 22,27 ---- *** /usr/src/usr.lib/libcurses/Makefile.old Sun Jan 2 00:30:50 1994 --- /usr/src/usr.lib/libcurses/Makefile Sun Oct 24 11:26:51 1999 *************** *** 2,8 **** # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.2 (2.11BSD GTE) 1/2/94 # # curses package # --- 2,8 ---- # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.2.1 (2.11BSD) 1999/10/24 # # curses package # *************** *** 25,31 **** TAGSFILE=tags .c.o: ! ${CC} -c -pg ${CFLAGS} $*.c ld -x -r $*.o mv a.out profiled/$*.o ${CC} -c ${CFLAGS} $*.c --- 25,31 ---- TAGSFILE=tags .c.o: ! ${CC} -c -p ${CFLAGS} $*.c ld -x -r $*.o mv a.out profiled/$*.o ${CC} -c ${CFLAGS} $*.c *** /usr/src/usr.lib/libcurses/tstp.c.old Sat Jul 25 16:10:00 1987 --- /usr/src/usr.lib/libcurses/tstp.c Sun Oct 24 11:26:17 1999 *************** *** 5,44 **** */ #if !defined(lint) && !defined(NOSCCS) ! static char sccsid[] = "@(#)tstp.c 5.1 (Berkeley) 6/7/85"; #endif ! # include - # include "curses.ext" - /* * handle stop and start signals - * - * @(#)tstp.c 5.1 (Berkeley) 6/7/85 */ tstp() { - - # ifdef SIGTSTP - SGTTY tty; ! long omask; ! # ifdef DEBUG if (outf) fflush(outf); ! # endif tty = _tty; mvcur(0, COLS - 1, LINES - 1, 0); endwin(); fflush(stdout); ! /* reset signal handler so kill below stops us */ signal(SIGTSTP, SIG_DFL); - omask = sigsetmask(sigblock(0L) &~ sigmask(SIGTSTP)); kill(0, SIGTSTP); ! sigblock(sigmask(SIGTSTP)); signal(SIGTSTP, tstp); _tty = tty; stty(_tty_ch, &_tty); wrefresh(curscr); ! # endif SIGTSTP } --- 5,60 ---- */ #if !defined(lint) && !defined(NOSCCS) ! static char sccsid[] = "@(#)tstp.c 5.1.1 (2.11BSD) 1999/10/24"; #endif ! #include ! #include "curses.ext" /* * handle stop and start signals */ tstp() { SGTTY tty; ! sigset_t oset, set; ! #ifdef DEBUG if (outf) fflush(outf); ! #endif ! /* ! * Block window change and timer signals. The latter is because ! * applications use timers to decide when to repaint the screen. ! */ ! (void)sigemptyset(&set); ! (void)sigaddset(&set, SIGALRM); ! (void)sigaddset(&set, SIGWINCH); ! (void)sigprocmask(SIG_BLOCK, &set, &oset); ! tty = _tty; mvcur(0, COLS - 1, LINES - 1, 0); endwin(); fflush(stdout); ! ! /* Unblock SIGTSTP. */ ! (void)sigemptyset(&set); ! (void)sigaddset(&set, SIGTSTP); ! (void)sigprocmask(SIG_UNBLOCK, &set, NULL); ! ! /* Stop ourselves. */ signal(SIGTSTP, SIG_DFL); kill(0, SIGTSTP); ! ! /* Time passes ... */ ! ! /* Reset the SIGTSTP handler. */ signal(SIGTSTP, tstp); + _tty = tty; stty(_tty_ch, &_tty); + + /* Repaint the screen. */ wrefresh(curscr); ! ! /* Reset the signals. */ ! (void)sigprocmask(SIG_SETMASK, &oset, NULL); } *** /usr/src/usr.sbin/dev_mkdb/dev_mkdb.c.old Fri Feb 3 22:39:16 1995 --- /usr/src/usr.sbin/dev_mkdb/dev_mkdb.c Sun Oct 24 12:22:14 1999 *************** *** 36,44 **** "@(#) Copyright (c) 1990, 1993\n\ The Regents of the University of California. All rights reserved.\n"; ! static char sccsid[] = "@(#)dev_mkdb.c 8.1.1 (2.11BSD GTE) 2/3/95"; #endif #include #include #include --- 36,45 ---- "@(#) Copyright (c) 1990, 1993\n\ The Regents of the University of California. All rights reserved.\n"; ! static char sccsid[] = "@(#)dev_mkdb.c 8.1.2 (2.11BSD) 1999/10/24"; #endif + #include #include #include #include *************** *** 47,53 **** #include #include - extern int optind; extern void err(); void usage(); --- 48,53 ---- *************** *** 56,61 **** --- 56,62 ---- int argc; char *argv[]; { + sigset_t set; register DIR *dirp; register struct direct *dp; struct stat sb; *************** *** 131,137 **** } (void)dbm_close(db); ! sigsetmask(~0L); sprintf(dbname, "%sdev.pag", varrun); sprintf(dbtmp, "%sdev.tmp.pag", varrun); if (rename(dbtmp, dbname)) --- 132,140 ---- } (void)dbm_close(db); ! (void)sigfillset(&set); ! (void)sigprocmask(SIG_BLOCK, &set, NULL); ! sprintf(dbname, "%sdev.pag", varrun); sprintf(dbtmp, "%sdev.tmp.pag", varrun); if (rename(dbtmp, dbname)) *** /usr/src/usr.sbin/update/update.c.old Sat May 6 23:47:22 1995 --- /usr/src/usr.sbin/update/update.c Sun Oct 24 11:54:22 1999 *************** *** 36,42 **** "@(#) Copyright (c) 1987, 1990, 1993\n\ The Regents of the University of California. All rights reserved.\n"; ! static char sccsid[] = "@(#)update.c 8.1 (Berkeley) 6/6/93"; #endif #include --- 36,42 ---- "@(#) Copyright (c) 1987, 1990, 1993\n\ The Regents of the University of California. All rights reserved.\n"; ! static char sccsid[] = "@(#)update.c 8.1.1 (2.11BSD) 1999/10/24"; #endif #include *************** *** 46,51 **** --- 46,52 ---- main() { struct itimerval value; + sigset_t set; void mysync(); daemon(0, 0); *************** *** 59,66 **** perror("update: setitimer"); exit(1); } for (;;) ! sigpause(sigblock(0L)); /* NOTREACHED */ } --- 60,69 ---- perror("update: setitimer"); exit(1); } + + (void)sigemptyset(&set); for (;;) ! sigsuspend(&set); /* NOTREACHED */ } *** /usr/src/bin/ar/misc.c.old Fri Sep 24 21:06:09 1993 --- /usr/src/bin/ar/misc.c Mon Oct 25 20:33:27 1999 *************** *** 35,41 **** */ #if defined(DOSCCS) && !defined(lint) ! static char sccsid[] = "@(#)misc.c 5.7 (Berkeley) 5/27/91"; #endif #include --- 35,41 ---- */ #if defined(DOSCCS) && !defined(lint) ! static char sccsid[] = "@(#)misc.c 5.7.1 (2.11BSD) 1999/10/25"; #endif #include *************** *** 48,54 **** #include "extern.h" #include "pathnames.h" - extern int errno; extern CHDR chdr; /* converted header */ extern char *archive; /* archive name */ char *tname = "temporary file"; /* temporary file "name" */ --- 48,53 ---- *************** *** 56,62 **** tmp() { extern char *envtmp; ! long oset; static int first; int fd; char path[MAXPATHLEN]; --- 55,61 ---- tmp() { extern char *envtmp; ! sigset_t set, oset; static int first; int fd; char path[MAXPATHLEN]; *************** *** 71,81 **** else bcopy(_PATH_ARTMP, path, sizeof(_PATH_ARTMP)); ! oset = sigsetmask(~0L); if ((fd = mkstemp(path)) == -1) error(tname); (void)unlink(path); ! (void)sigsetmask(oset); return(fd); } --- 70,81 ---- else bcopy(_PATH_ARTMP, path, sizeof(_PATH_ARTMP)); ! sigfillset(&set); ! (void)sigprocmask(SIG_BLOCK, &set, &oset); if ((fd = mkstemp(path)) == -1) error(tname); (void)unlink(path); ! (void)sigprocmask(SIG_SETMASK, &oset, NULL); return(fd); } *** /usr/src/bin/disklabel/disklabel.c.old Mon Jul 10 22:09:56 1995 --- /usr/src/bin/disklabel/disklabel.c Mon Oct 25 20:46:37 1999 *************** *** 39,45 **** "@(#) Copyright (c) 1987, 1993\n\ The Regents of the University of California. All rights reserved.\n"; ! static char sccsid[] = "@(#)disklabel.c 8.1.2 (2.11BSD) 1995/07/10"; /* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */ #endif --- 39,45 ---- "@(#) Copyright (c) 1987, 1993\n\ The Regents of the University of California. All rights reserved.\n"; ! static char sccsid[] = "@(#)disklabel.c 8.1.3 (2.11BSD) 1999/10/25"; /* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */ #endif *************** *** 53,58 **** --- 53,59 ---- #include #include #include + #include #include #include #include "pathnames.h" *************** *** 87,95 **** char *specname; char tmpfil[] = _PATH_TMP; - extern int errno; - extern long atol(); - char namebuf[256], *np = namebuf; struct disklabel lab; struct disklabel *readlabel(), *makebootarea(); --- 88,93 ---- *************** *** 112,124 **** #define OPTIONS "BNRWb:erw" #endif - main(argc, argv) int argc; char *argv[]; { - extern char *optarg; - extern int optind; register struct disklabel *lp; FILE *t; int ch, f, flag, error = 0; --- 110,119 ---- *************** *** 669,680 **** { register int pid, xpid; int stat; ! long omask; ! extern char *getenv(); ! omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP)); while ((pid = fork()) < 0) { - extern int errno; if (errno == EPROCLIM) { fprintf(stderr, "You have too many processes\n"); --- 664,677 ---- { register int pid, xpid; int stat; ! sigset_t set, oset; ! sigemptyset(&set); ! sigaddset(&set, SIGINT); ! sigaddset(&set, SIGHUP); ! sigaddset(&set, SIGQUIT); ! (void)sigprocmask(SIG_BLOCK, &set, &oset); while ((pid = fork()) < 0) { if (errno == EPROCLIM) { fprintf(stderr, "You have too many processes\n"); *************** *** 689,695 **** if (pid == 0) { register char *ed; ! sigsetmask(omask); setgid(getgid()); setuid(getuid()); if ((ed = getenv("EDITOR")) == (char *)0) --- 686,692 ---- if (pid == 0) { register char *ed; ! (void)sigprocmask(SIG_SETMASK, &oset, NULL); setgid(getgid()); setuid(getuid()); if ((ed = getenv("EDITOR")) == (char *)0) *************** *** 701,707 **** while ((xpid = wait(&stat)) >= 0) if (xpid == pid) break; ! sigsetmask(omask); return(!stat); } --- 698,704 ---- while ((xpid = wait(&stat)) >= 0) if (xpid == pid) break; ! (void)sigprocmask(SIG_SETMASK, &oset, NULL); return(!stat); } *** /usr/src/bin/mail.c.old Thu Dec 31 12:45:58 1998 --- /usr/src/bin/mail.c Mon Oct 25 20:24:32 1999 *************** *** 1,5 **** #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)mail.c 4.33.5 (2.11BSD) 1998/12/31"; #endif #include --- 1,5 ---- #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)mail.c 4.33.6 (2.11BSD) 1999/10/25"; #endif #include *************** *** 294,304 **** copyback() { register int i, c; ! long oldmask; int fd, new = 0; struct stat stbuf; ! oldmask = sigblock(sigmask(SIGINT)|sigmask(SIGHUP)|sigmask(SIGQUIT)); fd = open(mailfile, O_RDWR | O_CREAT, MAILMODE); if (fd >= 0) { flock(fd, LOCK_EX); --- 294,308 ---- copyback() { register int i, c; ! sigset_t set; int fd, new = 0; struct stat stbuf; ! sigemptyset(&set); ! sigaddset(&set, SIGINT); ! sigaddset(&set, SIGHUP); ! sigaddset(&set, SIGQUIT); ! (void)sigprocmask(SIG_BLOCK, &set, NULL); fd = open(mailfile, O_RDWR | O_CREAT, MAILMODE); if (fd >= 0) { flock(fd, LOCK_EX); *************** *** 323,329 **** fclose(malf); /* implict unlock */ if (new) printf("New mail has arrived.\n"); ! sigsetmask(oldmask); } /* copy mail (f1) to temp (f2) */ --- 327,333 ---- fclose(malf); /* implict unlock */ if (new) printf("New mail has arrived.\n"); ! (void)sigprocmask(SIG_UNBLOCK, &set, NULL); } /* copy mail (f1) to temp (f2) */ *** /usr/src/libexec/ftpd/popen.c.old Thu Nov 16 16:17:13 1989 --- /usr/src/libexec/ftpd/popen.c Mon Oct 25 20:13:56 1999 *************** *** 19,32 **** * */ ! #ifndef lint ! static char sccsid[] = "@(#)popen.c 5.7 (Berkeley) 2/14/89"; ! #endif /* not lint */ #include #include #include #include /* * Special version of popen which avoids call to shell. This insures noone --- 19,33 ---- * */ ! #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)popen.c 5.7.1 (2.11BSD) 1999/10/25"; ! #endif #include #include #include #include + #include /* * Special version of popen which avoids call to shell. This insures noone *************** *** 44,50 **** FILE *iop; int argc, gargc, pdes[2], pid; char **pop, *argv[100], *gargv[1000], *vv[2], **ppop, *endprogram; ! extern char **glob(), **copyblk(), *strtok(), *malloc(); if (*type != 'r' && *type != 'w' || type[1]) return(NULL); --- 45,51 ---- FILE *iop; int argc, gargc, pdes[2], pid; char **pop, *argv[100], *gargv[1000], *vv[2], **ppop, *endprogram; ! extern char **glob(), **copyblk(), *malloc(); if (*type != 'r' && *type != 'w' || type[1]) return(NULL); *************** *** 132,138 **** FILE *iop; { register int fdes; ! long omask; union wait stat_loc; int pid; --- 133,139 ---- FILE *iop; { register int fdes; ! sigset_t set; union wait stat_loc; int pid; *************** *** 143,151 **** if (pids == 0 || pids[fdes = fileno(iop)] == 0) return(-1); (void)fclose(iop); ! omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP)); while ((pid = wait(&stat_loc)) != pids[fdes] && pid != -1); ! (void)sigsetmask(omask); pids[fdes] = 0; return(pid == -1 ? -1 : stat_loc.w_status); } --- 144,156 ---- if (pids == 0 || pids[fdes = fileno(iop)] == 0) return(-1); (void)fclose(iop); ! sigemptyset(&set); ! sigaddset(&set, SIGINT); ! sigaddset(&set, SIGQUIT); ! sigaddset(&set, SIGHUP); ! (void)sigprocmask(SIG_BLOCK, &set, NULL); while ((pid = wait(&stat_loc)) != pids[fdes] && pid != -1); ! (void)sigprocmask(SIG_UNBLOCK, &set, NULL); pids[fdes] = 0; return(pid == -1 ? -1 : stat_loc.w_status); } *** /usr/src/games/atc/Makefile.old Sun Dec 1 14:47:04 1996 --- /usr/src/games/atc/Makefile Mon Oct 25 21:44:53 1999 *************** *** 3,13 **** # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.1.1 (2.11BSD) 1996/12/1 # DESTDIR= CFLAGS= -O -DBSD -DDEST=\"${DESTDIR}/usr/games/lib/atc/\" YFLAGS= -d LIBS= -ll -lm -lcurses -ltermcap SRCS= extern.c grammar.c graphics.c input.c lex.c list.c log.c \ --- 3,14 ---- # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.1.2 (2.11BSD) 1999/10/25 # DESTDIR= CFLAGS= -O -DBSD -DDEST=\"${DESTDIR}/usr/games/lib/atc/\" + SEPFLAG= -i YFLAGS= -d LIBS= -ll -lm -lcurses -ltermcap SRCS= extern.c grammar.c graphics.c input.c lex.c list.c log.c \ *************** *** 18,24 **** all: atc atc: ${OBJS} ! ${CC} ${CFLAGS} ${OBJS} ${LIBS} -o $@ clean: FRC rm -f ${OBJS} core atc grammar.c y.tab.h y.tab.c lex.yy.c lex.c --- 19,25 ---- all: atc atc: ${OBJS} ! ${CC} ${SEPFLAG} ${OBJS} ${LIBS} -o $@ clean: FRC rm -f ${OBJS} core atc grammar.c y.tab.h y.tab.c lex.yy.c lex.c *** /usr/src/games/atc/update.c.old Sat Dec 26 13:10:44 1987 --- /usr/src/games/atc/update.c Mon Oct 25 21:37:48 1999 *************** *** 7,33 **** * For more info on this and all of my stuff, mail edjames@berkeley.edu. */ ! #ifndef lint ! static char sccsid[] = "@(#)update.c 1.3 (Berkeley) 12/26/87"; ! #endif not lint #include "include.h" update() { ! int i, dir_diff, mask, unclean; PLANE *pp, *p1, *p2, *p; ! #ifdef BSD ! mask = sigblock(sigmask(SIGINT)); ! #endif ! #ifdef SYSV ! alarm(0); ! signal(SIGALRM, update); ! #endif clock++; - erase_all(); /* put some planes in the air */ --- 7,29 ---- * For more info on this and all of my stuff, mail edjames@berkeley.edu. */ ! #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)update.c 1.3.1 (2.11BSD) 1999/10/25"; ! #endif #include "include.h" update() { ! int i, dir_diff, unclean; PLANE *pp, *p1, *p2, *p; + sigset_t set, oset; ! sigemptyset(&set); ! sigaddset(&set, SIGINT); ! (void)sigprocmask(SIG_BLOCK, &set, &oset); clock++; erase_all(); /* put some planes in the air */ *************** *** 175,186 **** if ((rand() % sp->newplane_time) == 0) addplane(); ! #ifdef BSD ! sigsetmask(mask); ! #endif ! #ifdef SYSV ! alarm(sp->update_secs); ! #endif } char * --- 171,177 ---- if ((rand() % sp->newplane_time) == 0) addplane(); ! (void)sigprocmask(SIG_SETMASK, &oset, NULL); } char * *** /usr/src/games/battlestar/com6.c.old Sat Oct 26 17:19:48 1996 --- /usr/src/games/battlestar/com6.c Mon Oct 25 20:56:47 1999 *************** *** 5,11 **** */ #if !defined(lint) && !defined(pdp11) ! static char sccsid[] = "@(#)com6.c 1.3.1 1996/10/26"; #endif #include "externs.h" --- 5,11 ---- */ #if !defined(lint) && !defined(pdp11) ! static char sccsid[] = "@(#)com6.c 1.3.2 1999/10/25"; #endif #include "externs.h" *************** *** 69,76 **** FILE *fp; struct timeval tv; char *date; ! long s = sigblock(sigmask(SIGINT)); gettimeofday(&tv, (struct timezone *)0); date = ctime(&tv.tv_sec); date[24] = '\0'; --- 69,79 ---- FILE *fp; struct timeval tv; char *date; ! sigset_t s, oset; + sigemptyset(&s); + sigaddset(&s, SIGINT); + (void)sigprocmask(SIG_BLOCK, &s, &oset); gettimeofday(&tv, (struct timezone *)0); date = ctime(&tv.tv_sec); date[24] = '\0'; *************** *** 84,90 **** fprintf(fp, "\n"); } else perror(logfile); ! sigsetmask(s); } char * --- 87,93 ---- fprintf(fp, "\n"); } else perror(logfile); ! (void)sigprocmask(SIG_SETMASK, &oset, NULL); } char * *** /usr/src/games/warp/sig.c.old Fri Aug 12 13:15:54 1988 --- /usr/src/games/warp/sig.c Mon Oct 25 21:21:57 1999 *************** *** 1,6 **** --- 1,9 ---- /* $Header: /usr/src/games/warp/RCS/sig.c,v 1.1 87/07/03 01:47:11 games Exp $ */ /* $Log: sig.c,v $ + * Revision 7.0.1.2 99/10/24 + * Update to sigprocmask. + * * Revision 7.0.1.1a 87/07/03 01:47:11 games * Changed sigsetmask to use sigmask instead of calculating it (incorrectly) * by hand. *************** *** 206,211 **** --- 209,216 ---- void stop_catcher() { + sigset_t set; + if (!waiting) { resetty(); /* this is the point of all this */ #ifdef DEBUGGING *************** *** 213,225 **** write(2,"stop_catcher\r\n",13); #endif sigset(SIGTSTP,SIG_DFL); /* enable stop */ ! #ifdef BSD42 ! sigsetmask(sigblock(0L) & ~sigmask(SIGTSTP)); ! #endif kill(0,SIGTSTP); /* and do the stop */ } - #ifndef lint sigset(SIGTSTP,stop_catcher); /* unenable the stop */ - #endif } #endif --- 218,228 ---- write(2,"stop_catcher\r\n",13); #endif sigset(SIGTSTP,SIG_DFL); /* enable stop */ ! sigemptyset(&set); ! sigaddset(&set, SIGTSTP); ! (void)sigprocmask(SIG_UNBLOCK, &set, NULL); kill(0,SIGTSTP); /* and do the stop */ } sigset(SIGTSTP,stop_catcher); /* unenable the stop */ } #endif *** /VERSION.old Fri Sep 24 21:20:40 1999 --- /VERSION Fri Nov 26 20:46:22 1999 *************** *** 1,5 **** ! Current Patch Level: 429 ! Date: September 24, 1999 2.11 BSD ============ --- 1,5 ---- ! Current Patch Level: 430 ! Date: November 26, 1999 2.11 BSD ============