Subject: sigaction(2), sigsetops(3), and more missing in 2.11BSD (#387 - 3 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 #387 and is part 3 of 4.  Make sure you have parts
	1, 2, and 4 (updates 385, 386 and 388) before beginning to install
	anything.

	This (#387) portion of the kit contains the first (of two) patch
	files.

	NOTE:  Be certain to read the directions in part 1 (#385) about what
	       must be done before applying the patches below

-------------------------------cut here------------------------------------
*** /usr/src/bin/adb/opset.c.old	Mon May  8 23:05:43 1995
--- /usr/src/bin/adb/opset.c	Fri Aug 29 14:34:01 1997
***************
*** 1,5 ****
  #if	!defined(lint) && defined(DOSCCS)
! static	char	sccsid[] = "@(#)opset.c 2.2 (2.11BSD GTE) 1995/05/08";
  #endif
  
  #include "defs.h"
--- 1,5 ----
  #if	!defined(lint) && defined(DOSCCS)
! static	char	sccsid[] = "@(#)opset.c 2.3 (2.11BSD GTE) 1997/8/28";
  #endif
  
  #include "defs.h"
***************
*** 132,138 ****
  };
  
  char *systab[] = {
! 	"old indir",		/* 0 */
  	"exit",
  	"fork",
  	"read",
--- 132,138 ----
  };
  
  char *systab[] = {
! 	"indir",		/* 0 - indir*/
  	"exit",
  	"fork",
  	"read",
***************
*** 160,184 ****
  	"geteuid",		/* 25 */
  	"ptrace",
  	"getppid",
! 	NULL,			/* 28 - old fstat */
! 	NULL,			/* 29 - old pause */
! 	NULL,			/* 30 - old utime */
! 	NULL,			/* 31 - old stty */
! 	NULL,			/* 32 - old gtty */
  	"access",
! 	NULL,			/* 34 - old nice */
! 	NULL,			/* 35 - old ftime */
  	"sync",
  	"kill",
  	"stat",
! 	NULL,			/* 39 - old setpgrp */
  	"lstat",
  	"dup",
  	"pipe",
! 	NULL,			/* 43 - old times */
  	"profil",
  	NULL,			/* 45 - unused */
! 	NULL,			/* 46 - old setgid */
  	"getgid",
  	"getegid",
  	NULL,			/* 49 - unused */
--- 160,184 ----
  	"geteuid",		/* 25 */
  	"ptrace",
  	"getppid",
! 	NULL,			/* 28 - unused */
! 	NULL,			/* 29 - unused */
! 	NULL,			/* 30 - unused */
! 	"sigaction",		/* 31 - sigaction */
! 	"sigprocmask",		/* 32 - sigprocmask */
  	"access",
! 	"sigpending",		/* 34 - sigpending */
! 	"sigaltstack",		/* 35 - sigaltstack */
  	"sync",
  	"kill",
  	"stat",
! 	NULL,			/* 39 - unused */
  	"lstat",
  	"dup",
  	"pipe",
! 	NULL,			/* 43 - unused */
  	"profil",
  	NULL,			/* 45 - unused */
! 	NULL,			/* 46 - unused */
  	"getgid",
  	"getegid",
  	NULL,			/* 49 - unused */
***************
*** 188,194 ****
  	"lock",
  	"ioctl",
  	"reboot",
! 	NULL,			/* 56 - old mpxchan */
  	"symlink",
  	"readlink",
  	"execve",
--- 188,194 ----
  	"lock",
  	"ioctl",
  	"reboot",
! 	NULL,			/* 56 - unused */
  	"symlink",
  	"readlink",
  	"execve",
***************
*** 199,216 ****
  	"getpagesize",
  	NULL,			/* 65 - mremap */
  	"vfork",
! 	NULL,			/* 67 - old vread */
! 	NULL,			/* 68 - old vwrite */
  	"sbrk",
! 	NULL,			/* 70 - old sstk */
! 	NULL,			/* 71 - mmap */
! 	NULL,			/* 72 - old vadvise */
! 	NULL,			/* 73 - munmap */
! 	NULL,			/* 74 - mprotect */
! 	NULL,			/* 75 - madvise */
  	"vhangup",
! 	NULL,			/* 77 - old vlimit */
! 	NULL,			/* 78 - mincore */
  	"getgroups",
  	"setgroups",
  	"getpgrp",
--- 199,216 ----
  	"getpagesize",
  	NULL,			/* 65 - mremap */
  	"vfork",
! 	NULL,			/* 67 - unused */
! 	NULL,			/* 68 - unused */
  	"sbrk",
! 	NULL,			/* 70 - unused */
! 	NULL,			/* 71 - unused */
! 	NULL,			/* 72 - unused */
! 	NULL,			/* 73 - unused */
! 	NULL,			/* 74 - unused */
! 	NULL,			/* 75 - unused */
  	"vhangup",
! 	NULL,			/* 77 - unused */
! 	NULL,			/* 78 - unused */
  	"getgroups",
  	"setgroups",
  	"getpgrp",
***************
*** 217,223 ****
  	"setpgrp",
  	"setitimer",
  	"old wait",
! 	NULL,			/* 85 - 4.3 swapon */
  	"getitimer",
  	"gethostname",
  	"sethostname",
--- 217,223 ----
  	"setpgrp",
  	"setitimer",
  	"old wait",
! 	NULL,			/* 85 - unused */
  	"getitimer",
  	"gethostname",
  	"sethostname",
***************
*** 239,257 ****
  	"bind",
  	"setsockopt",
  	"listen",
! 	NULL,			/* 107 - old vtimes */
! 	"sigvec",
! 	"sigblock",
! 	"sigsetmask",
! 	"sigpause",
! 	"sigstack",
  	"recvmsg",
  	"sendmsg",
! 	NULL,			/* 115 - 4.3 vtrace */
  	"gettimeofday",
  	"getrusage",
  	"getsockopt",
! 	NULL,			/* 119 - old resuba */
  	"readv",
  	"writev",
  	"settimeofday",
--- 239,257 ----
  	"bind",
  	"setsockopt",
  	"listen",
! 	"sigsuspend",		/* 107 - sigsuspend */
! 	"sigvec",		/* 108 - sigvec COMPAT-43 */
! 	"sigblock",		/* 109 - sigblock COMPAT-43 */
! 	"sigsetmask",		/* 110 - sigsetmask COMPAT-43 */
! 	"sigpause",		/* 111 - sigpause COMPAT-43 */
! 	"sigstack",		/* 112 - sigstack COMPAT-43 */
  	"recvmsg",
  	"sendmsg",
! 	NULL,			/* 115 - unused */
  	"gettimeofday",
  	"getrusage",
  	"getsockopt",
! 	NULL,			/* 119 - unused */
  	"readv",
  	"writev",
  	"settimeofday",
***************
*** 271,281 ****
  	"mkdir",
  	"rmdir",
  	"utimes",
! 	NULL,			/* 139 - 4.2 sigreturn */
  	"adjtime",
  	"getpeername",
! 	"gethostid",
! 	"sethostid",
  	"getrlimit",
  	"setrlimit",
  	"killpg",
--- 271,281 ----
  	"mkdir",
  	"rmdir",
  	"utimes",
! 	NULL,			/* 139 - unused */
  	"adjtime",
  	"getpeername",
! 	"gethostid",		/* 142 - gethostid COMPAT-43 */
! 	"sethostid",		/* 143 - sethostid COMPAT-43 */
  	"getrlimit",
  	"setrlimit",
  	"killpg",
***************
*** 286,297 ****
  	/*
  	 * 2.11BSD special calls
  	 */
! 	NULL,			/* 151 - old rtp */
  	"nostk",
  	"fetchi",
  	"ucall",
  	"fperr",
- 	"gldav",
  };
  
  #define	NUMSYSCALLS	(sizeof (systab) / sizeof (char *))
--- 286,296 ----
  	/*
  	 * 2.11BSD special calls
  	 */
! 	NULL,			/* 151 - unused */
  	"nostk",
  	"fetchi",
  	"ucall",
  	"fperr",
  };
  
  #define	NUMSYSCALLS	(sizeof (systab) / sizeof (char *))
*** /usr/include/syscall.h.old	Sun Dec 24 14:37:19 1995
--- /usr/include/syscall.h	Tue Sep  9 20:32:10 1997
***************
*** 3,11 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)syscall.h	5.4.5 (2.11BSD GTE) 1995/12/24
   */
  
  #define	SYS_exit	1
  #define	SYS_fork	2
  #define	SYS_read	3
--- 3,16 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)syscall.h	5.4.6 (2.11BSD GTE) 1997/8/28
   */
  
+ /*
+  * DO NOT place any comments on the same line as a SYS_* definition.  This
+  * causes cpp to leave a trailing tab when expanding macros in pdp/sys/SYS.h
+ */
+ 
  #define	SYS_exit	1
  #define	SYS_fork	2
  #define	SYS_read	3
***************
*** 36,46 ****
  #define	SYS_statfs	28
  #define	SYS_fstatfs	29
  #define	SYS_getfsstat	30
! 				/* 31 is old: stty */
! 				/* 32 is old: gtty */
  #define	SYS_access	33
! 				/* 34 is old: nice */
! 				/* 35 is old: ftime */
  #define	SYS_sync	36
  #define	SYS_kill	37
  #define	SYS_stat	38
--- 41,51 ----
  #define	SYS_statfs	28
  #define	SYS_fstatfs	29
  #define	SYS_getfsstat	30
! #define	SYS_sigaction	31
! #define	SYS_sigprocmask	32
  #define	SYS_access	33
! #define	SYS_sigpending	34
! #define	SYS_sigaltstack	35
  #define	SYS_sync	36
  #define	SYS_kill	37
  #define	SYS_stat	38
***************
*** 112,118 ****
  #define	SYS_bind	104
  #define	SYS_setsockopt	105
  #define	SYS_listen	106
! 				/* 107 was vtimes */
  #define	SYS_sigvec	108
  #define	SYS_sigblock	109
  #define	SYS_sigsetmask	110
--- 117,126 ----
  #define	SYS_bind	104
  #define	SYS_setsockopt	105
  #define	SYS_listen	106
! #define	SYS_sigsuspend	107
! /*
!  * 108 thru 112 are 4.3BSD compatibility syscalls
! */
  #define	SYS_sigvec	108
  #define	SYS_sigblock	109
  #define	SYS_sigsetmask	110
***************
*** 165,168 ****
  #define	SYS_fetchi	153
  #define	SYS_ucall	154
  #define	SYS_fperr	155
- #define	SYS_gldav	156
--- 173,175 ----
*** /usr/src/sys/conf/Make.sys.old	Fri Jan 31 21:03:43 1997
--- /usr/src/sys/conf/Make.sys	Fri Aug 29 19:49:36 1997
***************
*** 9,15 ****
  # software without specific prior written permission. This software
  # is provided ``as is'' without express or implied warranty.
  #
! #	2.4 (2.11BSD GTE) 1997/1/31
  #
  S=	../sys
  VPATH=	../sys
--- 9,15 ----
  # software without specific prior written permission. This software
  # is provided ``as is'' without express or implied warranty.
  #
! #	2.5 (2.11BSD GTE) 1997/8/29
  #
  S=	../sys
  VPATH=	../sys
***************
*** 19,24 ****
--- 19,25 ----
  	${S}/kern_exit.c ${S}/kern_fork.c ${S}/kern_mman.c		\
  	${S}/kern_proc.c ${S}/kern_prot.c ${S}/kern_resource.c		\
  	${S}/kern_sig.c ${S}/kern_subr.c ${S}/kern_sysctl.c		\
+ 	${S}/kern_sig2.c						\
  	${S}/kern_synch.c ${S}/kern_time.c ${S}/kern_xxx.c		\
  	${S}/quota_sys.c ${S}/quota_kern.c ${S}/quota_ufs.c		\
  	${S}/quota_subr.c ${S}/subr_log.c ${S}/subr_prf.c ${S}/subr_rmap.c \
***************
*** 37,42 ****
--- 38,44 ----
  OBJS=	init_main.o init_sysent.o kern_acct.o kern_clock.o		\
  	kern_descrip.o kern_exec.o kern_exit.o kern_fork.o kern_mman.o	\
  	kern_proc.o kern_prot.o kern_resource.o kern_sig.o kern_sysctl.o \
+ 	kern_sig2.o							\
  	kern_subr.o kern_synch.o kern_time.o kern_xxx.o quota_sys.o	\
         quota_kern.o quota_ufs.o quota_subr.o subr_log.o subr_prf.o subr_rmap.o \
  	ingreslock.o							\
*** /usr/src/sys/conf/Make.sunix.old	Thu Feb  6 22:38:19 1997
--- /usr/src/sys/conf/Make.sunix	Fri Aug 29 21:43:48 1997
***************
*** 10,16 ****
  # software without specific prior written permission. This software
  # is provided ``as is'' without express or implied warranty.
  #
! #	2.10 (2.11BSD GTE) 1997/2/6
  #
  #########################################################
  # Non-network, but separate I/D kernel			#
--- 10,16 ----
  # software without specific prior written permission. This software
  # is provided ``as is'' without express or implied warranty.
  #
! #	2.11 (2.11BSD GTE) 1997/8/29
  #
  #########################################################
  # Non-network, but separate I/D kernel			#
***************
*** 64,70 ****
  OV6=	tmscp.o tmscpdump.o
  OV7=	rl.o mch_fpsim.o ingreslock.o ufs_disksubr.o
  OV8=	rx.o kern_sysctl.o vm_sched.o vm_text.o
! OV9=	kern_pdp.o kern_xxx.o ufs_syscalls2.o mem.o ufs_subr.o rk.o sys_pipe.o
  
  KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \
  	${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \
--- 64,71 ----
  OV6=	tmscp.o tmscpdump.o
  OV7=	rl.o mch_fpsim.o ingreslock.o ufs_disksubr.o
  OV8=	rx.o kern_sysctl.o vm_sched.o vm_text.o
! OV9=	kern_pdp.o kern_xxx.o ufs_syscalls2.o mem.o ufs_subr.o rk.o sys_pipe.o \
! 	kern_sig2.o
  
  KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \
  	${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \
*** /usr/src/sys/conf/Make.nsunix.old	Fri Jan 31 08:42:41 1997
--- /usr/src/sys/conf/Make.nsunix	Wed Sep 10 21:08:02 1997
***************
*** 9,15 ****
  # software without specific prior written permission. This software
  # is provided ``as is'' without express or implied warranty.
  #
! #	2.8	(2.11BSD GTE) 1997/1/31
  #
  #########################################################
  # Networking, separate I/D kernel			#
--- 9,15 ----
  # software without specific prior written permission. This software
  # is provided ``as is'' without express or implied warranty.
  #
! #	2.9	(2.11BSD GTE) 1997/8/29
  #
  #########################################################
  # Networking, separate I/D kernel			#
***************
*** 63,69 ****
  	tm.o ts.o tty.o tty_conf.o tty_subr.o tty_tb.o ufs_alloc.o \
  	ufs_bio.o ufs_fio.o ufs_inode.o ufs_namei.o \
  	vm_proc.o vm_sched.o vm_swap.o xp.o quota_subr.o
! OV1=	sys_generic.o ufs_syscalls.o ufs_syscalls2.o vfs_vnops.o
  OV2=	kern_acct.o kern_exec.o kern_exit.o kern_fork.o kern_resource.o
  OV3=	kern_time.o sys_process.o ufs_mount.o ufs_subr.o uipc_syscalls.o
  OV4=	dkbad.o kern_sig.o mem.o subr_xxx.o trap.o tty_pty.o tty_tty.o
--- 63,69 ----
  	tm.o ts.o tty.o tty_conf.o tty_subr.o tty_tb.o ufs_alloc.o \
  	ufs_bio.o ufs_fio.o ufs_inode.o ufs_namei.o \
  	vm_proc.o vm_sched.o vm_swap.o xp.o quota_subr.o
! OV1=	sys_generic.o ufs_syscalls.o vfs_vnops.o
  OV2=	kern_acct.o kern_exec.o kern_exit.o kern_fork.o kern_resource.o
  OV3=	kern_time.o sys_process.o ufs_mount.o ufs_subr.o uipc_syscalls.o
  OV4=	dkbad.o kern_sig.o mem.o subr_xxx.o trap.o tty_pty.o tty_tty.o
***************
*** 72,78 ****
  # OV6 gets the (hopefully) never used routines
  OV6=	clock.o dn.o init_main.o kern_pdp.o machdep2.o subr_prf.o syscalls.o \
  	subr_log.o toy.o vm_swp.o
! OV7=	ufs_disksubr.o ufs_dsort.o
  OV8=	mch_fpsim.o kern_sysctl.o kern_xxx.o ingreslock.o vm_text.o
  OV9=	tmscp.o tmscpdump.o
  
--- 72,78 ----
  # OV6 gets the (hopefully) never used routines
  OV6=	clock.o dn.o init_main.o kern_pdp.o machdep2.o subr_prf.o syscalls.o \
  	subr_log.o toy.o vm_swp.o
! OV7=	ufs_disksubr.o ufs_dsort.o ufs_syscalls2.o kern_sig2.o
  OV8=	mch_fpsim.o kern_sysctl.o kern_xxx.o ingreslock.o vm_text.o
  OV9=	tmscp.o tmscpdump.o
  
*** /usr/src/sys/conf/Make.unix.old	Fri Jan 31 08:43:12 1997
--- /usr/src/sys/conf/Make.unix	Fri Aug 29 19:51:50 1997
***************
*** 9,15 ****
  # software without specific prior written permission. This software
  # is provided ``as is'' without express or implied warranty.
  #
! #	2.7 (2.11BSD GTE) 1997/1/31
  #
  #########################################################
  # Non-networking, non-separate I/D kernel		#
--- 9,15 ----
  # software without specific prior written permission. This software
  # is provided ``as is'' without express or implied warranty.
  #
! #	2.8 (2.11BSD GTE) 1997/8/29
  #
  #########################################################
  # Non-networking, non-separate I/D kernel		#
***************
*** 51,57 ****
  BASE=	br.o clock.o cons.o dh.o dhu.o dhv.o dkbad.o dn.o dr.o dz.o hk.o ht.o  \
  	init_main.o init_sysent.o kern_acct.o kern_clock.o kern_descrip.o \
  	kern_exec.o kern_exit.o kern_fork.o kern_mman.o kern_pdp.o \
! 	kern_proc.o kern_prot.o kern_resource.o kern_sig.o \
  	kern_subr.o kern_synch.o kern_time.o kern_xxx.o lp.o machdep.o \
  	machdep2.o mem.o quota_kern.o quota_subr.o quota_sys.o \
  	quota_ufs.o ra.o ram.o rk.o rl.o rx.o si.o subr_prf.o subr_rmap.o \
--- 51,57 ----
  BASE=	br.o clock.o cons.o dh.o dhu.o dhv.o dkbad.o dn.o dr.o dz.o hk.o ht.o  \
  	init_main.o init_sysent.o kern_acct.o kern_clock.o kern_descrip.o \
  	kern_exec.o kern_exit.o kern_fork.o kern_mman.o kern_pdp.o \
! 	kern_proc.o kern_prot.o kern_resource.o kern_sig.o kern_sig2.o \
  	kern_subr.o kern_synch.o kern_time.o kern_xxx.o lp.o machdep.o \
  	machdep2.o mem.o quota_kern.o quota_subr.o quota_sys.o \
  	quota_ufs.o ra.o ram.o rk.o rl.o rx.o si.o subr_prf.o subr_rmap.o \
*** /usr/src/sys/sys/kern_exec.c.old	Thu Jan 30 14:02:35 1997
--- /usr/src/sys/sys/kern_exec.c	Sat Aug 30 14:05:14 1997
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)kern_exec.c	1.6 (2.11BSD GTE) 1997/1/30
   */
  
  #include "param.h"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)kern_exec.c	1.6 (2.11BSD GTE) 1997/8/28
   */
  
  #include "param.h"
***************
*** 22,27 ****
--- 22,29 ----
  #include "mount.h"
  #include "file.h"
  #include "text.h"
+ #include "signalvar.h"
+ extern	char	sigprop[];	/* XXX */
  
  /*
   * exec system call, with and without environments.
***************
*** 336,342 ****
  		brelse(bp);
  		bp = NULL;
  	}
! 	execve1();
  	while (u.u_lastfile >= 0 && u.u_ofile[u.u_lastfile] == NULL)
  		u.u_lastfile--;
  
--- 338,353 ----
  		brelse(bp);
  		bp = NULL;
  	}
! 	execsigs(u.u_procp);
! 	for	(cp = u.u_pofile, cc = 0; cc <= u.u_lastfile; cc++, cp++)
! 		{
! 		if	(*cp & UF_EXCLOSE)
! 			{
! 			(void)closef(u.u_ofile[cc]);
! 			u.u_ofile[cc] = NULL;
! 			*cp = 0;
! 			}
! 		}
  	while (u.u_lastfile >= 0 && u.u_ofile[u.u_lastfile] == NULL)
  		u.u_lastfile--;
  
***************
*** 370,433 ****
  }
  
  /*
!  * execve1 is a helper routine to speed up execve.
   */
! static
! execve1()
  {
! 	/*
! 	 * 4.3 source
! 	 *
! 	 * Reset caught signals.  Held signals
! 	 * remain held through p_sigmask.
! 	 *
! 	 * In an effort to avoid exspensive long masking operations
! 	 * we use two integer loops rather than one long loop.
! 	 * The constant 16 is the number of bits per int.
! 	 *
! 	 *	while (u.u_procp->p_sigcatch) {
! 	 *		nc = ffs((long)u.u_procp->p_sigcatch);
! 	 *		u.u_procp->p_sigcatch &= ~sigmask(nc);
! 	 *		u.u_signal[nc] = SIG_DFL;
! 	 *	}
! 	 */
! {
! 	register int cnt, imask;
! 	register int (**sigp)();
! 	long mask;
  
- 	mask = u.u_procp->p_sigcatch;
- 	u.u_procp->p_sigcatch = 0;
- 	sigp = &u.u_signal[1];
- 	for (cnt = 16, imask = loint(mask); cnt > 0; cnt--, imask >>= 1, sigp++)
- 		if (imask&1)
- 			*sigp = SIG_DFL;
- 	for (cnt = NSIG-16, imask = hiint(mask); cnt > 0; cnt--, imask >>= 1, sigp++)
- 		if (imask&1)
- 			*sigp = SIG_DFL;
- }
  	/*
! 	 * Reset stack state to the user stack.
! 	 * Clear set of signals caught on the signal stack.
  	 */
! 	u.u_onstack = 0;
! 	u.u_sigsp = 0;
! 	u.u_sigonstack = 0;
! 
! {
! 	register int cnt;
! 	register struct file **ofilep = u.u_ofile;
! 	register char *pofilep = u.u_pofile;
! 
! 	for (cnt = u.u_lastfile;cnt >= 0; cnt--, ofilep++, pofilep++)
! 		if (*pofilep & UF_EXCLOSE) {
! 			(void) closef(*ofilep);
! 			*ofilep = NULL;
! 			*pofilep = 0;
  		}
  }
- }
- 
  /*
   * Read in and set up memory for executed file.
   * u.u_error set on error
--- 381,422 ----
  }
  
  /*
!  * Reset signals for an exec of the specified process.  In 4.4 this function
!  * was in kern_sig.c but since in 2.11 kern_sig and kern_exec will likely be
!  * in different overlays placing this here potentially saves a kernel overlay
!  * switch.
   */
! void
! execsigs(p)
! 	register struct proc *p;
  {
! 	register int nc;
! 	unsigned long mask;
  
  	/*
! 	 * Reset caught signals.  Held signals remain held
! 	 * through p_sigmask (unless they were caught,
! 	 * and are now ignored by default).
  	 */
! 	while (p->p_sigcatch) {
! 		nc = ffs(p->p_sigcatch);
! 		mask = sigmask(nc);
! 		p->p_sigcatch &= ~mask;
! 		if (sigprop[nc] & SA_IGNORE) {
! 			if (nc != SIGCONT)
! 				p->p_sigignore |= mask;
! 			p->p_sig &= ~mask;
  		}
+ 		u.u_signal[nc] = SIG_DFL;
+ 	}
+ 	/*
+ 	 * Reset stack state to the user stack (disable the alternate stack).
+ 	 */
+ 	u.u_sigstk.ss_flags = SA_DISABLE;
+ 	u.u_sigstk.ss_size = 0;
+ 	u.u_sigstk.ss_base = 0;
+ 	u.u_psflags = 0;
  }
  /*
   * Read in and set up memory for executed file.
   * u.u_error set on error
*** /usr/src/sys/sys/init_sysent.c.old	Tue Dec 26 20:43:50 1995
--- /usr/src/sys/sys/init_sysent.c	Fri Aug 29 09:58:42 1997
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)init_sysent.c	1.9 (2.11BSD GTE) 1995/12/24
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)init_sysent.c	1.10 (2.11BSD GTE) 1997/8/29
   */
  
  /*
***************
*** 30,35 ****
--- 30,36 ----
  
  /* 1.3 signals */
  int	sigvec(),sigblock(),sigsetmask(),sigpause(),sigstack(),sigreturn();
+ int	sigaction(), sigprocmask(), sigpending(), sigaltstack(), sigsuspend();
  int	kill(), killpg();
  
  /* 1.4 timing and statistics */
***************
*** 36,42 ****
  int	gettimeofday(),settimeofday();
  int	getitimer(),setitimer();
  int	adjtime();
- int	gldav();					/* 2BSD calls */
  
  /* 1.5 descriptors */
  int	getdtablesize(),dup(),dup2(),close();
--- 37,42 ----
***************
*** 115,121 ****
  	3, open,			/*   5 = open */
  	1, close,			/*   6 = close */
  	4, wait4,			/*   7 = wait4 */
! 	2, creat,			/*   8 = creat */
  	2, link,			/*   9 = link */
  	1, unlink,			/*  10 = unlink */
  	2, execv,			/*  11 = execv */
--- 115,121 ----
  	3, open,			/*   5 = open */
  	1, close,			/*   6 = close */
  	4, wait4,			/*   7 = wait4 */
! 	2, creat,			/*   8 = creat COMPAT-43 */
  	2, link,			/*   9 = link */
  	1, unlink,			/*  10 = unlink */
  	2, execv,			/*  11 = execv */
***************
*** 138,169 ****
  	2, statfs,			/*  28 = statfs */
  	2, fstatfs,			/*  29 = fstatfs */
  	3, getfsstat,			/*  30 = getfsstat */
! 	0, nosys,			/*  31 = was stty */
! 	0, nosys,			/*  32 = was gtty */
  	2, saccess,			/*  33 = access */
! 	0, nosys,			/*  34 = old nice */
! 	0, nosys,			/*  35 = old ftime */
  	0, sync,			/*  36 = sync */
  	2, kill,			/*  37 = kill */
  	2, stat,			/*  38 = stat */
! 	0, nosys,			/*  39 = old setpgrp */
  	2, lstat,			/*  40 = lstat */
  	1, dup,				/*  41 = dup */
  	0, pipe,			/*  42 = pipe */
! 	0, nosys,			/*  43 = old times */
  	4, profil,			/*  44 = profil */
  	0, nosys,			/*  45 = nosys */
! 	0, nosys,			/*  46 = old setgid */
  	0, getgid,			/*  47 = getgid */
  	0, getegid,			/*  48 = getegid */
! 	0, nosys,			/*  49 = reserved for USG */
! 	0, nosys,			/*  50 = reserved for USG */
  	1, sysacct,			/*  51 = turn acct off/on */
  	3, phys,			/*  52 = (2.9) set phys addr */
  	1, lock,			/*  53 = (2.9) lock in core */
  	4, ioctl,			/*  54 = ioctl */
  	1, reboot,			/*  55 = reboot */
! 	0, nosys,			/*  56 = old mpxchan */
  	2, symlink,			/*  57 = symlink */
  	3, readlink,			/*  58 = readlink */
  	3, execve,			/*  59 = execve */
--- 138,169 ----
  	2, statfs,			/*  28 = statfs */
  	2, fstatfs,			/*  29 = fstatfs */
  	3, getfsstat,			/*  30 = getfsstat */
! 	4, sigaction,			/*  31 = sigaction */
! 	3, sigprocmask,			/*  32 = sigprocmask */
  	2, saccess,			/*  33 = access */
! 	1, sigpending,			/*  34 = sigpending */
! 	2, sigaltstack,			/*  35 = sigaltstack */
  	0, sync,			/*  36 = sync */
  	2, kill,			/*  37 = kill */
  	2, stat,			/*  38 = stat */
! 	0, nosys,			/*  39 = unused */
  	2, lstat,			/*  40 = lstat */
  	1, dup,				/*  41 = dup */
  	0, pipe,			/*  42 = pipe */
! 	0, nosys,			/*  43 = unused */
  	4, profil,			/*  44 = profil */
  	0, nosys,			/*  45 = nosys */
! 	0, nosys,			/*  46 = unused */
  	0, getgid,			/*  47 = getgid */
  	0, getegid,			/*  48 = getegid */
! 	0, nosys,			/*  49 = unused */
! 	0, nosys,			/*  50 = unused */
  	1, sysacct,			/*  51 = turn acct off/on */
  	3, phys,			/*  52 = (2.9) set phys addr */
  	1, lock,			/*  53 = (2.9) lock in core */
  	4, ioctl,			/*  54 = ioctl */
  	1, reboot,			/*  55 = reboot */
! 	0, nosys,			/*  56 = unused */
  	2, symlink,			/*  57 = symlink */
  	3, readlink,			/*  58 = readlink */
  	3, execve,			/*  59 = execve */
***************
*** 172,198 ****
  	2, fstat,			/*  62 = fstat */
  	0, nosys,			/*  63 = reserved */
  	0, getpagesize,			/*  64 = getpagesize */
! 	0, nosys,			/*  65 = (4.3) mremap */
  	0, vfork,			/*  66 = vfork */
! 	0, nosys,			/*  67 = (4.3) old vread */
! 	0, nosys,			/*  68 = (4.3) old vwrite */
  	1, sbrk,			/*  69 = sbrk */
! 	0, nosys,			/*  70 = (4.3) sstk */
! 	0, nosys,			/*  71 = (4.3) mmap */
! 	0, nosys,			/*  72 = (4.3) old vadvise */
! 	0, nosys,			/*  73 = (4.3) munmap */
! 	0, nosys,			/*  74 = (4.3) mprotect */
! 	0, nosys,			/*  75 = (4.3) madvise */
  	0, vhangup,			/*  76 = vhangup */
! 	0, nosys,			/*  77 = (4.3) old vlimit */
! 	0, nosys,			/*  78 = (4.3) mincore */
  	2, getgroups,			/*  79 = getgroups */
  	2, setgroups,			/*  80 = setgroups */
  	1, getpgrp,			/*  81 = getpgrp */
  	2, setpgrp,			/*  82 = setpgrp */
  	3, setitimer,			/*  83 = setitimer */
! 	0, owait,			/*  84 = wait,wait3 (compatibility) */
! 	0, nosys,			/*  85 = (4.3) swapon */
  	2, getitimer,			/*  86 = getitimer */
  	2, gethostname,			/*  87 = gethostname */
  	2, sethostname,			/*  88 = sethostname */
--- 172,198 ----
  	2, fstat,			/*  62 = fstat */
  	0, nosys,			/*  63 = reserved */
  	0, getpagesize,			/*  64 = getpagesize */
! 	0, nosys,			/*  65 = unused */
  	0, vfork,			/*  66 = vfork */
! 	0, nosys,			/*  67 = unused */
! 	0, nosys,			/*  68 = unused */
  	1, sbrk,			/*  69 = sbrk */
! 	0, nosys,			/*  70 = unused */
! 	0, nosys,			/*  71 = unused */
! 	0, nosys,			/*  72 = unused */
! 	0, nosys,			/*  73 = unused */
! 	0, nosys,			/*  74 = unused */
! 	0, nosys,			/*  75 = unused */
  	0, vhangup,			/*  76 = vhangup */
! 	0, nosys,			/*  77 = unused */
! 	0, nosys,			/*  78 = unused */
  	2, getgroups,			/*  79 = getgroups */
  	2, setgroups,			/*  80 = setgroups */
  	1, getpgrp,			/*  81 = getpgrp */
  	2, setpgrp,			/*  82 = setpgrp */
  	3, setitimer,			/*  83 = setitimer */
! 	0, owait,			/*  84 = wait,wait3 COMPAT */
! 	0, nosys,			/*  85 = unused */
  	2, getitimer,			/*  86 = getitimer */
  	2, gethostname,			/*  87 = gethostname */
  	2, sethostname,			/*  88 = sethostname */
***************
*** 214,232 ****
  	ifnet(3, bind),			/* 104 = bind */
  	ifnet(5, setsockopt),		/* 105 = setsockopt */
  	ifnet(2, listen),		/* 106 = listen */
! 	0, nosys,			/* 107 = (4.3) old vtimes */
! 	4, sigvec,			/* 108 = sigvec */
! 	2, sigblock,			/* 109 = sigblock */
! 	2, sigsetmask,			/* 110 = sigsetmask */
! 	2, sigpause,			/* 111 = sigpause */
! 	2, sigstack,			/* 112 = sigstack */
  	ifnet(3, recvmsg),		/* 113 = recvmsg */
  	ifnet(3, sendmsg),		/* 114 = sendmsg */
! 	0, nosys,			/* 115 = (4.3) vtrace */
  	2, gettimeofday,		/* 116 = gettimeofday */
  	2, getrusage,			/* 117 = getrusage */
  	ifnet(5, getsockopt),		/* 118 = getsockopt */
! 	0, nosys,			/* 119 = (4.3) (vax) resuba */
  	3, readv,			/* 120 = readv */
  	3, writev,			/* 121 = writev */
  	2, settimeofday,		/* 122 = settimeofday */
--- 214,232 ----
  	ifnet(3, bind),			/* 104 = bind */
  	ifnet(5, setsockopt),		/* 105 = setsockopt */
  	ifnet(2, listen),		/* 106 = listen */
! 	1, sigsuspend,			/* 107 = sigsuspend */
! 	4, sigvec,			/* 108 = sigvec COMPAT-43 */
! 	2, sigblock,			/* 109 = sigblock COMPAT-43 */
! 	2, sigsetmask,			/* 110 = sigsetmask COMPAT-43 */
! 	2, sigpause,			/* 111 = sigpause COMPAT-43 */
! 	2, sigstack,			/* 112 = sigstack COMPAT-43 */
  	ifnet(3, recvmsg),		/* 113 = recvmsg */
  	ifnet(3, sendmsg),		/* 114 = sendmsg */
! 	0, nosys,			/* 115 = unused */
  	2, gettimeofday,		/* 116 = gettimeofday */
  	2, getrusage,			/* 117 = getrusage */
  	ifnet(5, getsockopt),		/* 118 = getsockopt */
! 	0, nosys,			/* 119 = unused */
  	3, readv,			/* 120 = readv */
  	3, writev,			/* 121 = writev */
  	2, settimeofday,		/* 122 = settimeofday */
***************
*** 246,256 ****
  	2, mkdir,			/* 136 = mkdir */
  	1, rmdir,			/* 137 = rmdir */
  	2, utimes,			/* 138 = utimes */
! 	0, nosys,			/* 139 = internal (4.2 sigreturn) */
  	2, adjtime,			/* 140 = adjtime */
  	ifnet(3, getpeername),		/* 141 = getpeername */
! 	0, gethostid,			/* 142 = gethostid */
! 	2, sethostid,			/* 143 = sethostid */
  	2, getrlimit,			/* 144 = getrlimit */
  	2, setrlimit,			/* 145 = setrlimit */
  	2, killpg,			/* 146 = killpg */
--- 246,256 ----
  	2, mkdir,			/* 136 = mkdir */
  	1, rmdir,			/* 137 = rmdir */
  	2, utimes,			/* 138 = utimes */
! 	0, nosys,			/* 139 = unused */
  	2, adjtime,			/* 140 = adjtime */
  	ifnet(3, getpeername),		/* 141 = getpeername */
! 	0, gethostid,			/* 142 = gethostid COMPAT-43 */
! 	2, sethostid,			/* 143 = sethostid COMPAT-43 */
  	2, getrlimit,			/* 144 = getrlimit */
  	2, setrlimit,			/* 145 = setrlimit */
  	2, killpg,			/* 146 = killpg */
***************
*** 267,278 ****
  	/*
  	 * 2BSD special calls
  	 */
! 	0, nosys,			/* 151 = unused (old 2.9 rtp) */
  	0, nostk,			/* 152 = nostk */
  	1, fetchi,			/* 153 = fetchi */
  	4, ucall,			/* 154 = ucall */
  	0, fperr,			/* 155 = fperr */
- 	1, gldav,			/* 156 = gldav */
  };
  
  int	nsysent = sizeof (sysent) / sizeof (sysent[0]);
--- 267,277 ----
  	/*
  	 * 2BSD special calls
  	 */
! 	0, nosys,			/* 151 = unused */
  	0, nostk,			/* 152 = nostk */
  	1, fetchi,			/* 153 = fetchi */
  	4, ucall,			/* 154 = ucall */
  	0, fperr,			/* 155 = fperr */
  };
  
  int	nsysent = sizeof (sysent) / sizeof (sysent[0]);
*** /usr/src/sys/sys/syscalls.c.old	Tue Dec 26 23:21:40 1995
--- /usr/src/sys/sys/syscalls.c	Fri Aug 29 09:58:44 1997
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)syscalls.c	1.6 (2.11BSD GTE) 1995/12/26
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)syscalls.c	1.7 (2.11BSD GTE) 1997/8/29
   */
  
  /*
***************
*** 18,25 ****
  	"write",		/*   4 = write */
  	"open",			/*   5 = open */
  	"close",		/*   6 = close */
! 	"old wait - nosys",	/*   7 = old wait */
! 	"creat",		/*   8 = creat */
  	"link",			/*   9 = link */
  	"unlink",		/*  10 = unlink */
  	"execv",		/*  11 = execv */
--- 18,25 ----
  	"write",		/*   4 = write */
  	"open",			/*   5 = open */
  	"close",		/*   6 = close */
! 	"wait4",		/*   7 = wait4 */
! 	"old creat",		/*   8 = creat COMPAT-43 */
  	"link",			/*   9 = link */
  	"unlink",		/*  10 = unlink */
  	"execv",		/*  11 = execv */
***************
*** 34,40 ****
  	"getpid",		/*  20 = getpid */
  	"mount",		/*  21 = mount */
  	"umount",		/*  22 = umount */
! 	"old setuid - nosys",	/*  23 = old setuid */
  	"getuid",		/*  24 = getuid */
  	"geteuid",		/*  25 = geteuid */
  	"ptrace",		/*  26 = ptrace */
--- 34,40 ----
  	"getpid",		/*  20 = getpid */
  	"mount",		/*  21 = mount */
  	"umount",		/*  22 = umount */
! 	"__sysctl",		/*  23 = __sysctl */
  	"getuid",		/*  24 = getuid */
  	"geteuid",		/*  25 = geteuid */
  	"ptrace",		/*  26 = ptrace */
***************
*** 42,73 ****
  	"statfs",		/*  28 = statfs */
  	"fstatfs",		/*  29 = fstatfs */
  	"getfsstat",		/*  30 = getfsstat */
! 	"old stty - nosys",	/*  31 = old stty */
! 	"old gtty - nosys",	/*  32 = old gtty */
  	"access",		/*  33 = access */
! 	"old nice - nosys",	/*  34 = old nice */
! 	"old ftime - nosys",	/*  35 = old ftime */
  	"sync",			/*  36 = sync */
  	"kill",			/*  37 = kill */
  	"stat",			/*  38 = stat */
! 	"old setpgrp - nosys",	/*  39 = old setpgrp */
  	"lstat",		/*  40 = lstat */
  	"dup",			/*  41 = dup */
  	"pipe",			/*  42 = pipe */
! 	"old times - nosys",	/*  43 = old times */
  	"profil",		/*  44 = profil */
! 	"#45",			/*  45 = nosys */
! 	"old setgid - nosys",	/*  46 = old setgid */
  	"getgid",		/*  47 = getgid */
  	"getegid",		/*  48 = getegid */
! 	"#49",			/*  49 = reserved for USG */
! 	"#50",			/*  50 = reserved for USG */
  	"acct",			/*  51 = turn acct off/on */
! 	"old phys",		/*  52 = old set phys addr */
! 	"old lock",		/*  53 = old lock in core */
  	"ioctl",		/*  54 = ioctl */
  	"reboot",		/*  55 = reboot */
! 	"old mpx - nosys",	/*  56 = old mpxchan */
  	"symlink",		/*  57 = symlink */
  	"readlink",		/*  58 = readlink */
  	"execve",		/*  59 = execve */
--- 42,73 ----
  	"statfs",		/*  28 = statfs */
  	"fstatfs",		/*  29 = fstatfs */
  	"getfsstat",		/*  30 = getfsstat */
! 	"sigaction",		/*  31 = sigaction */
! 	"sigprocmask",		/*  32 = sigprocmask */
  	"access",		/*  33 = access */
! 	"sigpending",		/*  34 = sigpending */
! 	"sigaltstack",		/*  35 = sigaltstack */
  	"sync",			/*  36 = sync */
  	"kill",			/*  37 = kill */
  	"stat",			/*  38 = stat */
! 	"#39",			/*  39 = unused */
  	"lstat",		/*  40 = lstat */
  	"dup",			/*  41 = dup */
  	"pipe",			/*  42 = pipe */
! 	"#43",			/*  43 = unused */
  	"profil",		/*  44 = profil */
! 	"#45",			/*  45 = unused */
! 	"#46",			/*  46 = unused */
  	"getgid",		/*  47 = getgid */
  	"getegid",		/*  48 = getegid */
! 	"#49",			/*  49 = unused */
! 	"#50",			/*  50 = unused */
  	"acct",			/*  51 = turn acct off/on */
! 	"phys",			/*  52 = (2.9) set phys addr */
! 	"lock",			/*  53 = (2.9) lock in core */
  	"ioctl",		/*  54 = ioctl */
  	"reboot",		/*  55 = reboot */
! 	"#56",			/*  56 = unused */
  	"symlink",		/*  57 = symlink */
  	"readlink",		/*  58 = readlink */
  	"execve",		/*  59 = execve */
***************
*** 74,111 ****
  	"umask",		/*  60 = umask */
  	"chroot",		/*  61 = chroot */
  	"fstat",		/*  62 = fstat */
! 	"#63",			/*  63 = used internally */
  	"getpagesize",		/*  64 = getpagesize */
! 	"4.3 mremap - nosys",	/*  65 = mremap */
  	"vfork",		/*  66 = vfork */
! 	"old vread - nosys",	/*  67 = old vread */
! 	"old vwrite - nosys",	/*  68 = old vwrite */
  	"sbrk",			/*  69 = sbrk */
! 	"4.3 sstk - nosys",	/*  70 = sstk */
! 	"4.3 mmap - nosys",	/*  71 = mmap */
! 	"old vadvise - nosys",	/*  72 = old vadvise */
! 	"4.3 munmap - nosys",	/*  73 = munmap */
! 	"4.3 mprotect - nosys",	/*  74 = mprotect */
! 	"4.3 madvise - nosys",	/*  75 = madvise */
  	"vhangup",		/*  76 = vhangup */
! 	"old vlimit - nosys",	/*  77 = old vlimit */
! 	"4.3 mincore - nosys",	/*  78 = mincore */
  	"getgroups",		/*  79 = getgroups */
  	"setgroups",		/*  80 = setgroups */
  	"getpgrp",		/*  81 = getpgrp */
  	"setpgrp",		/*  82 = setpgrp */
  	"setitimer",		/*  83 = setitimer */
! 	"wait",			/*  84 = wait */
! 	"4.3 swapon - nosys",	/*  85 = swapon */
  	"getitimer",		/*  86 = getitimer */
  	"gethostname",		/*  87 = gethostname */
  	"sethostname",		/*  88 = sethostname */
  	"getdtablesize",	/*  89 = getdtablesize */
  	"dup2",			/*  90 = dup2 */
! 	"nosys",		/*  91 = unused */
  	"fcntl",		/*  92 = fcntl */
  	"select",		/*  93 = select */
! 	"nosys",		/*  94 = unused */
  	"fsync",		/*  95 = fsync */
  	"setpriority",		/*  96 = setpriority */
  	"socket",		/*  97 = socket */
--- 74,111 ----
  	"umask",		/*  60 = umask */
  	"chroot",		/*  61 = chroot */
  	"fstat",		/*  62 = fstat */
! 	"#63",			/*  63 = unused */
  	"getpagesize",		/*  64 = getpagesize */
! 	"#65",			/*  65 = unused */
  	"vfork",		/*  66 = vfork */
! 	"#67",			/*  67 = unused */
! 	"#68",			/*  68 = unused */
  	"sbrk",			/*  69 = sbrk */
! 	"#70",			/*  70 = unused */
! 	"#71",			/*  71 = unused */
! 	"#72",			/*  72 = unused */
! 	"#73",			/*  73 = unused */
! 	"#74",			/*  74 = unused */
! 	"#75",			/*  75 = unused */
  	"vhangup",		/*  76 = vhangup */
! 	"#77",			/*  77 = unused */
! 	"#78",			/*  78 = unused */
  	"getgroups",		/*  79 = getgroups */
  	"setgroups",		/*  80 = setgroups */
  	"getpgrp",		/*  81 = getpgrp */
  	"setpgrp",		/*  82 = setpgrp */
  	"setitimer",		/*  83 = setitimer */
! 	"old wait",		/*  84 = wait,wait3 COMPAT*/
! 	"#85",			/*  85 = unused */
  	"getitimer",		/*  86 = getitimer */
  	"gethostname",		/*  87 = gethostname */
  	"sethostname",		/*  88 = sethostname */
  	"getdtablesize",	/*  89 = getdtablesize */
  	"dup2",			/*  90 = dup2 */
! 	"#91",			/*  91 = unused */
  	"fcntl",		/*  92 = fcntl */
  	"select",		/*  93 = select */
! 	"#94",			/*  94 = unused */
  	"fsync",		/*  95 = fsync */
  	"setpriority",		/*  96 = setpriority */
  	"socket",		/*  97 = socket */
***************
*** 118,136 ****
  	"bind",			/* 104 = bind */
  	"setsockopt",		/* 105 = setsockopt */
  	"listen",		/* 106 = listen */
! 	"old vtimes - nosys",	/* 107 = old vtimes */
! 	"sigvec",		/* 108 = sigvec */
! 	"sigblock",		/* 109 = sigblock */
! 	"sigsetmask",		/* 110 = sigsetmask */
! 	"sigpause",		/* 111 = sigpause */
! 	"sigstack",		/* 112 = sigstack */
  	"recvmsg",		/* 113 = recvmsg */
  	"sendmsg",		/* 114 = sendmsg */
! 	"old vtrace - nosys",	/* 115 = old vtrace */
  	"gettimeofday",		/* 116 = gettimeofday */
  	"getrusage",		/* 117 = getrusage */
  	"getsockopt",		/* 118 = getsockopt */
! 	"4.3 resuba - nosys",	/* 119 = resuba */
  	"readv",		/* 120 = readv */
  	"writev",		/* 121 = writev */
  	"settimeofday",		/* 122 = settimeofday */
--- 118,136 ----
  	"bind",			/* 104 = bind */
  	"setsockopt",		/* 105 = setsockopt */
  	"listen",		/* 106 = listen */
! 	"sigsuspend",		/* 107 = sigsuspend */
! 	"sigvec",		/* 108 = sigvec COMPAT-43 */
! 	"sigblock",		/* 109 = sigblock COMPAT-43 */
! 	"sigsetmask",		/* 110 = sigsetmask COMPAT-43 */
! 	"sigpause",		/* 111 = sigpause COMPAT-43 */
! 	"sigstack",		/* 112 = sigstack COMPAT-43 */
  	"recvmsg",		/* 113 = recvmsg */
  	"sendmsg",		/* 114 = sendmsg */
! 	"#115",			/* 115 = unused */
  	"gettimeofday",		/* 116 = gettimeofday */
  	"getrusage",		/* 117 = getrusage */
  	"getsockopt",		/* 118 = getsockopt */
! 	"#119",			/* 119 = unused */
  	"readv",		/* 120 = readv */
  	"writev",		/* 121 = writev */
  	"settimeofday",		/* 122 = settimeofday */
***************
*** 143,149 ****
  	"truncate",		/* 129 = truncate */
  	"ftruncate",		/* 130 = ftruncate */
  	"flock",		/* 131 = flock */
! 	"old portal - nosys",	/* 132 = old portal */
  	"sendto",		/* 133 = sendto */
  	"shutdown",		/* 134 = shutdown */
  	"socketpair",		/* 135 = socketpair */
--- 143,149 ----
  	"truncate",		/* 129 = truncate */
  	"ftruncate",		/* 130 = ftruncate */
  	"flock",		/* 131 = flock */
! 	"#132",			/* 132 = unused */
  	"sendto",		/* 133 = sendto */
  	"shutdown",		/* 134 = shutdown */
  	"socketpair",		/* 135 = socketpair */
***************
*** 150,166 ****
  	"mkdir",		/* 136 = mkdir */
  	"rmdir",		/* 137 = rmdir */
  	"utimes",		/* 138 = utimes */
! 	"4.2 sigreturn - nosys",	/* 139 = old 4.2 sigreturn */
  	"adjtime",		/* 140 = adjtime */
  	"getpeername",		/* 141 = getpeername */
! 	"gethostid",		/* 142 = gethostid */
! 	"sethostid",		/* 143 = sethostid */
  	"getrlimit",		/* 144 = getrlimit */
  	"setrlimit",		/* 145 = setrlimit */
  	"killpg",		/* 146 = killpg */
! 	"#147",			/* 147 = nosys */
  	"setquota",		/* 148 = setquota */
  	"quota",		/* 149 = quota */
  	"getsockname",		/* 150 = getsockname */
  };
  #endif
--- 150,171 ----
  	"mkdir",		/* 136 = mkdir */
  	"rmdir",		/* 137 = rmdir */
  	"utimes",		/* 138 = utimes */
! 	"#139",			/* 139 = unused */
  	"adjtime",		/* 140 = adjtime */
  	"getpeername",		/* 141 = getpeername */
! 	"gethostid",		/* 142 = gethostid COMPAT-43 */
! 	"sethostid",		/* 143 = sethostid COMPAT-43 */
  	"getrlimit",		/* 144 = getrlimit */
  	"setrlimit",		/* 145 = setrlimit */
  	"killpg",		/* 146 = killpg */
! 	"#147",			/* 147 = unused */
  	"setquota",		/* 148 = setquota */
  	"quota",		/* 149 = quota */
  	"getsockname",		/* 150 = getsockname */
+ 	"#151",			/* 151 = unused */
+ 	"nostk",		/* 152 = nostk */
+ 	"fetchi",		/* 153 = fetchi */
+ 	"ucall",		/* 154 = ucall */
+ 	"fperr",		/* 155 = fperr */
  };
  #endif
*** /usr/src/sys/sys/kern_synch.c.old	Fri Feb 14 22:00:29 1997
--- /usr/src/sys/sys/kern_synch.c	Fri Aug 29 13:04:11 1997
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)kern_synch.c	1.3 (2.11BSD GTE) 1997/2/14
   */
  
  #include "param.h"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)kern_synch.c	1.4 (2.11BSD GTE) 1997/8/29
   */
  
  #include "param.h"
***************
*** 37,43 ****
  		if (p->p_time != 127)
  			p->p_time++;
  		/*
! 		 * this is where 2.10 does its real time alarms.  4.X uses
  		 * timeouts, since it offers better than second resolution.
  		 * Putting it here allows us to continue using use an int
  		 * to store the number of ticks in the callout structure,
--- 37,43 ----
  		if (p->p_time != 127)
  			p->p_time++;
  		/*
! 		 * this is where 2.11 does its real time alarms.  4.X uses
  		 * timeouts, since it offers better than second resolution.
  		 * Putting it here allows us to continue using use an int
  		 * to store the number of ticks in the callout structure,
*** /usr/src/sys/sys/init_main.c.old	Fri Feb 14 21:28:24 1997
--- /usr/src/sys/sys/init_main.c	Fri Aug 29 23:11:47 1997
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)init_main.c	2.3 (2.11BSD GTE) 1997/2/24
   */
  
  #include "param.h"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)init_main.c	2.4 (2.11BSD GTE) 1997/8/29
   */
  
  #include "param.h"
***************
*** 84,89 ****
--- 84,93 ----
  	for (i = 0; i < sizeof(u.u_rlimit)/sizeof(u.u_rlimit[0]); i++)
  		u.u_rlimit[i].rlim_cur = u.u_rlimit[i].rlim_max = 
  		    RLIM_INFINITY;
+ 
+ 	/* Initialize signal state for process 0 */
+ 	siginit(p);
+ 
  	/*
  	 * Initialize tables, protocols, and set up well-known inodes.
  	 */
*** /usr/src/sys/sys/kern_sysctl.c.old	Fri Feb 14 21:26:08 1997
--- /usr/src/sys/sys/kern_sysctl.c	Tue Sep  2 20:22:34 1997
***************
*** 33,39 ****
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   *
!  *	@(#)kern_sysctl.c	8.4.6 (2.11BSD GTE) 1997/2/14
   */
  
  /*
--- 33,39 ----
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   *
!  *	@(#)kern_sysctl.c	8.4.7 (2.11BSD GTE) 1997/9/2
   */
  
  /*
***************
*** 979,986 ****
   *
   * XXX - We rely on the fact that u_ttyp, u_ttyd, and u_ruid are all within
   * XXX - the first 1kb of the u area.  If this ever changes the logic below
!  * XXX - will break (and badly).  At the present time (1/19/95) the u area
!  * XXX - is 934 bytes long.
  */
  
  fill_from_u(p, rup, ttp, tdp)
--- 979,986 ----
   *
   * XXX - We rely on the fact that u_ttyp, u_ttyd, and u_ruid are all within
   * XXX - the first 1kb of the u area.  If this ever changes the logic below
!  * XXX - will break (and badly).  At the present time (97/9/2) the u area
!  * XXX - is 856 bytes long.
  */
  
  fill_from_u(p, rup, ttp, tdp)
*** /usr/src/sys/pdp/kern_pdp.c.old	Mon Jul  4 12:40:27 1988
--- /usr/src/sys/pdp/kern_pdp.c	Wed Aug 27 08:43:40 1997
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)kern_pdp.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  #include "param.h"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)kern_pdp.c	1.2 (2.11BSD) 1997/8/27
   */
  
  #include "param.h"
***************
*** 81,96 ****
  		u.u_procp->p_flag |= SULOCK;
  	else
  		u.u_procp->p_flag &= ~SULOCK;
- }
- 
- gldav()
- {
- 	struct a {
- 		short	*ptr;
- 	};
- 
- 	u.u_error = copyout((caddr_t)avenrun,
- 		(caddr_t)(((struct a *)u.u_ap)->ptr),3 * sizeof(short));
  }
  
  /*
--- 81,86 ----
*** /usr/src/sys/h/signal.h.old	Sat May 16 11:29:23 1987
--- /usr/src/sys/h/signal.h	Tue Sep  2 18:59:26 1997
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)signal.h	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  #ifndef	NSIG
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)signal.h	1.2 (2.11BSD) 1997/8/28
   */
  
  #ifndef	NSIG
***************
*** 14,21 ****
  #define	SIGQUIT	3	/* quit */
  #define	SIGILL	4	/* illegal instruction (not reset when caught) */
  #define	    ILL_RESAD_FAULT	0x0	/* reserved addressing fault */
- #define	    ILL_PRIVIN_FAULT	0x1	/* privileged instruction fault */
- #define	    ILL_RESOP_FAULT	0x2	/* reserved operand fault */
  /* CHME, CHMS, CHMU are not yet given back to users reasonably */
  #define	SIGTRAP	5	/* trace trap (not reset when caught) */
  #define	SIGIOT	6	/* IOT instruction */
--- 14,19 ----
***************
*** 22,43 ****
  #define	SIGABRT	SIGIOT	/* compatibility */
  #define	SIGEMT	7	/* EMT instruction */
  #define	SIGFPE	8	/* floating point exception */
- #define	    FPE_INTOVF_TRAP	0x1	/* integer overflow */
- #define	    FPE_INTDIV_TRAP	0x2	/* integer divide by zero */
- #define	    FPE_FLTOVF_TRAP	0x3	/* floating overflow */
- #define	    FPE_FLTDIV_TRAP	0x4	/* floating/decimal divide by zero */
- #define	    FPE_FLTUND_TRAP	0x5	/* floating underflow */
- #define	    FPE_DECOVF_TRAP	0x6	/* decimal overflow */
- #define	    FPE_SUBRNG_TRAP	0x7	/* subscript out of range */
- #define	    FPE_FLTOVF_FAULT	0x8	/* floating overflow fault */
- #define	    FPE_FLTDIV_FAULT	0x9	/* divide by zero floating fault */
- #define	    FPE_FLTUND_FAULT	0xa	/* floating underflow fault */
- #ifdef pdp11
- #define     FPE_CRAZY		0xb	/* illegal return code - FPU crazy */
- #define     FPE_OPCODE_TRAP	0xc	/* bad floating point op code */
- #define     FPE_OPERAND_TRAP	0xd	/* bad floating point operand */
- #define     FPE_MAINT_TRAP	0xe	/* maintenance trap */
- #endif
  #define	SIGKILL	9	/* kill (cannot be caught or ignored) */
  #define	SIGBUS	10	/* bus error */
  #define	SIGSEGV	11	/* segmentation violation */
--- 20,25 ----
***************
*** 62,72 ****
--- 44,95 ----
  #define SIGUSR1 30	/* user defined signal 1 */
  #define SIGUSR2 31	/* user defined signal 2 */
  
+ #define	SIG_ERR		(int (*)())-1
+ #define	SIG_DFL		(int (*)())0
+ #define	SIG_IGN		(int (*)())1
+ 
  #ifndef KERNEL
  int	(*signal())();
  #endif
  
+ typedef unsigned long sigset_t;
+ 
  /*
+  * Signal vector "template" used in sigaction call.
+  */
+ struct	sigaction {
+ 	int	(*sa_handler)();	/* signal handler */
+ 	sigset_t sa_mask;		/* signal mask to apply */
+ 	int	sa_flags;		/* see signal options below */
+ };
+ 
+ #define SA_ONSTACK	0x0001	/* take signal on signal stack */
+ #define SA_RESTART	0x0002	/* restart system on signal return */
+ #define	SA_DISABLE	0x0004	/* disable taking signals on alternate stack */
+ #define SA_NOCLDSTOP	0x0008	/* do not generate SIGCHLD on child stop */
+ 
+ /*
+  * Flags for sigprocmask:
+  */
+ #define	SIG_BLOCK	1	/* block specified signal set */
+ #define	SIG_UNBLOCK	2	/* unblock specified signal set */
+ #define	SIG_SETMASK	3	/* set specified signal set */
+ 
+ typedef	int (*sig_t)();		/* type of signal function */
+ 
+ /*
+  * Structure used in sigaltstack call.
+  */
+ struct	sigaltstack {
+ 	char	*ss_base;		/* signal stack base */
+ 	int	ss_size;		/* signal stack length */
+ 	int	ss_flags;		/* SA_DISABLE and/or SA_ONSTACK */
+ };
+ #define	MINSIGSTKSZ	128			/* minimum allowable stack */
+ #define	SIGSTKSZ	(MINSIGSTKSZ + 384)	/* recommended stack size */
+ 
+ /*
+  * 4.3 compatibility:
   * Signal vector "template" used in sigvec call.
   */
  struct	sigvec {
***************
*** 74,84 ****
  	long	sv_mask;		/* signal mask to apply */
  	int	sv_flags;		/* see signal options below */
  };
! #define SV_ONSTACK	0x0001	/* take signal on signal stack */
! #define SV_INTERRUPT	0x0002	/* do not restart system on signal return */
! #define sv_onstack sv_flags	/* isn't compatibility wonderful! */
  
  /*
   * Structure used in sigstack call.
   */
  struct	sigstack {
--- 97,108 ----
  	long	sv_mask;		/* signal mask to apply */
  	int	sv_flags;		/* see signal options below */
  };
! #define SV_ONSTACK	SA_ONSTACK	/* take signal on signal stack */
! #define SV_INTERRUPT	SA_RESTART	/* same bit, opposite sense */
! #define sv_onstack sv_flags		/* isn't compatibility wonderful! */
  
  /*
+  * 4.3 compatibility:
   * Structure used in sigstack call.
   */
  struct	sigstack {
***************
*** 105,126 ****
  	int	sc_ovno			/* overlay to restore */
  };
  
- #define	BADSIG		(int (*)())-1
- #define	SIG_DFL		(int (*)())0
- #define	SIG_IGN		(int (*)())1
- 
- #ifdef KERNEL
- #define	SIG_CATCH	(int (*)())2
- #define	SIG_HOLD	(int (*)())3
- #endif
- #endif
- 
  /*
   * Macro for converting signal number to a mask suitable for
   * sigblock().
   */
! #define sigmask(m)	((long)1 << ((m)-1))
  
  #ifndef KERNEL
  extern long	sigblock(), sigsetmask();
  #endif
--- 129,148 ----
  	int	sc_ovno			/* overlay to restore */
  };
  
  /*
   * Macro for converting signal number to a mask suitable for
   * sigblock().
   */
! #define sigmask(m)		(1L << ((m)-1))
! #define sigaddset(set, signo)	(*(set) |= 1L << ((signo) - 1), 0)
! #define sigdelset(set, signo)	(*(set) &= ~(1L << ((signo) - 1)), 0)
! #define sigemptyset(set)	(*(set) = (sigset_t)0, (int)0)
! #define sigfillset(set)         (*(set) = ~(sigset_t)0, (int)0)
! #define sigismember(set, signo) ((*(set) & (1L << ((signo) - 1))) != 0)
  
  #ifndef KERNEL
  extern long	sigblock(), sigsetmask();
+ #define	BADSIG	SIG_ERR
  #endif
+ 
+ #endif /* NSIG */
*** /usr/src/sys/h/user.h.old	Thu Jan 30 15:42:01 1997
--- /usr/src/sys/h/user.h	Tue Sep  2 19:00:10 1997
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)user.h	1.3 (2.11BSD) 1997/1/30
   */
  
  #ifdef KERNEL
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)user.h	1.4 (2.11BSD) 1997/8/28
   */
  
  #ifdef KERNEL
***************
*** 97,105 ****
  	long	u_sigintr;		/* signals that interrupt syscalls */
  	long	u_oldmask;		/* saved mask from before sigpause */
  	int	u_code;			/* ``code'' to trap */
! 	struct	sigstack u_sigstack;	/* sp & on stack state variable */
! #define	u_onstack	u_sigstack.ss_onstack
! #define	u_sigsp		u_sigstack.ss_sp
  
  /* 1.4 - descriptor management */
  	struct	file *u_ofile[NOFILE];	/* file structures for open files */
--- 97,105 ----
  	long	u_sigintr;		/* signals that interrupt syscalls */
  	long	u_oldmask;		/* saved mask from before sigpause */
  	int	u_code;			/* ``code'' to trap */
! 	char	dummy2;			/* Room for another flags byte */
! 	char	u_psflags;		/* Process Signal flags */
! 	struct	sigaltstack u_sigstk;	/* signal stack info */
  
  /* 1.4 - descriptor management */
  	struct	file *u_ofile[NOFILE];	/* file structures for open files */
***************
*** 138,143 ****
--- 138,144 ----
  		ino_t nc_inumber;	/* inum of cached directory */
  		dev_t nc_dev;		/* dev of cached directory */
  	} u_ncache;
+ 	char	u_login[MAXLOGNAME];	/* future use (setlogin/getlogin) */
  	short	u_stack[1];		/* kernel stack per user
  					 * extends from u + USIZE*64
  					 * backward not to reach here
*** /usr/src/sys/h/proc.h.old	Fri Jan 20 19:47:54 1995
--- /usr/src/sys/h/proc.h	Tue Sep  2 21:50:34 1997
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)proc.h	1.2 (2.11BSD GTE) 1/18/95
   */
  
  #ifndef	_SYS_PROC_H_
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)proc.h	1.3 (2.11BSD GTE) 1997/8/28
   */
  
  #ifndef	_SYS_PROC_H_
***************
*** 111,131 ****
  #define	SSTOP	6		/* process being traced */
  
  /* flag codes */
! #define	SLOAD	0x000001	/* in core */
! #define	SSYS	0x000002	/* swapper or pager process */
! #define	SLOCK	0x000004	/* process being swapped out */
! #define	SSWAP	0x000008	/* save area flag */
! #define	STRC	0x000010	/* process is being traced */
! #define	SWTED	0x000020	/* another tracing flag */
! #define	SULOCK	0x000040	/* user settable lock in core */
! #define	SOMASK	0x000080	/* restore old mask after taking signal */
! #define	SVFORK	0x000100	/* process resulted from vfork() */
! #define	SVFPRNT	0x000200	/* parent in vfork, waiting for child */
! #define	SVFDONE	0x000400	/* parent has released child in vfork */
! #define	STIMO	0x000800	/* timing out during sleep */
! #define	SDETACH	0x001000	/* detached inherited by init */
! #define	SOUSIG	0x002000	/* using old signal mechanism */
! #define	SSEL	0x004000	/* selecting; wakeup/waiting danger */
  
  #define	S_DATA	0		/* specified segment */
  #define	S_STACK	1
--- 111,132 ----
  #define	SSTOP	6		/* process being traced */
  
  /* flag codes */
! #define	SLOAD		0x0001	/* in core */
! #define	SSYS		0x0002	/* swapper or pager process */
! #define	SLOCK		0x0004	/* process being swapped out */
! #define	SSWAP		0x0008	/* save area flag */
! #define	STRC		0x0010	/* process is being traced */
! #define	SWTED		0x0020	/* another tracing flag */
! #define	SULOCK		0x0040	/* user settable lock in core */
! 	/*		0x0080	/* used to be SOMASK */
! #define	SVFORK		0x0100	/* process resulted from vfork() */
! #define	SVFPRNT		0x0200	/* parent in vfork, waiting for child */
! #define	SVFDONE		0x0400	/* parent has released child in vfork */
! 	/*		0x0800	/* unused */
! #define	SDETACH		0x1000	/* detached inherited by init */
! #define	P_NOCLDSTOP	0x2000	/* no SIGCHLD signal to parent */
! #define	SSEL		0x4000	/* selecting; wakeup/waiting danger */
! 	/*		0x8000	/* unused */
  
  #define	S_DATA	0		/* specified segment */
  #define	S_STACK	1
*** /usr/src/sys/h/param.h.old	Sun Dec 24 12:21:53 1995
--- /usr/src/sys/h/param.h	Tue Sep  2 19:03:42 1997
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)param.h	1.4 (2.11BSD GTE) 1995/12/24
   */
  
  #define	BSD	211		/* 2.11 * 10, as cpp doesn't do floats */
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)param.h	1.5 (2.11BSD GTE) 1997/9/2
   */
  
  #define	BSD	211		/* 2.11 * 10, as cpp doesn't do floats */
***************
*** 140,142 ****
--- 140,147 ----
   * MAXMEM is the maximum core per process is allowed.  First number is Kb.
  */
  #define	MAXMEM		(300*16)
+ 
+ /*
+  * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
+  */
+ #define	MAXLOGNAME	16		/* max login name length */
*** /usr/src/sys/pdp/machdep.c.old	Mon Nov 27 20:01:26 1995
--- /usr/src/sys/pdp/machdep.c	Sat Aug 30 16:22:55 1997
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)machdep.c	2.2 (2.11BSD) 1995/11/22
   */
  
  #include "param.h"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)machdep.c	2.3 (2.11BSD) 1997/8/26
   */
  
  #include "param.h"
***************
*** 10,15 ****
--- 10,16 ----
  #include "../machine/psl.h"
  #include "../machine/reg.h"
  
+ #include "signalvar.h"
  #include "user.h"
  #include "proc.h"
  #include "buf.h"
***************
*** 56,84 ****
  	int oonstack;
  	caddr_t n;
  
  	regs = u.u_ar0;
! 	oonstack = u.u_onstack;
  	/*
  	 * Allocate and validate space for the signal frame.
  	 */
! 	if (!u.u_onstack && (u.u_sigonstack & sigmask(sig))) {
! 		n = (caddr_t)((struct sigframe *)u.u_sigsp - 1);
! 		u.u_onstack = 1;
! 	} else
! 		n = (caddr_t)((struct sigframe *)regs[R6] - 1);
! 	if (!u.u_onstack && n < (caddr_t)-ctob(u.u_ssize) && !grow(n)) {
  		/*
! 		 * Process has trashed its stack; give it an segment
! 		 * violation to halt it in its tracks.
  		 */
! 		u.u_signal[SIGILL] = SIG_DFL;
! 		mask = sigmask(SIGILL);
! 		u.u_procp->p_sigignore &= ~mask;
! 		u.u_procp->p_sigcatch &= ~mask;
! 		u.u_procp->p_sigmask &= ~mask;
! 		psignal(u.u_procp, SIGILL);
  		return;
! 	}
  	/* 
  	 * Build the argument list for the signal handler.
  	 */
--- 57,91 ----
  	int oonstack;
  	caddr_t n;
  
+ #ifdef	DIAGNOSTIC
+ 	printf("sendsig %d to %d mask=%O action=%o\n", sig, u.u_procp->p_pid,
+ 		mask, p);
+ #endif
  	regs = u.u_ar0;
! 	oonstack = u.u_sigstk.ss_flags & SA_ONSTACK;
  	/*
  	 * Allocate and validate space for the signal frame.
  	 */
! 	if	((u.u_psflags & SAS_ALTSTACK) &&
! 		 !(u.u_sigstk.ss_flags & SA_ONSTACK) &&
! 		 (u.u_sigonstack & sigmask(sig)))
! 		{
! 		n = u.u_sigstk.ss_base + u.u_sigstk.ss_size - sizeof (sf);
! 		u.u_sigstk.ss_flags |= SA_ONSTACK;
! 		}
! 	else
! 		n = (caddr_t)regs[R6] - sizeof (sf);
! 	if	(!(u.u_sigstk.ss_flags & SA_ONSTACK) && 
! 		 n < (caddr_t)-ctob(u.u_ssize) && 
! 		 !grow(n))
! 		{
  		/*
! 		 * Process has trashed its stack; give it an illegal
! 		 * instruction violation to halt it in its tracks.
  		 */
! 		fatalsig(SIGILL);
  		return;
! 		}
  	/* 
  	 * Build the argument list for the signal handler.
  	 */
***************
*** 136,144 ****
  		return;
  	}
  	u.u_eosys = JUSTRETURN;
! 	u.u_onstack = scp->sc_onstack & 01;
! 	u.u_procp->p_sigmask = scp->sc_mask &~
! 	    (sigmask(SIGKILL)|sigmask(SIGCONT)|sigmask(SIGSTOP));
  	regs[R6] = scp->sc_sp;
  	regs[R5] = scp->sc_fp;
  	regs[R1] = scp->sc_r1;
--- 143,153 ----
  		return;
  	}
  	u.u_eosys = JUSTRETURN;
! 	if	(scp->sc_onstack & SA_ONSTACK)
! 		u.u_sigstk.ss_flags |= SA_ONSTACK;
! 	else
! 		u.u_sigstk.ss_flags &= ~SA_ONSTACK;
! 	u.u_procp->p_sigmask = scp->sc_mask & ~sigcantmask;
  	regs[R6] = scp->sc_sp;
  	regs[R5] = scp->sc_fp;
  	regs[R1] = scp->sc_r1;
*** /usr/src/sys/pdp/trap.c.old	Sat Nov 26 15:05:33 1994
--- /usr/src/sys/pdp/trap.c	Mon Sep  1 18:50:19 1997
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)trap.c	1.4 (2.11BSD GTE) 11/24/94
   */
  
  #include "param.h"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)trap.c	1.5 (2.11BSD GTE) 1997/8/26
   */
  
  #include "param.h"
***************
*** 13,18 ****
--- 13,19 ----
  #include "../machine/trap.h"
  #include "../machine/iopage.h"
  
+ #include "signalvar.h"
  #include "systm.h"
  #include "user.h"
  #include "proc.h"
***************
*** 38,67 ****
  };
  
  /*
-  * Translation table to convert the FP-11 FECs (Floating Exception Codes) to
-  * the various FPE_... codes defined in <signal.h>.  On the VAX these come
-  * free because those *are* the codes the VAX FP hardware generates.
-  */
- static	u_char pdpfec[16] = {
- 	FPE_CRAZY,		/*  0: not a legal FEC code */
- 	FPE_CRAZY,		/*  1: not a legal FEC code */
- 	FPE_OPCODE_TRAP,	/*  2: bad floating point op code */
- 	FPE_CRAZY,		/*  3: not a legal FEC code */
- 	FPE_FLTDIV_TRAP,	/*  4: floating devide by zero */
- 	FPE_CRAZY,		/*  5: not a legal FEC code */
- 	FPE_DECOVF_TRAP,	/*  6: floating to integer conversion error */
- 	FPE_CRAZY,		/*  7: not a legal FEC code */
- 	FPE_FLTOVF_TRAP,	/*  8: floating overflow */
- 	FPE_CRAZY,		/*  9: not a legal FEC code */
- 	FPE_CRAZY,		/* 10: not a legal FEC code */
- 	FPE_FLTUND_TRAP,	/* 11: floating underflow */
- 	FPE_OPERAND_TRAP,	/* 12: bad floating point operand */
- 	FPE_CRAZY,		/* 13: not a legal FEC code */
- 	FPE_MAINT_TRAP,		/* 14: maintenance trap */
- 	FPE_CRAZY,		/* 15: not a legal FEC code */
- };
- 
- /*
   * Called from mch.s when a processor trap occurs.
   * The arguments are the words saved on the system stack
   * by the hardware and software during the trap processing.
--- 39,44 ----
***************
*** 134,145 ****
  		hasmap = 0;
  #endif
  		i = splhigh();
! 		printf("ka6 = %o\n", *ka6);
! 		printf("aps = %o\n", &ps);
! 		printf("pc = %o, ps = %o\n", pc, ps);
! 		printf("__ovno = %d\n", ov);
  		if ((cputype == 70) || (cputype == 44))
! 			printf("cpuerr = %o\n", *CPUERR);
  		printf("trap type %o\n", dev);
  		splx(i);
  		panic("trap");
--- 111,120 ----
  		hasmap = 0;
  #endif
  		i = splhigh();
! 		printf("ka6 %o aps %o\npc %o ps %o\nov %d\n", *ka6, &ps, 
! 			pc, ps, ov);
  		if ((cputype == 70) || (cputype == 44))
! 			printf("cpuerr %o\n", *CPUERR);
  		printf("trap type %o\n", dev);
  		splx(i);
  		panic("trap");
***************
*** 166,172 ****
  				goto out;
  			if (i == SIGTRAP)
  				ps &= ~PSL_T;
! 			u.u_code = pdpfec[(unsigned)u.u_fperr.f_fec & 0xf];
  			break;
  		}
  #endif
--- 141,147 ----
  				goto out;
  			if (i == SIGTRAP)
  				ps &= ~PSL_T;
! 			u.u_code = u.u_fperr.f_fec;
  			break;
  		}
  #endif
***************
*** 209,215 ****
  	case T_ARITHTRAP + USER:
  		i = SIGFPE;
  		stst(&u.u_fperr);	/* save error code and address */
! 		u.u_code = pdpfec[(unsigned)u.u_fperr.f_fec & 0xf];
  		break;
  
  	/*
--- 184,190 ----
  	case T_ARITHTRAP + USER:
  		i = SIGFPE;
  		stst(&u.u_fperr);	/* save error code and address */
! 		u.u_code = u.u_fperr.f_fec;
  		break;
  
  	/*
***************
*** 241,247 ****
  		if (kdj11)
  			osp -= 4;
  		if (backup(u.u_ar0) == 0)
! 			if (!u.u_onstack && grow((u_int)osp))
  				goto out;
  		i = SIGSEGV;
  		break;
--- 216,223 ----
  		if (kdj11)
  			osp -= 4;
  		if (backup(u.u_ar0) == 0)
! 			if (!(u.u_sigstk.ss_flags & SA_ONSTACK) && 
! 					grow((u_int)osp))
  				goto out;
  		i = SIGSEGV;
  		break;
***************
*** 293,302 ****
  			netoff = 1;
  			savestate();
  		}
! 		printf("Unexpected net code trap (%o)\n", dev-SUPV);
! 		printf("ka6 = %o\n", *ka6);
! 		printf("aps = %o\n", &ps);
! 		printf("pc = %o ps = %o\n", pc, ps);
  		splx(i);
  		panic("net crashed");
  		/*NOTREACHED*/
--- 269,277 ----
  			netoff = 1;
  			savestate();
  		}
! 		printf("Unexpected net trap (%o)\n", dev-SUPV);
! 		printf("ka6 %o aps %o\n", *ka6, &ps);
! 		printf("pc %o ps %o\n", pc, ps);
  		splx(i);
  		panic("net crashed");
  		/*NOTREACHED*/
***************
*** 316,322 ****
  		/*FALL THROUGH*/
  	case T_RANDOMTRAP:		/* generated by autoconfig */
  	case T_RANDOMTRAP + USER:
! 		printf("Random interrupt ignored\n");
  		if (!(dev & USER))
  			restormap(kernelmap);
  		return;
--- 291,297 ----
  		/*FALL THROUGH*/
  	case T_RANDOMTRAP:		/* generated by autoconfig */
  	case T_RANDOMTRAP + USER:
! 		printf("Random intr ignored\n");
  		if (!(dev & USER))
  			restormap(kernelmap);
  		return;
***************
*** 324,330 ****
  	psignal(p, i);
  out:
  	if (p->p_cursig || ISSIG(p))
! 		psig();
  	curpri = setpri(p);
  	if (runrun) {
  		setrq(u.u_procp);
--- 299,305 ----
  	psignal(p, i);
  out:
  	if (p->p_cursig || ISSIG(p))
! 		postsig();
  	curpri = setpri(p);
  	if (runrun) {
  		setrq(u.u_procp);
***************
*** 397,403 ****
  	/* else if (u.u_eosys == JUSTRETURN) */
  		/* nothing to do */
  	if (u.u_procp->p_cursig || ISSIG(u.u_procp))
! 		psig();
  	curpri = setpri(u.u_procp);
  	if (runrun) {
  		setrq(u.u_procp);
--- 372,378 ----
  	/* else if (u.u_eosys == JUSTRETURN) */
  		/* nothing to do */
  	if (u.u_procp->p_cursig || ISSIG(u.u_procp))
! 		postsig();
  	curpri = setpri(u.u_procp);
  	if (runrun) {
  		setrq(u.u_procp);
*** /usr/src/sys/pdp/fperr.h.old	Fri Jan  9 01:44:37 1987
--- /usr/src/sys/pdp/fperr.h	Fri Aug 29 19:53:09 1997
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)fperr.h	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)fperr.h	1.2 (2.11BSD) 1997/8/28
   */
  
  /*
***************
*** 13,15 ****
--- 13,33 ----
  	short	f_fec;
  	caddr_t	f_fea;
  };
+ 
+ /*
+  * These are not used any where and are present here merely for reference.
+  * All the of the VAX oriented FP codes were removed from signal.h and the
+  * kernel.  The kernel now passes the unaltered contents of the FEC register to
+  * the application.  The values below were taken from the PDP-11/70 processor
+  * handbook.
+ */
+ 
+ #ifdef	notnow
+ #define	FPE_OPCODE_TRAP	0x2	/* Bad FP opcode */
+ #define	FPE_FLTDIV_TRAP 0x4	/* FP divide by zero */
+ #define	FPE_INTOVF_TRAP	0x6	/* FP to INT overflow */
+ #define	FPE_FLTOVF_TRAP	0x8	/* FP overflow */
+ #define	FPE_FLTUND_TRAP	0xa	/* FP underflow */
+ #define	FPE_UNDEF_TRAP	0xc	/* FP Undefined variable */
+ #define	FPE_MAINT_TRAP	0xe	/* FP Maint trap */
+ #endif /* notnow */
*** /usr/src/sys/GENERIC/Makefile.old	Thu Feb  6 22:38:55 1997
--- /usr/src/sys/GENERIC/Makefile	Fri Aug 29 21:43:48 1997
***************
*** 10,16 ****
  # software without specific prior written permission. This software
  # is provided ``as is'' without express or implied warranty.
  #
! #	2.10 (2.11BSD GTE) 1997/2/6
  #
  #########################################################
  # Non-network, but separate I/D kernel			#
--- 10,16 ----
  # software without specific prior written permission. This software
  # is provided ``as is'' without express or implied warranty.
  #
! #	2.11 (2.11BSD GTE) 1997/8/29
  #
  #########################################################
  # Non-network, but separate I/D kernel			#
***************
*** 64,70 ****
  OV6=	tmscp.o tmscpdump.o
  OV7=	rl.o mch_fpsim.o ingreslock.o ufs_disksubr.o
  OV8=	rx.o kern_sysctl.o vm_sched.o vm_text.o
! OV9=	kern_pdp.o kern_xxx.o ufs_syscalls2.o mem.o ufs_subr.o rk.o sys_pipe.o
  
  KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \
  	${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \
--- 64,71 ----
  OV6=	tmscp.o tmscpdump.o
  OV7=	rl.o mch_fpsim.o ingreslock.o ufs_disksubr.o
  OV8=	rx.o kern_sysctl.o vm_sched.o vm_text.o
! OV9=	kern_pdp.o kern_xxx.o ufs_syscalls2.o mem.o ufs_subr.o rk.o sys_pipe.o \
! 	kern_sig2.o
  
  KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \
  	${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \
*** /usr/src/sys/GENERIC/Make.sys.old	Fri Jan 31 21:03:43 1997
--- /usr/src/sys/GENERIC/Make.sys	Fri Aug 29 19:49:36 1997
***************
*** 9,15 ****
  # software without specific prior written permission. This software
  # is provided ``as is'' without express or implied warranty.
  #
! #	2.4 (2.11BSD GTE) 1997/1/31
  #
  S=	../sys
  VPATH=	../sys
--- 9,15 ----
  # software without specific prior written permission. This software
  # is provided ``as is'' without express or implied warranty.
  #
! #	2.5 (2.11BSD GTE) 1997/8/29
  #
  S=	../sys
  VPATH=	../sys
***************
*** 19,24 ****
--- 19,25 ----
  	${S}/kern_exit.c ${S}/kern_fork.c ${S}/kern_mman.c		\
  	${S}/kern_proc.c ${S}/kern_prot.c ${S}/kern_resource.c		\
  	${S}/kern_sig.c ${S}/kern_subr.c ${S}/kern_sysctl.c		\
+ 	${S}/kern_sig2.c						\
  	${S}/kern_synch.c ${S}/kern_time.c ${S}/kern_xxx.c		\
  	${S}/quota_sys.c ${S}/quota_kern.c ${S}/quota_ufs.c		\
  	${S}/quota_subr.c ${S}/subr_log.c ${S}/subr_prf.c ${S}/subr_rmap.c \
***************
*** 37,42 ****
--- 38,44 ----
  OBJS=	init_main.o init_sysent.o kern_acct.o kern_clock.o		\
  	kern_descrip.o kern_exec.o kern_exit.o kern_fork.o kern_mman.o	\
  	kern_proc.o kern_prot.o kern_resource.o kern_sig.o kern_sysctl.o \
+ 	kern_sig2.o							\
  	kern_subr.o kern_synch.o kern_time.o kern_xxx.o quota_sys.o	\
         quota_kern.o quota_ufs.o quota_subr.o subr_log.o subr_prf.o subr_rmap.o \
  	ingreslock.o							\
