New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'

This commit is contained in:
cgd 1994-06-29 06:29:24 +00:00
parent bb627c6f25
commit cf92afd66e
311 changed files with 9844 additions and 566 deletions

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: adlookup.c,v 1.6 1994/06/27 19:27:39 cgd Exp $ */
/* $NetBSD: adlookup.c,v 1.7 1994/06/29 06:29:24 cgd Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
* All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: adosfs.h,v 1.3 1994/06/27 19:27:40 cgd Exp $ */
/* $NetBSD: adosfs.h,v 1.4 1994/06/29 06:29:27 cgd Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
* All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: adutil.c,v 1.4 1994/06/27 19:27:42 cgd Exp $ */
/* $NetBSD: adutil.c,v 1.5 1994/06/29 06:29:29 cgd Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
* All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: advfsops.c,v 1.3 1994/06/27 19:27:44 cgd Exp $ */
/* $NetBSD: advfsops.c,v 1.4 1994/06/29 06:29:30 cgd Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
* All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: advnops.c,v 1.7 1994/06/27 19:27:46 cgd Exp $ */
/* $NetBSD: advnops.c,v 1.8 1994/06/29 06:29:32 cgd Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
* All rights reserved.

View File

@ -1,7 +1,7 @@
#
# BOAT_ANCHOR -- kernel for the 386-20 the gang uses for testing
#
# $Id: BOAT_ANCHOR,v 1.35 1994/05/21 08:37:31 cgd Exp $
# $Id: BOAT_ANCHOR,v 1.36 1994/06/29 06:29:42 cgd Exp $
#
machine "i386"
cpu "I386_CPU"
@ -15,7 +15,7 @@ options "COMPAT_43"
options "TCP_COMPAT_42"
options XSERVER,UCONSOLE
options "DUMMY_NOPS"
options MSDOSFS
#options MSDOSFS
options KTRACE
options "COMPAT_09"
options "COMPAT_NOMID"

View File

@ -1,7 +1,7 @@
#
# KICKME -- 486Cx-33 development machine.
#
# $Id: KICKME,v 1.10 1994/06/14 05:27:20 cgd Exp $
# $Id: KICKME,v 1.11 1994/06/29 06:29:44 cgd Exp $
#
machine "i386"
@ -11,9 +11,9 @@ timezone 8 dst
maxusers 10
options SWAPPAGER,VNODEPAGER,DEVPAGER
options FFS
options INET,ISOFS,NFSSERVER,NFSCLIENT
options INET,ISOFS,NFSSERVER,NFSCLIENT,NULLFS
options "COMPAT_43"
options MSDOSFS
#options MSDOSFS
options SCSI
options "MATH_EMULATE"
options "COMPAT_NOMID"

View File

@ -1,7 +1,7 @@
#
# PAIN -- kernel for another of cgd's 486/50 EISA boxes...
#
# $Id: PAIN,v 1.33 1994/06/03 20:52:09 cgd Exp $
# $Id: PAIN,v 1.34 1994/06/29 06:29:45 cgd Exp $
#
machine "i386"
cpu "I486_CPU"
@ -45,8 +45,9 @@ options USER_LDT
options FFS
options MFS
options NFSSERVER,NFSCLIENT
options MSDOSFS,ISOFS
options FDESC,FIFO,KERNFS,LOFS,PORTAL,PROCFS
#options MSDOSFS
options ISOFS,NULLFS
options FDESC,FIFO,KERNFS,PORTAL,PROCFS
# and even UFS quotas
options QUOTA

View File

@ -1,7 +1,7 @@
#
# SUN_LAMP -- kernel for one of cgd's 486/50 EISA boxes...
#
# $Id: SUN_LAMP,v 1.47 1994/06/03 20:28:48 cgd Exp $
# $Id: SUN_LAMP,v 1.48 1994/06/29 06:29:47 cgd Exp $
#
machine "i386"
cpu "I486_CPU"
@ -10,7 +10,7 @@ timezone 8 dst
maxusers 24
options SWAPPAGER,VNODEPAGER,DEVPAGER
options FFS
options INET,NFSSERVER,NFSCLIENT,MFS,ISOFS,LOFS
options INET,NFSSERVER,NFSCLIENT,MFS,ISOFS,NULLFS
options "COMPAT_43"
options "TCP_COMPAT_42"
options UCONSOLE, XSERVER

View File

@ -1,3 +1,5 @@
/* $NetBSD: exec.h,v 1.3 1994/06/29 06:30:07 cgd Exp $ */
/*
* Copyright (c) 1993 Theo de Raadt
* All rights reserved.
@ -23,8 +25,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: exec.h,v 1.2 1994/01/28 23:46:30 jtc Exp $
*/
#ifndef _SUNOS_EXEC_H_

View File

@ -1,6 +1,7 @@
#! /bin/sh -
# from: @(#)makesyscalls.sh 8.1 (Berkeley) 6/11/93
# $Id: makesyscalls.sh,v 1.6 1994/05/01 06:14:04 cgd Exp $
# $NetBSD: makesyscalls.sh,v 1.7 1994/06/29 06:30:12 cgd Exp $
#
# @(#)makesyscalls.sh 8.1 (Berkeley) 6/11/93
set -e
@ -49,17 +50,17 @@ awk < $1 "
printf " * DO NOT EDIT-- this file is automatically generated.\n" > syshdr
}
NR == 1 {
printf " * created from: %s %s %s %s\n */\n\n",$2,$3,$4,$5 > sysdcl
printf " * created from: %s %s %s %s\n */\n\n",$1,$3,$4,$5,$6 > sysdcl
printf "#include <sys/param.h>\n" > sysdcl
printf "#include <sys/systm.h>\n\n" > sysdcl
printf "int\tnosys();\n\n" > sysdcl
printf "struct sysent sun_sysent[] = {\n" > sysent
printf " * created from: %s %s %s %s\n */\n\n",$2,$3,$4,$5 > sysnames
printf " * created from: %s %s %s %s\n */\n\n",$1,$3,$4,$5,$6 > sysnames
printf "char *sun_syscallnames[] = {\n" > sysnames
printf " * created from: %s %s %s %s\n */\n\n",$2,$3,$4,$5 > syshdr
printf " * created from: %s %s %s %s\n */\n\n",$1,$3,$4,$5,$6 > syshdr
next
}
NF == 0 || $1 ~ /^;/ {

View File

@ -1,3 +1,5 @@
/* $NetBSD: sun_exec.c,v 1.5 1994/06/29 06:30:14 cgd Exp $ */
/*
* Copyright (c) 1993 Theo de Raadt
* All rights reserved.
@ -23,8 +25,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: sun_exec.c,v 1.4 1994/01/28 23:46:34 jtc Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: sun_ioctl.c,v 1.11 1994/06/29 06:30:16 cgd Exp $ */
/*
* Copyright (c) 1993 Markus Wild.
* All rights reserved.
@ -22,7 +24,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* loosely from: Header: sun_ioctl.c,v 1.7 93/05/28 04:40:43 torek Exp
* $Id: sun_ioctl.c,v 1.10 1994/05/21 08:22:08 deraadt Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: sun_misc.c,v 1.30 1994/06/29 06:30:20 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@ -41,8 +43,7 @@
*
* @(#)sun_misc.c 8.1 (Berkeley) 6/18/93
*
* from: Header: sun_misc.c,v 1.16 93/04/07 02:46:27 torek Exp
* $Id: sun_misc.c,v 1.29 1994/06/22 08:24:53 pk Exp $
* Header: sun_misc.c,v 1.16 93/04/07 02:46:27 torek Exp
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: sunos_exec.c,v 1.5 1994/06/29 06:30:14 cgd Exp $ */
/*
* Copyright (c) 1993 Theo de Raadt
* All rights reserved.
@ -23,8 +25,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: sunos_exec.c,v 1.4 1994/01/28 23:46:34 jtc Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: sunos_ioctl.c,v 1.11 1994/06/29 06:30:16 cgd Exp $ */
/*
* Copyright (c) 1993 Markus Wild.
* All rights reserved.
@ -22,7 +24,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* loosely from: Header: sun_ioctl.c,v 1.7 93/05/28 04:40:43 torek Exp
* $Id: sunos_ioctl.c,v 1.10 1994/05/21 08:22:08 deraadt Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: sunos_misc.c,v 1.30 1994/06/29 06:30:20 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@ -41,8 +43,7 @@
*
* @(#)sun_misc.c 8.1 (Berkeley) 6/18/93
*
* from: Header: sun_misc.c,v 1.16 93/04/07 02:46:27 torek Exp
* $Id: sunos_misc.c,v 1.29 1994/06/22 08:24:53 pk Exp $
* Header: sun_misc.c,v 1.16 93/04/07 02:46:27 torek Exp
*/
/*

View File

@ -1,5 +1,5 @@
$Id: syscalls.master,v 1.16 1994/06/14 10:51:12 chopps Exp $
; from: @(#)syscalls.master 8.1 (Berkeley) 7/19/93
$NetBSD: syscalls.master,v 1.17 1994/06/29 06:30:25 cgd Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
; System call name/number master file (or rather, slave, from SunOS).
; Processed to created sun_sysent.c, sun_syscalls.c and sun_syscall.h.

View File

@ -1,3 +1,5 @@
/* $NetBSD: exec.h,v 1.2 1994/06/29 06:30:27 cgd Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
* All rights reserved.
@ -23,8 +25,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: exec.h,v 1.1 1994/05/22 10:04:26 deraadt Exp $
*/
#ifndef _SVR4_EXEC_H_

View File

@ -1,6 +1,7 @@
#! /bin/sh -
# from: @(#)makesyscalls.sh 8.1 (Berkeley) 6/11/93
# $Id: makesyscalls.sh,v 1.1 1994/05/22 10:04:28 deraadt Exp $
# $NetBSD: makesyscalls.sh,v 1.2 1994/06/29 06:30:30 cgd Exp $
#
# @(#)makesyscalls.sh 8.1 (Berkeley) 6/11/93
set -e
@ -49,17 +50,17 @@ awk < $1 "
printf " * DO NOT EDIT-- this file is automatically generated.\n" > syshdr
}
NR == 1 {
printf " * created from: %s %s %s %s\n */\n\n",$2,$3,$4,$5 > sysdcl
printf " * created from: %s %s %s %s\n */\n\n",$1,$3,$4,$5,$6 > sysdcl
printf "#include <sys/param.h>\n" > sysdcl
printf "#include <sys/systm.h>\n\n" > sysdcl
printf "int\tnosys();\n\n" > sysdcl
printf "struct sysent svr4_sysent[] = {\n" > sysent
printf " * created from: %s %s %s %s\n */\n\n",$2,$3,$4,$5 > sysnames
printf " * created from: %s %s %s %s\n */\n\n",$1,$3,$4,$5,$6 > sysnames
printf "char *svr4_syscallnames[] = {\n" > sysnames
printf " * created from: %s %s %s %s\n */\n\n",$2,$3,$4,$5 > syshdr
printf " * created from: %s %s %s %s\n */\n\n",$1,$3,$4,$5,$6 > syshdr
next
}
NF == 0 || $1 ~ /^;/ {

View File

@ -1,3 +1,5 @@
/* $NetBSD: svr4_exec.c,v 1.2 1994/06/29 06:30:31 cgd Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
* All rights reserved.
@ -23,8 +25,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: svr4_exec.c,v 1.1 1994/05/22 10:04:31 deraadt Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: svr4_ioctl.c,v 1.2 1994/06/29 06:30:33 cgd Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
* All rights reserved.
@ -20,8 +22,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: svr4_ioctl.c,v 1.1 1994/05/22 10:04:33 deraadt Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: svr4_misc.c,v 1.5 1994/06/29 06:30:35 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@ -42,7 +44,6 @@
* from: Header: sun_misc.c,v 1.16 93/04/07 02:46:27 torek Exp
*
* @(#)sun_misc.c 8.1 (Berkeley) 6/18/93
* $Id: svr4_misc.c,v 1.4 1994/06/24 07:30:17 deraadt Exp $
*/
/*

View File

@ -1,5 +1,5 @@
$Id: syscalls.master,v 1.1 1994/05/22 10:04:45 deraadt Exp $
; from: @(#)syscalls.master 8.1 (Berkeley) 7/19/93
$NetBSD: syscalls.master,v 1.2 1994/06/29 06:30:37 cgd Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
; System call name/number master file (or rather, slave, from SunOS).
; Processed to created svr4_sysent.c, svr4_syscalls.c and svr4_syscall.h.

View File

@ -1,6 +1,7 @@
#! /bin/sh -
# from: @(#)makesyscalls.sh 8.1 (Berkeley) 6/11/93
# $Id: makesyscalls.sh,v 1.2 1994/06/15 05:18:01 glass Exp $
# $NetBSD: makesyscalls.sh,v 1.3 1994/06/29 06:30:39 cgd Exp $
#
# @(#)makesyscalls.sh 8.1 (Berkeley) 6/11/93
set -e
@ -49,17 +50,17 @@ awk < $1 "
printf " * DO NOT EDIT-- this file is automatically generated.\n" > syshdr
}
NR == 1 {
printf " * created from: %s %s %s %s\n */\n\n",$2,$3,$4,$5 > sysdcl
printf " * created from: %s %s %s %s\n */\n\n",$1,$3,$4,$5,$6 > sysdcl
printf "#include <sys/param.h>\n" > sysdcl
printf "#include <sys/systm.h>\n\n" > sysdcl
printf "int\tnosys();\n\n" > sysdcl
printf "struct sysent ultrix_sysent[] = {\n" > sysent
printf " * created from: %s %s %s %s\n */\n\n",$2,$3,$4,$5 > sysnames
printf " * created from: %s %s %s %s\n */\n\n",$1,$3,$4,$5,$6 > sysnames
printf "char *ultrix_syscallnames[] = {\n" > sysnames
printf " * created from: %s %s %s %s\n */\n\n",$2,$3,$4,$5 > syshdr
printf " * created from: %s %s %s %s\n */\n\n",$1,$3,$4,$5,$6 > syshdr
next
}
NF == 0 || $1 ~ /^;/ {

View File

@ -1,5 +1,5 @@
$Id: syscalls.master,v 1.3 1994/06/22 03:37:15 glass Exp $
; from: @(#)syscalls.master 8.1 (Berkeley) 7/19/93
$NetBSD: syscalls.master,v 1.4 1994/06/29 06:30:40 cgd Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
; System call name/number master file (or rather, slave, from SunOS).
; Processed to created sun_sysent.c, sun_syscalls.c and sun_syscall.h.

View File

@ -1,3 +1,5 @@
/* $NetBSD: ultrix_misc.c,v 1.5 1994/06/29 06:30:42 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@ -39,10 +41,10 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*
* @(#)sun_misc.c 8.1 (Berkeley) 6/18/93
*
* from: Header: sun_misc.c,v 1.16 93/04/07 02:46:27 torek Exp
* $Id: ultrix_misc.c,v 1.4 1994/06/25 07:06:49 glass Exp $
*/
/*

View File

@ -1,4 +1,5 @@
# NetBSD $Id: files,v 1.54 1994/06/27 19:44:02 cgd Exp $
# $NetBSD: files,v 1.55 1994/06/29 06:30:45 cgd Exp $
#
adosfs/adlookup.c optional adosfs
adosfs/adutil.c optional adosfs
adosfs/advfsops.c optional adosfs

View File

@ -1,4 +1,5 @@
# NetBSD $Id: files.newconf,v 1.31 1994/06/27 19:44:04 cgd Exp $
# $NetBSD: files.newconf,v 1.32 1994/06/29 06:30:47 cgd Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
# generic attributes

View File

@ -1,4 +1,5 @@
# NetBSD $Id: files.oldconf,v 1.54 1994/06/27 19:44:02 cgd Exp $
# $NetBSD: files.oldconf,v 1.55 1994/06/29 06:30:45 cgd Exp $
#
adosfs/adlookup.c optional adosfs
adosfs/adutil.c optional adosfs
adosfs/advfsops.c optional adosfs

View File

@ -1,5 +1,6 @@
#!/bin/sh -
# NetBSD $Id: newvers.sh,v 1.15 1994/06/27 19:44:05 cgd Exp $
#
# $NetBSD: newvers.sh,v 1.16 1994/06/29 06:30:49 cgd Exp $
#
# Copyright (c) 1984, 1986, 1990, 1993
# The Regents of the University of California. All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: param.c,v 1.10 1994/06/27 19:44:07 cgd Exp $ */
/* $NetBSD: param.c,v 1.11 1994/06/29 06:30:52 cgd Exp $ */
/*
* Copyright (c) 1980, 1986, 1989 Regents of the University of California.
* All rights reserved.

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_access.c,v 1.5 1994/06/29 06:30:55 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_access.c,v 1.4 1994/01/31 23:55:06 mycroft Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_access.h,v 1.4 1994/06/29 06:30:56 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_access.h,v 1.3 1994/02/15 14:50:41 mycroft Exp $
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_aout.c,v 1.11 1994/06/29 06:30:57 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -22,8 +24,6 @@
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: db_aout.c,v 1.10 1994/06/03 01:58:32 gwr Exp $
*/
#include <sys/types.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_break.c,v 1.4 1994/06/29 06:30:59 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_break.c,v 1.3 1993/12/18 04:46:28 mycroft Exp $
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_break.h,v 1.5 1994/06/29 06:31:00 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_break.h,v 1.4 1994/02/15 14:50:42 mycroft Exp $
*/
#ifndef _DDB_DB_BREAK_H_

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_command.c,v 1.12 1994/06/29 06:31:01 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -22,8 +24,6 @@
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: db_command.c,v 1.11 1994/04/27 10:49:07 pk Exp $
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_command.h,v 1.5 1994/06/29 06:31:03 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_command.h,v 1.4 1994/03/23 20:00:57 pk Exp $
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_examine.c,v 1.4 1994/06/29 06:31:05 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_examine.c,v 1.3 1993/12/18 04:46:31 mycroft Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_expr.c,v 1.4 1994/06/29 06:31:06 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_expr.c,v 1.3 1993/12/18 04:46:32 mycroft Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_input.c,v 1.4 1994/06/29 06:31:08 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_input.c,v 1.3 1993/12/18 04:46:33 mycroft Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_lex.c,v 1.4 1994/06/29 06:31:10 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_lex.c,v 1.3 1993/12/18 04:46:34 mycroft Exp $
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_lex.h,v 1.4 1994/06/29 06:31:11 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_lex.h,v 1.3 1994/02/15 14:50:44 mycroft Exp $
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_output.c,v 1.7 1994/06/29 06:31:12 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -22,8 +24,6 @@
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: db_output.c,v 1.6 1993/12/18 04:46:35 mycroft Exp $
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_output.h,v 1.4 1994/06/29 06:31:14 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 8/90
* $Id: db_output.h,v 1.3 1994/02/15 14:50:45 mycroft Exp $
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_print.c,v 1.4 1994/06/29 06:31:15 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_print.c,v 1.3 1993/12/18 04:46:36 mycroft Exp $
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_run.c,v 1.5 1994/06/29 06:31:16 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_run.c,v 1.4 1993/12/18 04:46:37 mycroft Exp $
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_sym.c,v 1.7 1994/06/29 06:31:18 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -22,8 +24,6 @@
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: db_sym.c,v 1.6 1993/12/18 04:46:39 mycroft Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_sym.h,v 1.5 1994/06/29 06:31:19 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: Alessandro Forin, Carnegie Mellon University
* Date: 8/90
* $Id: db_sym.h,v 1.4 1994/02/15 14:50:46 mycroft Exp $
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_trap.c,v 1.5 1994/06/29 06:31:22 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_trap.c,v 1.4 1994/04/04 08:59:38 mycroft Exp $
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_variables.c,v 1.6 1994/06/29 06:31:23 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -22,8 +24,6 @@
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: db_variables.c,v 1.5 1993/12/18 04:46:42 mycroft Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_variables.h,v 1.4 1994/06/29 06:31:24 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_variables.h,v 1.3 1994/02/15 14:50:47 mycroft Exp $
*/
#ifndef _DB_VARIABLES_H_

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_watch.c,v 1.5 1994/06/29 06:31:26 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: Richard P. Draves, Carnegie Mellon University
* Date: 10/90
* $Id: db_watch.c,v 1.4 1994/01/08 01:01:51 mycroft Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_watch.h,v 1.5 1994/06/29 06:31:27 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 10/90
* $Id: db_watch.h,v 1.4 1994/02/15 14:50:47 mycroft Exp $
*/
#ifndef _DDB_DB_WATCH_

View File

@ -1,3 +1,5 @@
/* $NetBSD: db_write_cmd.c,v 1.4 1994/06/29 06:31:28 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
@ -25,7 +27,6 @@
*
* Author: David B. Golub, Carnegie Mellon University
* Date: 7/90
* $Id: db_write_cmd.c,v 1.3 1993/12/18 04:46:44 mycroft Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: ccd.c,v 1.2 1994/06/29 06:31:30 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990 The Regents of the University of California.
@ -35,9 +37,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Utah Hdr: ccd.c 1.6 90/11/28
* from: @(#)cd.c 7.4 (Berkeley) 5/7/91
* $Id: ccd.c,v 1.1 1994/06/24 14:11:02 hpeyerl Exp $
* from: Utah $Hdr: cd.c 1.6 90/11/28$
*
* @(#)cd.c 7.4 (Berkeley) 5/7/91
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: ccdvar.h,v 1.2 1994/06/29 06:31:31 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990 The Regents of the University of California.
@ -35,9 +37,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Utah Hdr: cdvar.h 1.1 90/07/09
* from: @(#)cdvar.h 7.2 (Berkeley) 11/4/90
* $Id: ccdvar.h,v 1.1 1994/06/24 14:11:04 hpeyerl Exp $
* from: Utah $Hdr: cdvar.h 1.1 90/07/09$
*
* @(#)cdvar.h 7.2 (Berkeley) 11/4/90
*/
#define NCCDISKS 8 /* max # of component disks */

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: cons.c,v 1.17 1994/06/27 19:49:45 cgd Exp $ */
/* $NetBSD: cons.c,v 1.18 1994/06/29 06:31:32 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: cons.h,v 1.5 1994/06/27 19:49:47 cgd Exp $ */
/* $NetBSD: cons.h,v 1.6 1994/06/29 06:31:34 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: vn.c,v 1.10 1994/06/27 19:49:48 cgd Exp $ */
/* $NetBSD: vn.c,v 1.11 1994/06/29 06:31:35 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: vnd.c,v 1.10 1994/06/27 19:49:48 cgd Exp $ */
/* $NetBSD: vnd.c,v 1.11 1994/06/29 06:31:35 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: vndioctl.h,v 1.2 1994/06/27 19:49:50 cgd Exp $ */
/* $NetBSD: vndioctl.h,v 1.3 1994/06/29 06:31:37 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: vnioctl.h,v 1.2 1994/06/27 19:49:50 cgd Exp $ */
/* $NetBSD: vnioctl.h,v 1.3 1994/06/29 06:31:37 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993

View File

@ -1,4 +1,4 @@
# NetBSD $Id: TODO,v 1.2 1994/06/27 19:40:57 cgd Exp $
# $NetBSD: TODO,v 1.3 1994/06/29 06:31:40 cgd Exp $
1) should understand "older", original High Sierra ("CDROM001") type

View File

@ -1,4 +1,4 @@
# NetBSD $Id: TODO.hibler,v 1.2 1994/06/27 19:40:59 cgd Exp $
# $NetBSD: TODO.hibler,v 1.3 1994/06/29 06:31:41 cgd Exp $
1. Investiate making ISOFS another UFS shared filesystem (ala FFS/MFS/LFS).
Since it was modelled after the inode code, we might be able to merge

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: cd9660_bmap.c,v 1.2 1994/06/27 19:41:00 cgd Exp $ */
/* $NetBSD: cd9660_bmap.c,v 1.3 1994/06/29 06:31:42 cgd Exp $ */
/*-
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: cd9660_lookup.c,v 1.3 1994/06/27 19:41:02 cgd Exp $ */
/* $NetBSD: cd9660_lookup.c,v 1.4 1994/06/29 06:31:43 cgd Exp $ */
/*-
* Copyright (c) 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: cd9660_node.c,v 1.3 1994/06/27 19:41:03 cgd Exp $ */
/* $NetBSD: cd9660_node.c,v 1.4 1994/06/29 06:31:45 cgd Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1994
* The Regents of the University of California. All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: cd9660_node.h,v 1.2 1994/06/27 19:41:05 cgd Exp $ */
/* $NetBSD: cd9660_node.h,v 1.3 1994/06/29 06:31:47 cgd Exp $ */
/*-
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: cd9660_rrip.c,v 1.3 1994/06/27 19:41:06 cgd Exp $ */
/* $NetBSD: cd9660_rrip.c,v 1.4 1994/06/29 06:31:49 cgd Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: cd9660_rrip.h,v 1.2 1994/06/27 19:41:08 cgd Exp $ */
/* $NetBSD: cd9660_rrip.h,v 1.3 1994/06/29 06:31:53 cgd Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: cd9660_util.c,v 1.2 1994/06/27 19:41:09 cgd Exp $ */
/* $NetBSD: cd9660_util.c,v 1.3 1994/06/29 06:31:54 cgd Exp $ */
/*-
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: cd9660_vfsops.c,v 1.3 1994/06/27 19:41:12 cgd Exp $ */
/* $NetBSD: cd9660_vfsops.c,v 1.4 1994/06/29 06:31:56 cgd Exp $ */
/*-
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: cd9660_vnops.c,v 1.3 1994/06/27 19:41:17 cgd Exp $ */
/* $NetBSD: cd9660_vnops.c,v 1.4 1994/06/29 06:31:59 cgd Exp $ */
/*-
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: iso.h,v 1.2 1994/06/27 19:41:21 cgd Exp $ */
/* $NetBSD: iso.h,v 1.3 1994/06/29 06:32:01 cgd Exp $ */
/*-
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.

View File

@ -1,4 +1,5 @@
/* NetBSD $Id: iso_rrip.h,v 1.2 1994/06/27 19:41:24 cgd Exp $ */
/* $NetBSD: iso_rrip.h,v 1.3 1994/06/29 06:32:02 cgd Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.

View File

@ -1,3 +1,5 @@
/* $NetBSD: exec_aout.c,v 1.10 1994/06/29 06:32:06 cgd Exp $ */
/*
* Copyright (c) 1993, 1994 Christopher G. Demetriou
* All rights reserved.
@ -26,8 +28,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: exec_aout.c,v 1.9 1994/01/28 23:46:59 jtc Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: exec_conf.c,v 1.5 1994/06/29 06:32:08 cgd Exp $ */
/*
* Copyright (c) 1993, 1994 Christopher G. Demetriou
* All rights reserved.
@ -26,8 +28,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: exec_conf.c,v 1.4 1994/05/27 09:20:13 glass Exp $
*/
#define EXEC_SCRIPT /* XXX */

View File

@ -1,3 +1,5 @@
/* $NetBSD: exec_ecoff.c,v 1.3 1994/06/29 06:32:10 cgd Exp $ */
/*
* Copyright (c) 1994 Adam Glass
* Copyright (c) 1993, 1994 Christopher G. Demetriou
@ -27,8 +29,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: exec_ecoff.c,v 1.2 1994/05/28 20:21:30 glass Exp $
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: exec_script.c,v 1.8 1994/06/29 06:32:12 cgd Exp $ */
/*
* Copyright (c) 1993, 1994 Christopher G. Demetriou
* All rights reserved.
@ -26,8 +28,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: exec_script.c,v 1.7 1994/06/08 11:28:29 mycroft Exp $
*/
#if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS)

View File

@ -1,3 +1,5 @@
/* $NetBSD: exec_subr.c,v 1.8 1994/06/29 06:32:13 cgd Exp $ */
/*
* Copyright (c) 1993, 1994 Christopher G. Demetriou
* All rights reserved.
@ -26,8 +28,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: exec_subr.c,v 1.7 1994/05/23 03:04:57 cgd Exp $
*/
#include <sys/param.h>

View File

@ -1 +1 @@
revision 1.56 intentionally removed
revision 1.57 intentionally removed

View File

@ -1,3 +1,5 @@
/* $NetBSD: kern_acct.c,v 1.30 1994/06/29 06:32:17 cgd Exp $ */
/*-
* Copyright (c) 1994 Christopher G. Demetriou
* Copyright (c) 1982, 1986, 1989, 1993
@ -36,8 +38,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)kern_acct.c 8.1 (Berkeley) 6/14/93
* $Id: kern_acct.c,v 1.29 1994/06/19 22:58:29 cgd Exp $
* @(#)kern_acct.c 8.1 (Berkeley) 6/14/93
*/
#include <sys/param.h>

View File

@ -1 +1,561 @@
revision 1.18 intentionally removed
/* $NetBSD: kern_clock.c,v 1.19 1994/06/29 06:32:19 cgd Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/dkstat.h>
#include <sys/callout.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <machine/cpu.h>
#ifdef GPROF
#include <sys/gmon.h>
#endif
/*
* Clock handling routines.
*
* This code is written to operate with two timers that run independently of
* each other. The main clock, running hz times per second, is used to keep
* track of real time. The second timer handles kernel and user profiling,
* and does resource use estimation. If the second timer is programmable,
* it is randomized to avoid aliasing between the two clocks. For example,
* the randomization prevents an adversary from always giving up the cpu
* just before its quantum expires. Otherwise, it would never accumulate
* cpu ticks. The mean frequency of the second timer is stathz.
*
* If no second timer exists, stathz will be zero; in this case we drive
* profiling and statistics off the main clock. This WILL NOT be accurate;
* do not do it unless absolutely necessary.
*
* The statistics clock may (or may not) be run at a higher rate while
* profiling. This profile clock runs at profhz. We require that profhz
* be an integral multiple of stathz.
*
* If the statistics clock is running fast, it must be divided by the ratio
* profhz/stathz for statistics. (For profiling, every tick counts.)
*/
/*
* TODO:
* allocate more timeout table slots when table overflows.
*/
/*
* Bump a timeval by a small number of usec's.
*/
#define BUMPTIME(t, usec) { \
register volatile struct timeval *tp = (t); \
register long us; \
\
tp->tv_usec = us = tp->tv_usec + (usec); \
if (us >= 1000000) { \
tp->tv_usec = us - 1000000; \
tp->tv_sec++; \
} \
}
int stathz;
int profhz;
int profprocs;
int ticks;
static int psdiv, pscnt; /* prof => stat divider */
int psratio; /* ratio: prof / stat */
volatile struct timeval time;
volatile struct timeval mono_time;
/*
* Initialize clock frequencies and start both clocks running.
*/
void
initclocks()
{
register int i;
/*
* Set divisors to 1 (normal case) and let the machine-specific
* code do its bit.
*/
psdiv = pscnt = 1;
cpu_initclocks();
/*
* Compute profhz/stathz, and fix profhz if needed.
*/
i = stathz ? stathz : hz;
if (profhz == 0)
profhz = i;
psratio = profhz / i;
}
/*
* The real-time timer, interrupting hz times per second.
*/
void
hardclock(frame)
register struct clockframe *frame;
{
register struct callout *p1;
register struct proc *p;
register int delta, needsoft;
extern int tickdelta;
extern long timedelta;
/*
* Update real-time timeout queue.
* At front of queue are some number of events which are ``due''.
* The time to these is <= 0 and if negative represents the
* number of ticks which have passed since it was supposed to happen.
* The rest of the q elements (times > 0) are events yet to happen,
* where the time for each is given as a delta from the previous.
* Decrementing just the first of these serves to decrement the time
* to all events.
*/
needsoft = 0;
for (p1 = calltodo.c_next; p1 != NULL; p1 = p1->c_next) {
if (--p1->c_time > 0)
break;
needsoft = 1;
if (p1->c_time == 0)
break;
}
p = curproc;
if (p) {
register struct pstats *pstats;
/*
* Run current process's virtual and profile time, as needed.
*/
pstats = p->p_stats;
if (CLKF_USERMODE(frame) &&
timerisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value) &&
itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0)
psignal(p, SIGVTALRM);
if (timerisset(&pstats->p_timer[ITIMER_PROF].it_value) &&
itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0)
psignal(p, SIGPROF);
}
/*
* If no separate statistics clock is available, run it from here.
*/
if (stathz == 0)
statclock(frame);
/*
* Increment the time-of-day. The increment is just ``tick'' unless
* we are still adjusting the clock; see adjtime().
*/
ticks++;
if (timedelta == 0)
delta = tick;
else {
delta = tick + tickdelta;
timedelta -= tickdelta;
}
BUMPTIME(&time, delta);
BUMPTIME(&mono_time, delta);
/*
* Process callouts at a very low cpu priority, so we don't keep the
* relatively high clock interrupt priority any longer than necessary.
*/
if (needsoft) {
if (CLKF_BASEPRI(frame)) {
/*
* Save the overhead of a software interrupt;
* it will happen as soon as we return, so do it now.
*/
(void)splsoftclock();
softclock();
} else
setsoftclock();
}
}
/*
* Software (low priority) clock interrupt.
* Run periodic events from timeout queue.
*/
/*ARGSUSED*/
void
softclock()
{
register struct callout *c;
register void *arg;
register void (*func) __P((void *));
register int s;
s = splhigh();
while ((c = calltodo.c_next) != NULL && c->c_time <= 0) {
func = c->c_func;
arg = c->c_arg;
calltodo.c_next = c->c_next;
c->c_next = callfree;
callfree = c;
splx(s);
(*func)(arg);
(void) splhigh();
}
splx(s);
}
/*
* timeout --
* Execute a function after a specified length of time.
*
* untimeout --
* Cancel previous timeout function call.
*
* See AT&T BCI Driver Reference Manual for specification. This
* implementation differs from that one in that no identification
* value is returned from timeout, rather, the original arguments
* to timeout are used to identify entries for untimeout.
*/
void
timeout(ftn, arg, ticks)
void (*ftn) __P((void *));
void *arg;
register int ticks;
{
register struct callout *new, *p, *t;
register int s;
if (ticks <= 0)
ticks = 1;
/* Lock out the clock. */
s = splhigh();
/* Fill in the next free callout structure. */
if (callfree == NULL)
panic("timeout table full");
new = callfree;
callfree = new->c_next;
new->c_arg = arg;
new->c_func = ftn;
/*
* The time for each event is stored as a difference from the time
* of the previous event on the queue. Walk the queue, correcting
* the ticks argument for queue entries passed. Correct the ticks
* value for the queue entry immediately after the insertion point
* as well. Watch out for negative c_time values; these represent
* overdue events.
*/
for (p = &calltodo;
(t = p->c_next) != NULL && ticks > t->c_time; p = t)
if (t->c_time > 0)
ticks -= t->c_time;
new->c_time = ticks;
if (t != NULL)
t->c_time -= ticks;
/* Insert the new entry into the queue. */
p->c_next = new;
new->c_next = t;
splx(s);
}
void
untimeout(ftn, arg)
void (*ftn) __P((void *));
void *arg;
{
register struct callout *p, *t;
register int s;
s = splhigh();
for (p = &calltodo; (t = p->c_next) != NULL; p = t)
if (t->c_func == ftn && t->c_arg == arg) {
/* Increment next entry's tick count. */
if (t->c_next && t->c_time > 0)
t->c_next->c_time += t->c_time;
/* Move entry from callout queue to callfree queue. */
p->c_next = t->c_next;
t->c_next = callfree;
callfree = t;
break;
}
splx(s);
}
/*
* Compute number of hz until specified time. Used to
* compute third argument to timeout() from an absolute time.
*/
int
hzto(tv)
struct timeval *tv;
{
register long ticks, sec;
int s;
/*
* If number of milliseconds will fit in 32 bit arithmetic,
* then compute number of milliseconds to time and scale to
* ticks. Otherwise just compute number of hz in time, rounding
* times greater than representible to maximum value.
*
* Delta times less than 25 days can be computed ``exactly''.
* Maximum value for any timeout in 10ms ticks is 250 days.
*/
s = splhigh();
sec = tv->tv_sec - time.tv_sec;
if (sec <= 0x7fffffff / 1000 - 1000)
ticks = ((tv->tv_sec - time.tv_sec) * 1000 +
(tv->tv_usec - time.tv_usec) / 1000) / (tick / 1000);
else if (sec <= 0x7fffffff / hz)
ticks = sec * hz;
else
ticks = 0x7fffffff;
splx(s);
return (ticks);
}
/*
* Start profiling on a process.
*
* Kernel profiling passes proc0 which never exits and hence
* keeps the profile clock running constantly.
*/
void
startprofclock(p)
register struct proc *p;
{
int s;
if ((p->p_flag & P_PROFIL) == 0) {
p->p_flag |= P_PROFIL;
if (++profprocs == 1 && stathz != 0) {
s = splstatclock();
psdiv = pscnt = psratio;
setstatclockrate(profhz);
splx(s);
}
}
}
/*
* Stop profiling on a process.
*/
void
stopprofclock(p)
register struct proc *p;
{
int s;
if (p->p_flag & P_PROFIL) {
p->p_flag &= ~P_PROFIL;
if (--profprocs == 0 && stathz != 0) {
s = splstatclock();
psdiv = pscnt = 1;
setstatclockrate(stathz);
splx(s);
}
}
}
int dk_ndrive = DK_NDRIVE;
/*
* Statistics clock. Grab profile sample, and if divider reaches 0,
* do process and kernel statistics.
*/
void
statclock(frame)
register struct clockframe *frame;
{
#ifdef GPROF
register struct gmonparam *g;
#endif
register struct proc *p;
register int i;
if (CLKF_USERMODE(frame)) {
p = curproc;
if (p->p_flag & P_PROFIL)
addupc_intr(p, CLKF_PC(frame), 1);
if (--pscnt > 0)
return;
/*
* Came from user mode; CPU was in user state.
* If this process is being profiled record the tick.
*/
p->p_uticks++;
if (p->p_nice > NZERO)
cp_time[CP_NICE]++;
else
cp_time[CP_USER]++;
} else {
#ifdef GPROF
/*
* Kernel statistics are just like addupc_intr, only easier.
*/
g = &_gmonparam;
if (g->state == GMON_PROF_ON) {
i = CLKF_PC(frame) - g->lowpc;
if (i < g->textsize) {
i /= HISTFRACTION * sizeof(*g->kcount);
g->kcount[i]++;
}
}
#endif
if (--pscnt > 0)
return;
/*
* Came from kernel mode, so we were:
* - handling an interrupt,
* - doing syscall or trap work on behalf of the current
* user process, or
* - spinning in the idle loop.
* Whichever it is, charge the time as appropriate.
* Note that we charge interrupts to the current process,
* regardless of whether they are ``for'' that process,
* so that we know how much of its real time was spent
* in ``non-process'' (i.e., interrupt) work.
*/
p = curproc;
if (CLKF_INTR(frame)) {
if (p != NULL)
p->p_iticks++;
cp_time[CP_INTR]++;
} else if (p != NULL) {
p->p_sticks++;
cp_time[CP_SYS]++;
} else
cp_time[CP_IDLE]++;
}
pscnt = psdiv;
/*
* We maintain statistics shown by user-level statistics
* programs: the amount of time in each cpu state, and
* the amount of time each of DK_NDRIVE ``drives'' is busy.
*
* XXX should either run linked list of drives, or (better)
* grab timestamps in the start & done code.
*/
for (i = 0; i < DK_NDRIVE; i++)
if (dk_busy & (1 << i))
dk_time[i]++;
/*
* We adjust the priority of the current process. The priority of
* a process gets worse as it accumulates CPU time. The cpu usage
* estimator (p_estcpu) is increased here. The formula for computing
* priorities (in kern_synch.c) will compute a different value each
* time p_estcpu increases by 4. The cpu usage estimator ramps up
* quite quickly when the process is running (linearly), and decays
* away exponentially, at a rate which is proportionally slower when
* the system is busy. The basic principal is that the system will
* 90% forget that the process used a lot of CPU time in 5 * loadav
* seconds. This causes the system to favor processes which haven't
* run much recently, and to round-robin among other processes.
*/
if (p != NULL) {
p->p_cpticks++;
if (++p->p_estcpu == 0)
p->p_estcpu--;
if ((p->p_estcpu & 3) == 0) {
resetpriority(p);
if (p->p_priority >= PUSER)
p->p_priority = p->p_usrpri;
}
}
}
/*
* Return information about system clocks.
*/
sysctl_clockrate(where, sizep)
register char *where;
size_t *sizep;
{
struct clockinfo clkinfo;
/*
* Construct clockinfo structure.
*/
clkinfo.hz = hz;
clkinfo.tick = tick;
clkinfo.profhz = profhz;
clkinfo.stathz = stathz ? stathz : hz;
return (sysctl_rdstruct(where, sizep, NULL, &clkinfo, sizeof(clkinfo)));
}
#ifdef DDB
#include <ddb/db_access.h>
#include <ddb/db_sym.h>
void db_show_callout(long addr, int haddr, int count, char *modif)
{
register struct callout *p1;
register int cum;
register int s;
db_expr_t offset;
char *name;
db_printf(" cum ticks arg func\n");
s = splhigh();
for (cum = 0, p1 = calltodo.c_next; p1; p1 = p1->c_next) {
register int t = p1->c_time;
if (t > 0)
cum += t;
db_find_sym_and_offset(p1->c_func, &name, &offset);
if (name == NULL)
name = "?";
db_printf("%9d %9d %8x %s (%x)\n",
cum, t, p1->c_arg, name, p1->c_func);
}
splx(s);
}
#endif

View File

@ -1,3 +1,5 @@
/* $NetBSD: kern_descrip.c,v 1.22 1994/06/29 06:32:23 cgd Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
@ -35,8 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
* $Id: kern_descrip.c,v 1.21 1994/06/22 03:00:21 mycroft Exp $
* @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
*/
#include <sys/param.h>

View File

@ -1 +1,531 @@
revision 1.54 intentionally removed
/* $NetBSD: kern_exec.c,v 1.55 1994/06/29 06:32:24 cgd Exp $ */
/*-
* Copyright (C) 1993, 1994 Christopher G. Demetriou
* Copyright (C) 1992 Wolfgang Solfrank.
* Copyright (C) 1992 TooLs GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by TooLs GmbH.
* 4. The name of TooLs GmbH may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/filedesc.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/mount.h>
#include <sys/malloc.h>
#include <sys/namei.h>
#include <sys/vnode.h>
#include <sys/file.h>
#include <sys/acct.h>
#include <sys/exec.h>
#include <sys/ktrace.h>
#include <sys/resourcevar.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <sys/signalvar.h>
#include <sys/stat.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
#include <machine/cpu.h>
#include <machine/reg.h>
#ifdef COPY_SIGCODE
extern char sigcode[], esigcode[];
#define szsigcode (esigcode - sigcode)
#else
#define szsigcode 0
#endif
/*
* check exec:
* given an "executable" described in the exec package's namei info,
* see what we can do with it.
*
* ON ENTRY:
* exec package with appropriate namei info
* proc pointer of exec'ing proc
* NO SELF-LOCKED VNODES
*
* ON EXIT:
* error: nothing held, etc. exec header still allocated.
* ok: filled exec package, one locked vnode.
*
* EXEC SWITCH ENTRY:
* Locked vnode to check, exec package, proc.
*
* EXEC SWITCH EXIT:
* ok: return 0, filled exec package, one locked vnode.
* error: destructive:
* everything deallocated execept exec header.
* non-descructive:
* error code, locked vnode, exec header unmodified
*/
int
check_exec(p, epp)
struct proc *p;
struct exec_package *epp;
{
int error, i;
struct vnode *vp;
char *cp, *ep, *name;
struct nameidata *ndp;
int resid;
ndp = epp->ep_ndp;
ndp->ni_cnd.cn_nameiop = LOOKUP;
ndp->ni_cnd.cn_flags = FOLLOW | LOCKLEAF | SAVENAME;
/* first get the vnode */
if (error = namei(ndp))
return error;
epp->ep_vp = vp = ndp->ni_vp;
/* check for regular file */
if (vp->v_type != VREG) {
error = EACCES;
goto bad1;
}
/* get attributes */
if (error = VOP_GETATTR(vp, epp->ep_vap, p->p_ucred, p))
goto bad1;
/* Check mount point */
if (vp->v_mount->mnt_flag & MNT_NOEXEC) {
error = EACCES;
goto bad1;
}
if ((vp->v_mount->mnt_flag & MNT_NOSUID) || (p->p_flag & P_TRACED))
epp->ep_vap->va_mode &= ~(VSUID | VSGID);
/* check access. for root we have to see if any exec bit on */
if (error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p))
goto bad1;
if ((epp->ep_vap->va_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0) {
error = EACCES;
goto bad1;
}
/* try to open it */
if (error = VOP_OPEN(vp, FREAD, p->p_ucred, p))
goto bad1;
/* now we have the file, get the exec header */
if (error = vn_rdwr(UIO_READ, vp, epp->ep_hdr, epp->ep_hdrlen, 0,
UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, p))
goto bad2;
epp->ep_hdrvalid = epp->ep_hdrlen - resid;
/*
* set up the vmcmds for creation of the process
* address space
*/
error = ENOEXEC;
for (i = 0; i < nexecs && error != 0; i++) {
if (execsw[i].es_check != NULL)
error = (*execsw[i].es_check)(p, epp);
if (epp->ep_flags & EXEC_DESTR && error != 0)
return error;
}
if (!error) {
/* check that entry point is sane */
if (epp->ep_entry > VM_MAXUSER_ADDRESS)
error = ENOEXEC;
/* check limits */
if ((epp->ep_tsize > MAXTSIZ) ||
(epp->ep_dsize > p->p_rlimit[RLIMIT_DATA].rlim_cur))
error = ENOMEM;
if (!error)
return (0);
}
/*
* free any vmspace-creation commands,
* and release their references
*/
kill_vmcmds(&epp->ep_vmcmds);
bad2:
/*
* unlock and close the vnode, restore the old one, free the
* pathname buf, and punt.
*/
VOP_UNLOCK(vp);
vn_close(vp, FREAD, p->p_ucred, p);
FREE(ndp->ni_cnd.cn_pnbuf, M_NAMEI);
return error;
bad1:
/*
* free the namei pathname buffer, and put the vnode
* (which we don't yet have open).
*/
FREE(ndp->ni_cnd.cn_pnbuf, M_NAMEI);
vput(vp);
return error;
}
/*
* exec system call
*/
/* ARGSUSED */
execve(p, uap, retval)
register struct proc *p;
register struct execve_args *uap;
int *retval;
{
int error, i;
struct exec_package pack;
struct nameidata nid;
struct vattr attr;
struct ucred *cred = p->p_ucred;
char *argp;
char **cpp, *dp, *sp, *np;
int argc, envc, len;
char *stack;
struct ps_strings arginfo;
struct vmspace *vm = p->p_vmspace;
char **tmpfap;
/*
* figure out the maximum size of an exec header, if necessary.
* XXX should be able to keep LKM code from modifying exec switch
* when we're still using it, but...
*/
if (exec_maxhdrsz == 0) {
for (i = 0; i < nexecs; i++)
if (execsw[i].es_check != NULL
&& execsw[i].es_hdrsz > exec_maxhdrsz)
exec_maxhdrsz = execsw[i].es_hdrsz;
}
/* init the namei data to point the file user's program name */
NDINIT(&nid, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, p);
/*
* initialize the fields of the exec package.
*/
pack.ep_name = uap->path;
MALLOC(pack.ep_hdr, void *, exec_maxhdrsz, M_EXEC, M_WAITOK);
pack.ep_hdrlen = exec_maxhdrsz;
pack.ep_hdrvalid = 0;
pack.ep_ndp = &nid;
pack.ep_setup = NULL; /* assume no setup function */
pack.ep_vmcmds.evs_cnt = 0;
pack.ep_vmcmds.evs_used = 0;
pack.ep_vap = &attr;
pack.ep_emul = EMUL_NETBSD;
pack.ep_flags = 0;
/* see if we can run it. */
if (error = check_exec(p, &pack))
goto freehdr;
/* XXX -- THE FOLLOWING SECTION NEEDS MAJOR CLEANUP */
/* allocate an argument buffer */
argp = (char *) kmem_alloc_wait(exec_map, NCARGS);
#ifdef DIAGNOSTIC
if (argp == (vm_offset_t) 0)
panic("execve: argp == NULL");
#endif
dp = argp;
argc = 0;
/* copy the fake args list, if there's one, freeing it as we go */
if (pack.ep_flags & EXEC_HASARGL) {
tmpfap = pack.ep_fa;
while (*tmpfap != NULL) {
char *cp;
cp = *tmpfap;
while (*cp)
*dp++ = *cp++;
*dp++;
FREE(*tmpfap, M_EXEC);
tmpfap++; argc++;
}
FREE(pack.ep_fa, M_EXEC);
pack.ep_flags &= ~EXEC_HASARGL;
}
/* Now get argv & environment */
if (!(cpp = uap->argp)) {
error = EINVAL;
goto bad;
}
if (pack.ep_flags & EXEC_SKIPARG)
cpp++;
while (1) {
len = argp + ARG_MAX - dp;
if (error = copyin(cpp, &sp, sizeof(sp)))
goto bad;
if (!sp)
break;
if (error = copyinstr(sp, dp, len, (u_int *) & len)) {
if (error == ENAMETOOLONG)
error = E2BIG;
goto bad;
}
dp += len;
cpp++;
argc++;
}
envc = 0;
if (cpp = uap->envp) { /* environment need not be there */
while (1) {
len = argp + ARG_MAX - dp;
if (error = copyin(cpp, &sp, sizeof(sp)))
goto bad;
if (!sp)
break;
if (error = copyinstr(sp, dp, len, (u_int *) & len)) {
if (error == ENAMETOOLONG)
error = E2BIG;
goto bad;
}
dp += len;
cpp++;
envc++;
}
dp = (char *) ALIGN(dp);
}
/* Now check if args & environ fit into new stack */
len = ((argc + envc + 2) * sizeof(char *) + sizeof(int) +
dp + STACKGAPLEN + szsigcode + sizeof(struct ps_strings)) - argp;
len = ALIGN(len); /* make the stack "safely" aligned */
if (len > pack.ep_ssize) { /* in effect, compare to initial limit */
error = ENOMEM;
goto bad;
}
/* adjust "active stack depth" for process VSZ */
pack.ep_ssize = len; /* maybe should go elsewhere, but... */
/* Unmap old program */
#ifdef sparc
kill_user_windows(p); /* before stack addresses go away */
#endif
/* Kill shared memory and unmap old program */
#ifdef SYSVSHM
if (vm->vm_shm)
shmexit(p);
#endif
vm_deallocate(&vm->vm_map, VM_MIN_ADDRESS,
VM_MAXUSER_ADDRESS - VM_MIN_ADDRESS);
/* Now map address space */
vm->vm_taddr = (char *) pack.ep_taddr;
vm->vm_tsize = btoc(pack.ep_tsize);
vm->vm_daddr = (char *) pack.ep_daddr;
vm->vm_dsize = btoc(pack.ep_dsize);
vm->vm_ssize = btoc(pack.ep_ssize);
vm->vm_maxsaddr = (char *) pack.ep_maxsaddr;
/* create the new process's VM space by running the vmcmds */
#ifdef DIAGNOSTIC
if (pack.ep_vmcmds.evs_used == 0)
panic("execve: no vmcmds");
#endif
for (i = 0; i < pack.ep_vmcmds.evs_used && !error; i++) {
struct exec_vmcmd *vcp;
vcp = &pack.ep_vmcmds.evs_cmds[i];
error = (*vcp->ev_proc)(p, vcp);
}
/* free the vmspace-creation commands, and release their references */
kill_vmcmds(&pack.ep_vmcmds);
/* if an error happened, deallocate and punt */
if (error)
goto exec_abort;
/* remember information about the process */
arginfo.ps_nargvstr = argc;
arginfo.ps_nenvstr = envc;
/* Now copy argc, args & environ to new stack */
stack = (char *) (USRSTACK - len);
cpp = (char **) stack;
if (copyout(&argc, cpp++, sizeof(argc)))
goto exec_abort;
dp = (char *) (cpp + argc + envc + 2);
/* XXX don't copy them out, remap them! */
arginfo.ps_argvstr = dp; /* remember location of argv for later */
for (sp = argp; --argc >= 0; sp += len, dp += len) {
len = strlen(sp) + 1;
if (copyout(&dp, cpp++, sizeof(dp))
|| copyoutstr(sp, dp, len, 0))
goto exec_abort;
}
np = 0;
if (copyout(&np, cpp++, sizeof(np)))
goto exec_abort;
arginfo.ps_envstr = dp; /* remember location of env for later */
for (; --envc >= 0; sp += len, dp += len) {
len = strlen(sp) + 1;
if (copyout(&dp, cpp++, sizeof(dp))
|| copyoutstr(sp, dp, len, 0))
goto exec_abort;
}
if (copyout(&np, cpp, sizeof(np)))
goto exec_abort;
/* copy out the process's ps_strings structure */
if (copyout(&arginfo, (char *) PS_STRINGS, sizeof(arginfo)))
goto exec_abort;
#ifdef COPY_SIGCODE
/* copy out the process's signal trapoline code */
if (copyout((char *) sigcode, ((char *) PS_STRINGS) - szsigcode,
szsigcode)) {
goto exec_abort;
}
#endif
fdcloseexec(p); /* handle close on exec */
execsigs(p); /* reset catched signals */
/* set command name & other accounting info */
len = min(nid.ni_cnd.cn_namelen, MAXCOMLEN);
bcopy(nid.ni_cnd.cn_nameptr, p->p_comm, len);
p->p_comm[len] = 0;
p->p_acflag &= ~AFORK;
/* record proc's vnode, for use by procfs and others */
if (p->p_textvp)
vrele(p->p_textvp);
VREF(pack.ep_vp);
p->p_textvp = pack.ep_vp;
p->p_flag |= P_EXEC;
if (p->p_flag & P_PPWAIT) {
p->p_flag &= ~P_PPWAIT;
wakeup((caddr_t) p->p_pptr);
}
/*
* deal with set[ug]id.
* MNT_NOEXEC and P_TRACED have already been used to disable s[ug]id.
*/
p->p_flag &= ~P_SUGID;
if (((attr.va_mode & VSUID) != 0 &&
p->p_ucred->cr_uid != attr.va_uid)
|| (attr.va_mode & VSGID) != 0 &&
p->p_ucred->cr_gid != attr.va_gid) {
p->p_ucred = crcopy(cred);
#ifdef KTRACE
/*
* If process is being ktraced, turn off - unless
* root set it.
*/
if (p->p_tracep && !(p->p_traceflag & KTRFAC_ROOT)) {
vrele(p->p_tracep);
p->p_tracep = NULL;
p->p_traceflag = 0;
}
#endif
if (attr.va_mode & VSUID)
p->p_ucred->cr_uid = attr.va_uid;
if (attr.va_mode & VSGID)
p->p_ucred->cr_gid = attr.va_gid;
p->p_flag |= P_SUGID;
}
p->p_cred->p_svuid = p->p_ucred->cr_uid;
p->p_cred->p_svgid = p->p_ucred->cr_gid;
kmem_free_wakeup(exec_map, (vm_offset_t) argp, NCARGS);
FREE(nid.ni_cnd.cn_pnbuf, M_NAMEI);
VOP_CLOSE(pack.ep_vp, FREAD, cred, p);
vput(pack.ep_vp);
/* setup new registers and do misc. setup. */
setregs(p, pack.ep_entry, (u_long) stack, retval);
if (pack.ep_setup != NULL)
(*pack.ep_setup)(p, &pack);
if (p->p_flag & P_TRACED)
psignal(p, SIGTRAP);
p->p_emul = pack.ep_emul;
FREE(pack.ep_hdr, M_EXEC);
return 0;
bad:
/* free the vmspace-creation commands, and release their references */
kill_vmcmds(&pack.ep_vmcmds);
/* kill any opened file descriptor, if necessary */
if (pack.ep_flags & EXEC_HASFD) {
pack.ep_flags &= ~EXEC_HASFD;
exec_closefd(p, pack.ep_fd);
}
/* close and put the exec'd file */
VOP_CLOSE(pack.ep_vp, FREAD, cred, p);
vput(pack.ep_vp);
FREE(nid.ni_cnd.cn_pnbuf, M_NAMEI);
kmem_free_wakeup(exec_map, (vm_offset_t) argp, NCARGS);
freehdr:
FREE(pack.ep_hdr, M_EXEC);
return error;
exec_abort:
/*
* the old process doesn't exist anymore. exit gracefully.
* get rid of the (new) address space we have created, if any, get rid
* of our namei data and vnode, and exit noting failure
*/
vm_deallocate(&vm->vm_map, VM_MIN_ADDRESS,
VM_MAXUSER_ADDRESS - VM_MIN_ADDRESS);
FREE(nid.ni_cnd.cn_pnbuf, M_NAMEI);
VOP_CLOSE(pack.ep_vp, FREAD, cred, p);
vput(pack.ep_vp);
kmem_free_wakeup(exec_map, (vm_offset_t) argp, NCARGS);
FREE(pack.ep_hdr, M_EXEC);
exit1(p, W_EXITCODE(0, SIGABRT));
exit1(p, -1);
/* NOTREACHED */
return 0;
}

View File

@ -1 +1,507 @@
revision 1.23 intentionally removed
/* $NetBSD: kern_exit.c,v 1.24 1994/06/29 06:32:26 cgd Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)kern_exit.c 8.7 (Berkeley) 2/12/94
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/map.h>
#include <sys/ioctl.h>
#include <sys/proc.h>
#include <sys/tty.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/buf.h>
#include <sys/wait.h>
#include <sys/file.h>
#include <sys/vnode.h>
#include <sys/syslog.h>
#include <sys/malloc.h>
#include <sys/resourcevar.h>
#include <sys/ptrace.h>
#include <machine/cpu.h>
#ifdef COMPAT_43
#include <machine/reg.h>
#include <machine/psl.h>
#endif
#include <vm/vm.h>
#include <vm/vm_kern.h>
__dead void cpu_exit __P((struct proc *));
__dead void exit1 __P((struct proc *, int));
/*
* exit --
* Death of process.
*/
struct exit_args {
int rval;
};
__dead void
exit(p, uap, retval)
struct proc *p;
struct exit_args *uap;
int *retval;
{
exit1(p, W_EXITCODE(uap->rval, 0));
/* NOTREACHED */
}
/*
* Exit: deallocate address space and other resources, change proc state
* to zombie, and unlink proc from allproc and parent's lists. Save exit
* status and rusage for wait(). Check for child processes and orphan them.
*/
__dead void
exit1(p, rv)
register struct proc *p;
int rv;
{
register struct proc *q, *nq;
register struct proc **pp;
register struct vmspace *vm;
if (p->p_pid == 1)
panic("init died (signal %d, exit %d)",
WTERMSIG(rv), WEXITSTATUS(rv));
#ifdef PGINPROF
vmsizmon();
#endif
if (p->p_flag & P_PROFIL)
stopprofclock(p);
MALLOC(p->p_ru, struct rusage *, sizeof(struct rusage),
M_ZOMBIE, M_WAITOK);
/*
* If parent is waiting for us to exit or exec,
* P_PPWAIT is set; we will wakeup the parent below.
*/
p->p_flag &= ~(P_TRACED | P_PPWAIT);
p->p_flag |= P_WEXIT;
p->p_sigignore = ~0;
p->p_siglist = 0;
untimeout(realitexpire, (caddr_t)p);
/*
* Close open files and release open-file table.
* This may block!
*/
fdfree(p);
/* The next three chunks should probably be moved to vmspace_exit. */
vm = p->p_vmspace;
#ifdef SYSVSHM
if (vm->vm_shm)
shmexit(p);
#endif
#ifdef SYSVSEM
semexit(p);
#endif
/*
* Release user portion of address space.
* This releases references to vnodes,
* which could cause I/O if the file has been unlinked.
* Need to do this early enough that we can still sleep.
* Can't free the entire vmspace as the kernel stack
* may be mapped within that space also.
*/
if (vm->vm_refcnt == 1)
(void) vm_map_remove(&vm->vm_map, VM_MIN_ADDRESS,
VM_MAXUSER_ADDRESS);
if (SESS_LEADER(p)) {
register struct session *sp = p->p_session;
if (sp->s_ttyvp) {
/*
* Controlling process.
* Signal foreground pgrp,
* drain controlling terminal
* and revoke access to controlling terminal.
*/
if (sp->s_ttyp->t_session == sp) {
if (sp->s_ttyp->t_pgrp)
pgsignal(sp->s_ttyp->t_pgrp, SIGHUP, 1);
(void) ttywait(sp->s_ttyp);
/*
* The tty could have been revoked
* if we blocked.
*/
if (sp->s_ttyvp)
vgoneall(sp->s_ttyvp);
}
if (sp->s_ttyvp)
vrele(sp->s_ttyvp);
sp->s_ttyvp = NULL;
/*
* s_ttyp is not zero'd; we use this to indicate
* that the session once had a controlling terminal.
* (for logging and informational purposes)
*/
}
sp->s_leader = NULL;
}
fixjobc(p, p->p_pgrp, 0);
p->p_rlimit[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
(void)acct_process(p);
#ifdef KTRACE
/*
* release trace file
*/
p->p_traceflag = 0; /* don't trace the vrele() */
if (p->p_tracep)
vrele(p->p_tracep);
#endif
/*
* Remove proc from allproc queue and pidhash chain.
* Place onto zombproc. Unlink from parent's child list.
*/
if (*p->p_prev = p->p_next)
p->p_next->p_prev = p->p_prev;
if (p->p_next = zombproc)
p->p_next->p_prev = &p->p_next;
p->p_prev = &zombproc;
zombproc = p;
p->p_stat = SZOMB;
for (pp = &pidhash[PIDHASH(p->p_pid)]; *pp; pp = &(*pp)->p_hash)
if (*pp == p) {
*pp = p->p_hash;
goto done;
}
panic("exit");
done:
if (p->p_cptr) /* only need this if any child is S_ZOMB */
wakeup((caddr_t) initproc);
for (q = p->p_cptr; q != NULL; q = nq) {
nq = q->p_osptr;
if (nq != NULL)
nq->p_ysptr = NULL;
if (initproc->p_cptr)
initproc->p_cptr->p_ysptr = q;
q->p_osptr = initproc->p_cptr;
q->p_ysptr = NULL;
initproc->p_cptr = q;
q->p_pptr = initproc;
/*
* Traced processes are killed
* since their existence means someone is screwing up.
*/
if (q->p_flag & P_TRACED) {
q->p_flag &= ~P_TRACED;
psignal(q, SIGKILL);
}
}
p->p_cptr = NULL;
/*
* Save exit status and final rusage info, adding in child rusage
* info and self times.
*/
p->p_xstat = rv;
*p->p_ru = p->p_stats->p_ru;
calcru(p, &p->p_ru->ru_utime, &p->p_ru->ru_stime, NULL);
ruadd(p->p_ru, &p->p_stats->p_cru);
/*
* Notify parent that we're gone.
*/
psignal(p->p_pptr, SIGCHLD);
wakeup((caddr_t)p->p_pptr);
/*
* Notify procfs debugger
*/
if (p->p_flag & P_FSTRACE)
wakeup((caddr_t)p);
#if defined(tahoe)
/* move this to cpu_exit */
p->p_addr->u_pcb.pcb_savacc.faddr = (float *)NULL;
#endif
/*
* Clear curproc after we've done all operations
* that could block, and before tearing down the rest
* of the process state that might be used from clock, etc.
* Also, can't clear curproc while we're still runnable,
* as we're not on a run queue (we are current, just not
* a proper proc any longer!).
*
* Other substructures are freed from wait().
*/
curproc = NULL;
if (--p->p_limit->p_refcnt == 0)
FREE(p->p_limit, M_SUBPROC);
/*
* Finally, call machine-dependent code to release the remaining
* resources including address space, the kernel stack and pcb.
* The address space is released by "vmspace_free(p->p_vmspace)";
* This is machine-dependent, as we may have to change stacks
* or ensure that the current one isn't reallocated before we
* finish. cpu_exit will end with a call to cpu_swtch(), finishing
* our execution (pun intended).
*/
cpu_exit(p);
}
struct wait_args {
int pid;
int *status;
int options;
struct rusage *rusage;
#ifdef COMPAT_43
int compat; /* pseudo */
#endif
};
#ifdef COMPAT_43
#ifdef m68k
#include <machine/frame.h>
#define GETPS(rp) ((struct frame *)(rp))->f_sr
#else
#define GETPS(rp) (rp)[PS]
#endif
owait(p, uap, retval)
struct proc *p;
register struct wait_args *uap;
int *retval;
{
#ifdef PSL_ALLCC
if ((GETPS(p->p_md.md_regs) & PSL_ALLCC) != PSL_ALLCC) {
uap->options = 0;
uap->rusage = NULL;
} else {
uap->options = p->p_md.md_regs[R0];
uap->rusage = (struct rusage *)p->p_md.md_regs[R1];
}
#else
uap->options = 0;
uap->rusage = NULL;
#endif
uap->pid = WAIT_ANY;
uap->status = NULL;
uap->compat = 1;
return (wait1(p, uap, retval));
}
wait4(p, uap, retval)
struct proc *p;
struct wait_args *uap;
int *retval;
{
uap->compat = 0;
return (wait1(p, uap, retval));
}
#else
#define wait1 wait4
#endif
int
wait1(q, uap, retval)
register struct proc *q;
register struct wait_args *uap;
int retval[];
{
register int nfound;
register struct proc *p, *t;
int status, error;
#ifdef COMPAT_09
uap->pid = (short) uap->pid;
#endif
if (uap->pid == 0)
uap->pid = -q->p_pgid;
#ifdef notyet
if (uap->options &~ (WUNTRACED|WNOHANG))
return (EINVAL);
#endif
loop:
nfound = 0;
for (p = q->p_cptr; p; p = p->p_osptr) {
if (uap->pid != WAIT_ANY &&
p->p_pid != uap->pid && p->p_pgid != -uap->pid)
continue;
nfound++;
if (p->p_stat == SZOMB) {
retval[0] = p->p_pid;
#ifdef COMPAT_43
if (uap->compat)
retval[1] = p->p_xstat;
else
#endif
if (uap->status) {
status = p->p_xstat; /* convert to int */
if (error = copyout((caddr_t)&status,
(caddr_t)uap->status, sizeof(status)))
return (error);
}
if (uap->rusage && (error = copyout((caddr_t)p->p_ru,
(caddr_t)uap->rusage, sizeof (struct rusage))))
return (error);
/*
* If we got the child via a ptrace 'attach',
* we need to give it back to the old parent.
*/
if (p->p_oppid && (t = pfind(p->p_oppid))) {
p->p_oppid = 0;
proc_reparent(p, t);
psignal(t, SIGCHLD);
wakeup((caddr_t)t);
return (0);
}
p->p_xstat = 0;
ruadd(&q->p_stats->p_cru, p->p_ru);
FREE(p->p_ru, M_ZOMBIE);
/*
* Decrement the count of procs running with this uid.
*/
(void)chgproccnt(p->p_cred->p_ruid, -1);
/*
* Free up credentials.
*/
if (--p->p_cred->p_refcnt == 0) {
crfree(p->p_cred->pc_ucred);
FREE(p->p_cred, M_SUBPROC);
}
/*
* Release reference to text vnode
*/
if (p->p_textvp)
vrele(p->p_textvp);
/*
* Finally finished with old proc entry.
* Unlink it from its process group and free it.
*/
leavepgrp(p);
if (*p->p_prev = p->p_next) /* off zombproc */
p->p_next->p_prev = p->p_prev;
if (q = p->p_ysptr)
q->p_osptr = p->p_osptr;
if (q = p->p_osptr)
q->p_ysptr = p->p_ysptr;
if ((q = p->p_pptr)->p_cptr == p)
q->p_cptr = p->p_osptr;
/*
* Give machine-dependent layer a chance
* to free anything that cpu_exit couldn't
* release while still running in process context.
*/
cpu_wait(p);
FREE(p, M_PROC);
nprocs--;
return (0);
}
if (p->p_stat == SSTOP && (p->p_flag & P_WAITED) == 0 &&
(p->p_flag & P_TRACED || uap->options & WUNTRACED)) {
p->p_flag |= P_WAITED;
retval[0] = p->p_pid;
#ifdef COMPAT_43
if (uap->compat) {
retval[1] = W_STOPCODE(p->p_xstat);
error = 0;
} else
#endif
if (uap->status) {
status = W_STOPCODE(p->p_xstat);
error = copyout((caddr_t)&status,
(caddr_t)uap->status, sizeof(status));
} else
error = 0;
return (error);
}
}
if (nfound == 0)
return (ECHILD);
if (uap->options & WNOHANG) {
retval[0] = 0;
return (0);
}
if (error = tsleep((caddr_t)q, PWAIT | PCATCH, "wait", 0))
return (error);
goto loop;
}
/*
* make process 'parent' the new parent of process 'child'.
*/
void
proc_reparent(child, parent)
register struct proc *child;
register struct proc *parent;
{
register struct proc *o;
register struct proc *y;
if (child->p_pptr == parent)
return;
/* fix up the child linkage for the old parent */
o = child->p_osptr;
y = child->p_ysptr;
if (y)
y->p_osptr = o;
if (o)
o->p_ysptr = y;
if (child->p_pptr->p_cptr == child)
child->p_pptr->p_cptr = o;
/* fix up child linkage for new parent */
o = parent->p_cptr;
if (o)
o->p_ysptr = child;
child->p_osptr = o;
child->p_ysptr = NULL;
parent->p_cptr = child;
child->p_pptr = parent;
}

View File

@ -1,3 +1,5 @@
/* $NetBSD: kern_fork.c,v 1.19 1994/06/29 06:32:28 cgd Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
@ -35,8 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)kern_fork.c 8.6 (Berkeley) 4/8/94
* $Id: kern_fork.c,v 1.18 1994/06/15 19:59:21 mycroft Exp $
* @(#)kern_fork.c 8.6 (Berkeley) 4/8/94
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: kern_ktrace.c,v 1.11 1994/06/29 06:32:29 cgd Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)kern_ktrace.c 8.2 (Berkeley) 9/23/93
* $Id: kern_ktrace.c,v 1.10 1994/06/08 11:28:37 mycroft Exp $
* @(#)kern_ktrace.c 8.2 (Berkeley) 9/23/93
*/
#ifdef KTRACE

View File

@ -1,3 +1,5 @@
/* $NetBSD: kern_lkm.c,v 1.18 1994/06/29 06:32:31 cgd Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
* Copyright (c) 1992 Terrence R. Lambert.
@ -29,8 +31,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: kern_lkm.c,v 1.17 1994/06/08 11:28:38 mycroft Exp $
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: kern_malloc.c,v 1.9 1994/06/29 06:32:33 cgd Exp $ */
/*
* Copyright (c) 1987, 1991, 1993
* The Regents of the University of California. All rights reserved.
@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94
* $Id: kern_malloc.c,v 1.8 1994/05/13 08:32:17 cgd Exp $
* @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94
*/
#include <sys/param.h>

View File

@ -1 +1,325 @@
revision 1.19 intentionally removed
/* $NetBSD: kern_physio.c,v 1.20 1994/06/29 06:32:34 cgd Exp $ */
/*-
* Copyright (c) 1994 Christopher G. Demetriou
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)kern_physio.c 8.1 (Berkeley) 6/10/93
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/conf.h>
#include <sys/proc.h>
/*
* The routines implemented in this file are described in:
* Leffler, et al.: The Design and Implementation of the 4.3BSD
* UNIX Operating System (Addison Welley, 1989)
* on pages 231-233.
*
* The routines "getphysbuf" and "putphysbuf" steal and return a swap
* buffer. Leffler, et al., says that swap buffers are used to do the
* I/O, so raw I/O requests don't have to be single-threaded.
*/
struct buf *getphysbuf __P((void));
void putphysbuf __P((struct buf *bp));
/*
* Do "physical I/O" on behalf of a user. "Physical I/O" is I/O directly
* from the raw device to user buffers, and bypasses the buffer cache.
*
* Comments in brackets are from Leffler, et al.'s pseudo-code implementation.
*/
int
physio(strategy, bp, dev, flags, minphys, uio)
int (*strategy)();
struct buf *bp;
dev_t dev;
int flags;
u_int (*minphys)();
struct uio *uio;
{
struct iovec *iovp;
struct proc *p = curproc;
int error, done, i, nobuf, s, todo;
error = 0;
flags &= B_READ | B_WRITE;
/*
* [check user read/write access to the data buffer]
*
* Check each iov one by one. Note that we know if we're reading or
* writing, so we ignore the uio's rw parameter. Also note that if
* we're doing a read, that's a *write* to user-space.
*/
for (i = 0; i < uio->uio_iovcnt; i++)
if (!useracc(uio->uio_iov[i].iov_base, uio->uio_iov[i].iov_len,
(flags == B_READ) ? B_WRITE : B_READ))
return (EFAULT);
/* Make sure we have a buffer, creating one if necessary. */
if (nobuf = (bp == NULL))
bp = getphysbuf();
/* [raise the processor priority level to splbio;] */
s = splbio();
/* [while the buffer is marked busy] */
while (bp->b_flags & B_BUSY) {
/* [mark the buffer wanted] */
bp->b_flags |= B_WANTED;
/* [wait until the buffer is available] */
tsleep((caddr_t)bp, PRIBIO+1, "physbuf", 0);
}
/* Mark it busy, so nobody else will use it. */
bp->b_flags |= B_BUSY;
/* [lower the priority level] */
splx(s);
/* [set up the fixed part of the buffer for a transfer] */
bp->b_dev = dev;
bp->b_error = 0;
bp->b_proc = p;
/*
* [while there are data to transfer and no I/O error]
* Note that I/O errors are handled with a 'goto' at the bottom
* of the 'while' loop.
*/
for (i = 0; i < uio->uio_iovcnt; i++) {
iovp = &uio->uio_iov[i];
while (iovp->iov_len > 0) {
/*
* [mark the buffer busy for physical I/O]
* (i.e. set B_PHYS (because it's an I/O to user
* memory, and B_RAW, because B_RAW is to be
* "Set by physio for raw transfers.", in addition
* to the "busy" and read/write flag.)
*/
s = splbio();
bp->b_flags = B_BUSY | B_PHYS | B_RAW | flags;
splx(s);
/* [set up the buffer for a maximum-sized transfer] */
bp->b_blkno = btodb(uio->uio_offset);
bp->b_bcount = iovp->iov_len;
bp->b_data = iovp->iov_base;
/*
* [call minphys to bound the tranfer size]
* and remember the amount of data to transfer,
* for later comparison.
*/
(*minphys)(bp);
todo = bp->b_bcount;
/*
* [lock the part of the user address space involved
* in the transfer]
* Beware vmapbuf(); it clobbers b_data and
* saves it in b_saveaddr. However, vunmapbuf()
* restores it.
*/
p->p_holdcnt++;
vslock(bp->b_data, todo);
vmapbuf(bp, todo);
/* [call strategy to start the transfer] */
(*strategy)(bp);
/*
* Note that the raise/wait/lower/get error
* steps below would be done by biowait(), but
* we want to unlock the address space before
* we lower the priority.
*
* [raise the priority level to splbio]
*/
s = splbio();
/* [wait for the transfer to complete] */
while ((bp->b_flags & B_DONE) == 0)
tsleep((caddr_t) bp, PRIBIO + 1, "physio", 0);
/*
* [unlock the part of the address space previously
* locked]
*/
vunmapbuf(bp, todo);
vsunlock(bp->b_data, todo);
p->p_holdcnt--;
/* remember error value (save a splbio/splx pair) */
if (bp->b_flags & B_ERROR)
error = (bp->b_error ? bp->b_error : EIO);
/* [lower the priority level] */
splx(s);
/*
* [deduct the transfer size from the total number
* of data to transfer]
*/
done = bp->b_bcount - bp->b_resid;
iovp->iov_len -= done;
iovp->iov_base += done;
uio->uio_offset += done;
uio->uio_resid -= done;
/*
* Now, check for an error.
* Also, handle weird end-of-disk semantics.
*/
if (error || done < todo)
goto done;
}
}
done:
/*
* [clean up the state of the buffer]
* Remember if somebody wants it, so we can wake them up below.
* Also, if we had to steal it, give it back.
*/
s = splbio();
bp->b_flags &= ~(B_BUSY | B_PHYS | B_RAW);
if (nobuf)
putphysbuf(bp);
else {
/*
* [if another process is waiting for the raw I/O buffer,
* wake up processes waiting to do physical I/O;
*/
if (bp->b_flags & B_WANTED) {
bp->b_flags &= ~B_WANTED;
wakeup(bp);
}
}
splx(s);
return (error);
}
/*
* Get a swap buffer structure, for use in physical I/O.
* Mostly taken from /sys/vm/swap_pager.c, except that it no longer
* records buffer list-empty conditions, and sleeps at PRIBIO + 1,
* rather than PSWP + 1 (and on a different wchan).
*/
struct buf *
getphysbuf()
{
struct buf *bp;
int s;
s = splbio();
while (bswlist.b_actf == NULL) {
bswlist.b_flags |= B_WANTED;
tsleep((caddr_t)&bswlist, PRIBIO + 1, "getphys", 0);
}
bp = bswlist.b_actf;
bswlist.b_actf = bp->b_actf;
splx(s);
return (bp);
}
/*
* Get rid of a swap buffer structure which has been used in physical I/O.
* Mostly taken from /sys/vm/swap_pager.c, except that it now uses
* wakeup() rather than the VM-internal thread_wakeup(), and that the caller
* must mask disk interrupts, rather than putphysbuf() itself.
*/
void
putphysbuf(bp)
struct buf *bp;
{
bp->b_actf = bswlist.b_actf;
bswlist.b_actf = bp;
if (bp->b_vp)
brelvp(bp);
if (bswlist.b_flags & B_WANTED) {
bswlist.b_flags &= ~B_WANTED;
wakeup(&bswlist);
}
}
/*
* Leffler, et al., says on p. 231:
* "The minphys() routine is called by physio() to adjust the
* size of each I/O transfer before the latter is passed to
* the strategy routine..."
*
* so, just adjust the buffer's count accounting to MAXPHYS here,
* and return the new count;
*/
u_int
minphys(bp)
struct buf *bp;
{
bp->b_bcount = min(MAXPHYS, bp->b_bcount);
return bp->b_bcount;
}
/*
* Do a read on a device for a user process.
*/
rawread(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(cdevsw[major(dev)].d_strategy, (struct buf *)NULL,
dev, B_READ, minphys, uio));
}
/*
* Do a write on a device for a user process.
*/
rawwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(cdevsw[major(dev)].d_strategy, (struct buf *)NULL,
dev, B_WRITE, minphys, uio));
}

View File

@ -1,3 +1,5 @@
/* $NetBSD: kern_proc.c,v 1.9 1994/06/29 06:32:36 cgd Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)kern_proc.c 8.4 (Berkeley) 1/4/94
* $Id: kern_proc.c,v 1.8 1994/06/08 11:28:40 mycroft Exp $
* @(#)kern_proc.c 8.4 (Berkeley) 1/4/94
*/
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: kern_prot.c,v 1.16 1994/06/29 06:32:38 cgd Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
* The Regents of the University of California. All rights reserved.
@ -35,8 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)kern_prot.c 8.6 (Berkeley) 1/21/94
* $Id: kern_prot.c,v 1.15 1994/05/19 05:57:55 cgd Exp $
* @(#)kern_prot.c 8.6 (Berkeley) 1/21/94
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: kern_resource.c,v 1.20 1994/06/29 06:32:39 cgd Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993
* The Regents of the University of California. All rights reserved.
@ -35,8 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)kern_resource.c 8.5 (Berkeley) 1/21/94
* $Id: kern_resource.c,v 1.19 1994/05/19 08:13:22 cgd Exp $
* @(#)kern_resource.c 8.5 (Berkeley) 1/21/94
*/
#include <sys/param.h>

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
/* $NetBSD: kern_subr.c,v 1.12 1994/06/29 06:32:43 cgd Exp $ */
/*
* Copyright (c) 1982, 1986, 1991, 1993
* The Regents of the University of California. All rights reserved.
@ -35,8 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)kern_subr.c 8.3 (Berkeley) 1/21/94
* $Id: kern_subr.c,v 1.11 1994/05/18 12:46:29 mycroft Exp $
* @(#)kern_subr.c 8.3 (Berkeley) 1/21/94
*/
#include <sys/param.h>

View File

@ -1 +1,719 @@
revision 1.25 intentionally removed
/* $NetBSD: kern_synch.c,v 1.26 1994/06/29 06:32:45 cgd Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1991, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)kern_synch.c 8.6 (Berkeley) 1/21/94
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/signalvar.h>
#include <sys/resourcevar.h>
#include <sys/vmmeter.h>
#ifdef KTRACE
#include <sys/ktrace.h>
#endif
#include <machine/cpu.h>
u_char curpriority; /* usrpri of curproc */
int lbolt; /* once a second sleep address */
/*
* Force switch among equal priority processes every 100ms.
*/
/* ARGSUSED */
void
roundrobin(arg)
void *arg;
{
need_resched();
timeout(roundrobin, NULL, hz / 10);
}
/*
* Constants for digital decay and forget:
* 90% of (p_estcpu) usage in 5 * loadav time
* 95% of (p_pctcpu) usage in 60 seconds (load insensitive)
* Note that, as ps(1) mentions, this can let percentages
* total over 100% (I've seen 137.9% for 3 processes).
*
* Note that hardclock updates p_estcpu and p_cpticks independently.
*
* We wish to decay away 90% of p_estcpu in (5 * loadavg) seconds.
* That is, the system wants to compute a value of decay such
* that the following for loop:
* for (i = 0; i < (5 * loadavg); i++)
* p_estcpu *= decay;
* will compute
* p_estcpu *= 0.1;
* for all values of loadavg:
*
* Mathematically this loop can be expressed by saying:
* decay ** (5 * loadavg) ~= .1
*
* The system computes decay as:
* decay = (2 * loadavg) / (2 * loadavg + 1)
*
* We wish to prove that the system's computation of decay
* will always fulfill the equation:
* decay ** (5 * loadavg) ~= .1
*
* If we compute b as:
* b = 2 * loadavg
* then
* decay = b / (b + 1)
*
* We now need to prove two things:
* 1) Given factor ** (5 * loadavg) ~= .1, prove factor == b/(b+1)
* 2) Given b/(b+1) ** power ~= .1, prove power == (5 * loadavg)
*
* Facts:
* For x close to zero, exp(x) =~ 1 + x, since
* exp(x) = 0! + x**1/1! + x**2/2! + ... .
* therefore exp(-1/b) =~ 1 - (1/b) = (b-1)/b.
* For x close to zero, ln(1+x) =~ x, since
* ln(1+x) = x - x**2/2 + x**3/3 - ... -1 < x < 1
* therefore ln(b/(b+1)) = ln(1 - 1/(b+1)) =~ -1/(b+1).
* ln(.1) =~ -2.30
*
* Proof of (1):
* Solve (factor)**(power) =~ .1 given power (5*loadav):
* solving for factor,
* ln(factor) =~ (-2.30/5*loadav), or
* factor =~ exp(-1/((5/2.30)*loadav)) =~ exp(-1/(2*loadav)) =
* exp(-1/b) =~ (b-1)/b =~ b/(b+1). QED
*
* Proof of (2):
* Solve (factor)**(power) =~ .1 given factor == (b/(b+1)):
* solving for power,
* power*ln(b/(b+1)) =~ -2.30, or
* power =~ 2.3 * (b + 1) = 4.6*loadav + 2.3 =~ 5*loadav. QED
*
* Actual power values for the implemented algorithm are as follows:
* loadav: 1 2 3 4
* power: 5.68 10.32 14.94 19.55
*/
/* calculations for digital decay to forget 90% of usage in 5*loadav sec */
#define loadfactor(loadav) (2 * (loadav))
#define decay_cpu(loadfac, cpu) (((loadfac) * (cpu)) / ((loadfac) + FSCALE))
/* decay 95% of `p_pctcpu' in 60 seconds; see CCPU_SHIFT before changing */
fixpt_t ccpu = 0.95122942450071400909 * FSCALE; /* exp(-1/20) */
/*
* If `ccpu' is not equal to `exp(-1/20)' and you still want to use the
* faster/more-accurate formula, you'll have to estimate CCPU_SHIFT below
* and possibly adjust FSHIFT in "param.h" so that (FSHIFT >= CCPU_SHIFT).
*
* To estimate CCPU_SHIFT for exp(-1/20), the following formula was used:
* 1 - exp(-1/20) ~= 0.0487 ~= 0.0488 == 1 (fixed pt, *11* bits).
*
* If you dont want to bother with the faster/more-accurate formula, you
* can set CCPU_SHIFT to (FSHIFT + 1) which will use a slower/less-accurate
* (more general) method of calculating the %age of CPU used by a process.
*/
#define CCPU_SHIFT 11
/*
* Recompute process priorities, every hz ticks.
*/
/* ARGSUSED */
void
schedcpu(arg)
void *arg;
{
register fixpt_t loadfac = loadfactor(averunnable.ldavg[0]);
register struct proc *p;
register int s;
register unsigned int newcpu;
wakeup((caddr_t)&lbolt);
for (p = (struct proc *)allproc; p != NULL; p = p->p_next) {
/*
* Increment time in/out of memory and sleep time
* (if sleeping). We ignore overflow; with 16-bit int's
* (remember them?) overflow takes 45 days.
*/
p->p_swtime++;
if (p->p_stat == SSLEEP || p->p_stat == SSTOP)
p->p_slptime++;
p->p_pctcpu = (p->p_pctcpu * ccpu) >> FSHIFT;
/*
* If the process has slept the entire second,
* stop recalculating its priority until it wakes up.
*/
if (p->p_slptime > 1)
continue;
s = splstatclock(); /* prevent state changes */
/*
* p_pctcpu is only for ps.
*/
#if (FSHIFT >= CCPU_SHIFT)
p->p_pctcpu += (hz == 100)?
((fixpt_t) p->p_cpticks) << (FSHIFT - CCPU_SHIFT):
100 * (((fixpt_t) p->p_cpticks)
<< (FSHIFT - CCPU_SHIFT)) / hz;
#else
p->p_pctcpu += ((FSCALE - ccpu) *
(p->p_cpticks * FSCALE / hz)) >> FSHIFT;
#endif
p->p_cpticks = 0;
newcpu = (u_int) decay_cpu(loadfac, p->p_estcpu) + p->p_nice;
p->p_estcpu = min(newcpu, UCHAR_MAX);
resetpriority(p);
if (p->p_priority >= PUSER) {
#define PPQ (128 / NQS) /* priorities per queue */
if ((p != curproc) &&
p->p_stat == SRUN &&
(p->p_flag & P_INMEM) &&
(p->p_priority / PPQ) != (p->p_usrpri / PPQ)) {
remrq(p);
p->p_priority = p->p_usrpri;
setrunqueue(p);
} else
p->p_priority = p->p_usrpri;
}
splx(s);
}
vmmeter();
if (bclnlist != NULL)
wakeup((caddr_t)pageproc);
timeout(schedcpu, (void *)0, hz);
}
/*
* Recalculate the priority of a process after it has slept for a while.
* For all load averages >= 1 and max p_estcpu of 255, sleeping for at
* least six times the loadfactor will decay p_estcpu to zero.
*/
void
updatepri(p)
register struct proc *p;
{
register unsigned int newcpu = p->p_estcpu;
register fixpt_t loadfac = loadfactor(averunnable.ldavg[0]);
if (p->p_slptime > 5 * loadfac)
p->p_estcpu = 0;
else {
p->p_slptime--; /* the first time was done in schedcpu */
while (newcpu && --p->p_slptime)
newcpu = (int) decay_cpu(loadfac, newcpu);
p->p_estcpu = min(newcpu, UCHAR_MAX);
}
resetpriority(p);
}
/*
* We're only looking at 7 bits of the address; everything is
* aligned to 4, lots of things are aligned to greater powers
* of 2. Shift right by 8, i.e. drop the bottom 256 worth.
*/
#define TABLESIZE 128
#define LOOKUP(x) (((int)(x) >> 8) & (TABLESIZE - 1))
struct slpque {
struct proc *sq_head;
struct proc **sq_tailp;
} slpque[TABLESIZE];
/*
* During autoconfiguration or after a panic, a sleep will simply
* lower the priority briefly to allow interrupts, then return.
* The priority to be used (safepri) is machine-dependent, thus this
* value is initialized and maintained in the machine-dependent layers.
* This priority will typically be 0, or the lowest priority
* that is safe for use on the interrupt stack; it can be made
* higher to block network software interrupts after panics.
*/
int safepri;
/*
* General sleep call. Suspends the current process until a wakeup is
* performed on the specified identifier. The process will then be made
* runnable with the specified priority. Sleeps at most timo/hz seconds
* (0 means no timeout). If pri includes PCATCH flag, signals are checked
* before and after sleeping, else signals are not checked. Returns 0 if
* awakened, EWOULDBLOCK if the timeout expires. If PCATCH is set and a
* signal needs to be delivered, ERESTART is returned if the current system
* call should be restarted if possible, and EINTR is returned if the system
* call should be interrupted by the signal (return EINTR).
*/
int
tsleep(ident, priority, wmesg, timo)
void *ident;
int priority, timo;
char *wmesg;
{
register struct proc *p = curproc;
register struct slpque *qp;
register s;
int sig, catch = priority & PCATCH;
extern int cold;
void endtsleep __P((void *));
#ifdef KTRACE
if (KTRPOINT(p, KTR_CSW))
ktrcsw(p->p_tracep, 1, 0);
#endif
s = splhigh();
if (cold || panicstr) {
/*
* After a panic, or during autoconfiguration,
* just give interrupts a chance, then just return;
* don't run any other procs or panic below,
* in case this is the idle process and already asleep.
*/
splx(safepri);
splx(s);
return (0);
}
#ifdef DIAGNOSTIC
if (ident == NULL || p->p_stat != SRUN || p->p_back)
panic("tsleep");
#endif
p->p_wchan = ident;
p->p_wmesg = wmesg;
p->p_slptime = 0;
p->p_priority = priority & PRIMASK;
qp = &slpque[LOOKUP(ident)];
if (qp->sq_head == 0)
qp->sq_head = p;
else
*qp->sq_tailp = p;
*(qp->sq_tailp = &p->p_forw) = 0;
if (timo)
timeout(endtsleep, (void *)p, timo);
/*
* We put ourselves on the sleep queue and start our timeout
* before calling CURSIG, as we could stop there, and a wakeup
* or a SIGCONT (or both) could occur while we were stopped.
* A SIGCONT would cause us to be marked as SSLEEP
* without resuming us, thus we must be ready for sleep
* when CURSIG is called. If the wakeup happens while we're
* stopped, p->p_wchan will be 0 upon return from CURSIG.
*/
if (catch) {
p->p_flag |= P_SINTR;
if (sig = CURSIG(p)) {
if (p->p_wchan)
unsleep(p);
p->p_stat = SRUN;
goto resume;
}
if (p->p_wchan == 0) {
catch = 0;
goto resume;
}
} else
sig = 0;
p->p_stat = SSLEEP;
p->p_stats->p_ru.ru_nvcsw++;
mi_switch();
#ifdef DDB
/* handy breakpoint location after process "wakes" */
asm(".globl bpendtsleep ; bpendtsleep:");
#endif
resume:
curpriority = p->p_usrpri;
splx(s);
p->p_flag &= ~P_SINTR;
if (p->p_flag & P_TIMEOUT) {
p->p_flag &= ~P_TIMEOUT;
if (sig == 0) {
#ifdef KTRACE
if (KTRPOINT(p, KTR_CSW))
ktrcsw(p->p_tracep, 0, 0);
#endif
return (EWOULDBLOCK);
}
} else if (timo)
untimeout(endtsleep, (void *)p);
if (catch && (sig != 0 || (sig = CURSIG(p)))) {
#ifdef KTRACE
if (KTRPOINT(p, KTR_CSW))
ktrcsw(p->p_tracep, 0, 0);
#endif
if (p->p_sigacts->ps_sigintr & sigmask(sig))
return (EINTR);
return (ERESTART);
}
#ifdef KTRACE
if (KTRPOINT(p, KTR_CSW))
ktrcsw(p->p_tracep, 0, 0);
#endif
return (0);
}
/*
* Implement timeout for tsleep.
* If process hasn't been awakened (wchan non-zero),
* set timeout flag and undo the sleep. If proc
* is stopped, just unsleep so it will remain stopped.
*/
void
endtsleep(arg)
void *arg;
{
register struct proc *p;
int s;
p = (struct proc *)arg;
s = splhigh();
if (p->p_wchan) {
if (p->p_stat == SSLEEP)
setrunnable(p);
else
unsleep(p);
p->p_flag |= P_TIMEOUT;
}
splx(s);
}
/*
* Short-term, non-interruptable sleep.
*/
void
sleep(ident, priority)
void *ident;
int priority;
{
register struct proc *p = curproc;
register struct slpque *qp;
register s;
extern int cold;
#ifdef DIAGNOSTIC
if (priority > PZERO) {
printf("sleep called with priority %d > PZERO, wchan: %x\n",
priority, ident);
panic("old sleep");
}
#endif
s = splhigh();
if (cold || panicstr) {
/*
* After a panic, or during autoconfiguration,
* just give interrupts a chance, then just return;
* don't run any other procs or panic below,
* in case this is the idle process and already asleep.
*/
splx(safepri);
splx(s);
return;
}
#ifdef DIAGNOSTIC
if (ident == NULL || p->p_stat != SRUN || p->p_back)
panic("sleep");
#endif
p->p_wchan = ident;
p->p_wmesg = NULL;
p->p_slptime = 0;
p->p_priority = priority;
qp = &slpque[LOOKUP(ident)];
if (qp->sq_head == 0)
qp->sq_head = p;
else
*qp->sq_tailp = p;
*(qp->sq_tailp = &p->p_forw) = 0;
p->p_stat = SSLEEP;
p->p_stats->p_ru.ru_nvcsw++;
#ifdef KTRACE
if (KTRPOINT(p, KTR_CSW))
ktrcsw(p->p_tracep, 1, 0);
#endif
mi_switch();
#ifdef DDB
/* handy breakpoint location after process "wakes" */
asm(".globl bpendsleep ; bpendsleep:");
#endif
#ifdef KTRACE
if (KTRPOINT(p, KTR_CSW))
ktrcsw(p->p_tracep, 0, 0);
#endif
curpriority = p->p_usrpri;
splx(s);
}
/*
* Remove a process from its wait queue
*/
void
unsleep(p)
register struct proc *p;
{
register struct slpque *qp;
register struct proc **hp;
int s;
s = splhigh();
if (p->p_wchan) {
hp = &(qp = &slpque[LOOKUP(p->p_wchan)])->sq_head;
while (*hp != p)
hp = &(*hp)->p_forw;
*hp = p->p_forw;
if (qp->sq_tailp == &p->p_forw)
qp->sq_tailp = hp;
p->p_wchan = 0;
}
splx(s);
}
/*
* Make all processes sleeping on the specified identifier runnable.
*/
void
wakeup(ident)
register void *ident;
{
register struct slpque *qp;
register struct proc *p, **q;
int s;
s = splhigh();
qp = &slpque[LOOKUP(ident)];
restart:
for (q = &qp->sq_head; p = *q; ) {
#ifdef DIAGNOSTIC
if (p->p_back || p->p_stat != SSLEEP && p->p_stat != SSTOP)
panic("wakeup");
#endif
if (p->p_wchan == ident) {
p->p_wchan = 0;
*q = p->p_forw;
if (qp->sq_tailp == &p->p_forw)
qp->sq_tailp = q;
if (p->p_stat == SSLEEP) {
/* OPTIMIZED EXPANSION OF setrunnable(p); */
if (p->p_slptime > 1)
updatepri(p);
p->p_slptime = 0;
p->p_stat = SRUN;
if (p->p_flag & P_INMEM)
setrunqueue(p);
/*
* Since curpriority is a user priority,
* p->p_priority is always better than
* curpriority.
*/
if ((p->p_flag & P_INMEM) == 0)
wakeup((caddr_t)&proc0);
else
need_resched();
/* END INLINE EXPANSION */
goto restart;
}
} else
q = &p->p_forw;
}
splx(s);
}
/*
* The machine independent parts of mi_switch().
* Must be called at splstatclock() or higher.
*/
void
mi_switch()
{
register struct proc *p = curproc; /* XXX */
register struct rlimit *rlim;
register long s, u;
struct timeval tv;
/*
* Compute the amount of time during which the current
* process was running, and add that to its total so far.
*/
microtime(&tv);
u = p->p_rtime.tv_usec + (tv.tv_usec - runtime.tv_usec);
s = p->p_rtime.tv_sec + (tv.tv_sec - runtime.tv_sec);
if (u < 0) {
u += 1000000;
s--;
} else if (u >= 1000000) {
u -= 1000000;
s++;
}
p->p_rtime.tv_usec = u;
p->p_rtime.tv_sec = s;
/*
* Check if the process exceeds its cpu resource allocation.
* If over max, kill it. In any case, if it has run for more
* than 10 minutes, reduce priority to give others a chance.
*/
rlim = &p->p_rlimit[RLIMIT_CPU];
if (s >= rlim->rlim_cur) {
if (s >= rlim->rlim_max)
psignal(p, SIGKILL);
else {
psignal(p, SIGXCPU);
if (rlim->rlim_cur < rlim->rlim_max)
rlim->rlim_cur += 5;
}
}
if (s > 10 * 60 && p->p_ucred->cr_uid && p->p_nice == NZERO) {
p->p_nice = NZERO + 4;
resetpriority(p);
}
/*
* Pick a new current process and record its start time.
*/
cnt.v_swtch++;
cpu_switch(p);
microtime(&runtime);
}
/*
* Initialize the (doubly-linked) run queues
* to be empty.
*/
void
rqinit()
{
register int i;
for (i = 0; i < NQS; i++)
qs[i].ph_link = qs[i].ph_rlink = (struct proc *)&qs[i];
}
/*
* Change process state to be runnable,
* placing it on the run queue if it is in memory,
* and awakening the swapper if it isn't in memory.
*/
void
setrunnable(p)
register struct proc *p;
{
register int s;
s = splhigh();
switch (p->p_stat) {
case 0:
case SRUN:
case SZOMB:
default:
panic("setrunnable");
case SSTOP:
case SSLEEP:
unsleep(p); /* e.g. when sending signals */
break;
case SIDL:
break;
}
p->p_stat = SRUN;
if (p->p_flag & P_INMEM)
setrunqueue(p);
splx(s);
if (p->p_slptime > 1)
updatepri(p);
p->p_slptime = 0;
if ((p->p_flag & P_INMEM) == 0)
wakeup((caddr_t)&proc0);
else if (p->p_priority < curpriority)
need_resched();
}
/*
* Compute the priority of a process when running in user mode.
* Arrange to reschedule if the resulting priority is better
* than that of the current process.
*/
void
resetpriority(p)
register struct proc *p;
{
register unsigned int newpriority;
newpriority = PUSER + p->p_estcpu / 4 + 2 * p->p_nice;
newpriority = min(newpriority, MAXPRI);
p->p_usrpri = newpriority;
if (newpriority < curpriority)
need_resched();
}
#ifdef DDB
void db_show_all_procs(long addr, int haddr, int count, char *modif)
{
int np;
struct proc *ap, *p, *pp;
np = nprocs;
p = ap = (struct proc *)allproc;
if (modif[0] == 'm')
db_printf(" pid proc addr map comm wchan\n");
else
db_printf(" pid proc addr uid ppid pgrp flag stat comm wchan\n");
while (--np >= 0) {
pp = p->p_pptr;
if (pp == 0)
pp = p;
if (p->p_stat) {
if (modif[0] == 'm') {
db_printf("%5d %06x %06x %06x %s ",
p->p_pid, ap, p->p_addr, p->p_vmspace, p->p_comm);
}
else {
db_printf("%5d %06x %06x %3d %5d %5d %06x %d %s ",
p->p_pid, ap, p->p_addr, p->p_cred->p_ruid,
pp->p_pid, p->p_pgrp->pg_id, p->p_flag,
p->p_stat, p->p_comm);
}
if (p->p_wchan) {
if (p->p_wmesg)
db_printf("%s ", p->p_wmesg);
db_printf("%x", p->p_wchan);
}
db_printf("\n");
}
ap = p->p_next;
if (ap == 0 && np > 0)
ap = zombproc;
p = ap;
}
}
#endif

View File

@ -1,3 +1,5 @@
/* $NetBSD: kern_sysctl.c,v 1.2 1994/06/29 06:32:47 cgd Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
@ -33,8 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
* $Id: kern_sysctl.c,v 1.1 1994/05/06 22:43:23 cgd Exp $
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
*/
/*

Some files were not shown because too many files have changed in this diff Show More