summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-04-21 22:33:19 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-04-21 22:33:19 +0000
commit67d88b0a9910a68bb666b448d2dac29cb4d3d8c2 (patch)
tree967b89f6e07398a22bd8c76d30179b648776542d /sys/kern
parentba95d3c1d69cdb251d15a12ebf70f50b0ea2019b (diff)
partial sync with netbsd 960418, more to come
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/init_main.c5
-rw-r--r--sys/kern/kern_clock.c35
-rw-r--r--sys/kern/kern_conf.h55
-rw-r--r--sys/kern/kern_descrip.c11
-rw-r--r--sys/kern/kern_lkm.c24
-rw-r--r--sys/kern/kern_malloc.c10
-rw-r--r--sys/kern/kern_subr.c2
-rw-r--r--sys/kern/kern_synch.c10
-rw-r--r--sys/kern/kern_sysctl.c7
-rw-r--r--sys/kern/subr_autoconf.c78
-rw-r--r--sys/kern/subr_disk.c5
-rw-r--r--sys/kern/subr_log.c7
-rw-r--r--sys/kern/subr_prf.c18
-rw-r--r--sys/kern/subr_prof.c9
-rw-r--r--sys/kern/subr_rmap.c8
-rw-r--r--sys/kern/sys_generic.c6
-rw-r--r--sys/kern/sysv_shm.c6
-rw-r--r--sys/kern/tty.c12
-rw-r--r--sys/kern/tty_pty.c5
-rw-r--r--sys/kern/tty_tty.c6
-rw-r--r--sys/kern/vfs_cluster.c10
-rw-r--r--sys/kern/vfs_subr.c4
-rw-r--r--sys/kern/vfs_syscalls.c14
23 files changed, 154 insertions, 193 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 64a05f5d3e7..3ab7d0d4008 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: init_main.c,v 1.4 1996/03/03 17:19:39 niklas Exp $ */
-/* $NetBSD: init_main.c,v 1.82 1996/02/09 18:59:21 christos Exp $ */
+/* $OpenBSD: init_main.c,v 1.5 1996/04/21 22:26:50 deraadt Exp $ */
+/* $NetBSD: init_main.c,v 1.83 1996/04/04 00:26:28 cgd Exp $ */
/*
* Copyright (c) 1995 Christopher G. Demetriou. All rights reserved.
@@ -180,6 +180,7 @@ main(framep)
vm_mem_init();
kmeminit();
disk_init(); /* must come before autoconfiguration */
+ config_init(); /* init autoconfiguration data structures */
cpu_startup();
/*
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index f448c057f70..6f66d4d65ba 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clock.c,v 1.8 1996/04/19 16:08:50 niklas Exp $ */
+/* $OpenBSD: kern_clock.c,v 1.9 1996/04/21 22:26:53 deraadt Exp $ */
/* $NetBSD: kern_clock.c,v 1.31 1996/03/15 07:56:00 mycroft Exp $ */
/*-
@@ -353,6 +353,7 @@ hardclock(frame)
extern long timedelta;
#ifdef NTP
register int time_update;
+ struct timeval newtime;
register int ltemp;
#endif
@@ -417,6 +418,8 @@ hardclock(frame)
tickfixcnt = 0;
}
}
+#else
+ newtime = time;
#endif /* !NTP */
/* Imprecise 4bsd adjtime() handling */
if (timedelta != 0) {
@@ -475,10 +478,10 @@ hardclock(frame)
clock_offset.tv_sec--;
clock_offset.tv_usec += 1000000;
}
- time.tv_usec += clock_cpu;
+ newtime.tv_usec += clock_cpu;
clock_cpu = 0;
#else
- time.tv_usec += time_update;
+ newtime.tv_usec += time_update;
#endif /* HIGHBALL */
/*
@@ -493,9 +496,9 @@ hardclock(frame)
* maximum frequency offset is a tad less than) +-512 ppm. On a
* 64-bit machine, you shouldn't need to ask.
*/
- if (time.tv_usec >= 1000000) {
- time.tv_usec -= 1000000;
- time.tv_sec++;
+ if (newtime.tv_usec >= 1000000) {
+ newtime.tv_usec -= 1000000;
+ newtime.tv_sec++;
time_maxerror += time_tolerance >> SHIFT_USEC;
/*
@@ -516,15 +519,15 @@ hardclock(frame)
break;
case TIME_INS:
- if (time.tv_sec % 86400 == 0) {
- time.tv_sec--;
+ if (newtime.tv_sec % 86400 == 0) {
+ newtime.tv_sec--;
time_state = TIME_OOP;
}
break;
case TIME_DEL:
- if ((time.tv_sec + 1) % 86400 == 0) {
- time.tv_sec++;
+ if ((newtime.tv_sec + 1) % 86400 == 0) {
+ newtime.tv_sec++;
time_state = TIME_WAIT;
}
break;
@@ -640,9 +643,9 @@ hardclock(frame)
if (clock_count > CLOCK_INTERVAL) {
clock_count = 0;
microtime(&clock_ext);
- delta.tv_sec = clock_ext.tv_sec - time.tv_sec;
+ delta.tv_sec = clock_ext.tv_sec - newtime.tv_sec;
delta.tv_usec = clock_ext.tv_usec -
- time.tv_usec;
+ newtime.tv_usec;
if (delta.tv_usec < 0)
delta.tv_sec--;
if (delta.tv_usec >= 500000) {
@@ -657,7 +660,7 @@ hardclock(frame)
delta.tv_usec > MAXPHASE) ||
delta.tv_sec < -1 || (delta.tv_sec == -1 &&
delta.tv_usec < -MAXPHASE)) {
- time = clock_ext;
+ newtime = clock_ext;
delta.tv_sec = 0;
delta.tv_usec = 0;
}
@@ -670,6 +673,12 @@ hardclock(frame)
#endif /* EXT_CLOCK */
}
+#ifdef CPU_CLOCKUPDATE
+ CPU_CLOCKUPDATE(&time, &newtime);
+#else
+ time = newtime;
+#endif
+
#endif /* NTP */
/*
diff --git a/sys/kern/kern_conf.h b/sys/kern/kern_conf.h
deleted file mode 100644
index 0a5cc134743..00000000000
--- a/sys/kern/kern_conf.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $OpenBSD: kern_conf.h,v 1.2 1996/04/19 16:08:52 niklas Exp $ */
-/* $NetBSD: kern_conf.h,v 1.2 1996/03/14 19:01:08 christos Exp $ */
-
-/*
- * Copyright (c) 1995 Christos Zoulas. 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 Christos Zoulas.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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/conf.h>
-
-cdev_decl(filedesc);
-
-cdev_decl(log);
-
-#ifndef LKM
-# define NLKM 0
-# define lkmenodev enodev
-#else
-# define NLKM 1
-#endif
-cdev_decl(lkm);
-
-#include "pty.h"
-#define ptstty ptytty
-#define ptsioctl ptyioctl
-cdev_decl(pts);
-#define ptctty ptytty
-#define ptcioctl ptyioctl
-cdev_decl(ptc);
-
-cdev_decl(ctty);
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index a09cdd47791..21924ec8874 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: kern_descrip.c,v 1.4 1996/04/19 16:08:53 niklas Exp $ */
-/* $NetBSD: kern_descrip.c,v 1.40 1996/03/14 19:01:10 christos Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.5 1996/04/21 22:26:59 deraadt Exp $ */
+/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -57,14 +57,13 @@
#include <sys/syslog.h>
#include <sys/unistd.h>
#include <sys/resourcevar.h>
+#include <sys/conf.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <vm/vm.h>
-#include <kern/kern_conf.h>
-
/*
* Descriptor management.
*/
@@ -245,7 +244,7 @@ sys_fcntl(p, v, retval)
return (0);
}
error = (*fp->f_ops->fo_ioctl)
- (fp, (int)TIOCGPGRP, (caddr_t)retval, p);
+ (fp, TIOCGPGRP, (caddr_t)retval, p);
*retval = -*retval;
return (error);
@@ -264,7 +263,7 @@ sys_fcntl(p, v, retval)
SCARG(uap, arg) = (void *)(long)p1->p_pgrp->pg_id;
}
return ((*fp->f_ops->fo_ioctl)
- (fp, (int)TIOCSPGRP, (caddr_t)&SCARG(uap, arg), p));
+ (fp, TIOCSPGRP, (caddr_t)&SCARG(uap, arg), p));
case F_SETLKW:
flg |= F_WAIT;
diff --git a/sys/kern/kern_lkm.c b/sys/kern/kern_lkm.c
index 54a616e2ff3..589c94e444a 100644
--- a/sys/kern/kern_lkm.c
+++ b/sys/kern/kern_lkm.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: kern_lkm.c,v 1.2 1996/03/03 17:19:47 niklas Exp $ */
-/* $NetBSD: kern_lkm.c,v 1.28 1996/02/09 18:59:38 christos Exp $ */
+/* $OpenBSD: kern_lkm.c,v 1.3 1996/04/21 22:27:01 deraadt Exp $ */
+/* $NetBSD: kern_lkm.c,v 1.31 1996/03/31 21:40:27 christos Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
@@ -54,8 +54,7 @@
#include <sys/mount.h>
#include <sys/exec.h>
#include <sys/syscallargs.h>
-
-#include <kern/kern_conf.h>
+#include <sys/conf.h>
#include <sys/lkm.h>
#include <sys/syscall.h>
@@ -241,8 +240,8 @@ lkmioctl(dev, cmd, data, flag, p)
resrvp->addr = curp->area; /* ret kernel addr */
#ifdef DEBUG
- printf("LKM: LMRESERV (actual = 0x%08x)\n", curp->area);
- printf("LKM: LMRESERV (adjusted = 0x%08x)\n",
+ printf("LKM: LMRESERV (actual = 0x%08lx)\n", curp->area);
+ printf("LKM: LMRESERV (adjusted = 0x%08lx)\n",
trunc_page(curp->area));
#endif /* DEBUG */
lkm_state = LKMS_RESERVED;
@@ -274,7 +273,7 @@ lkmioctl(dev, cmd, data, flag, p)
if ((curp->offset + i) < curp->size) {
lkm_state = LKMS_LOADING;
#ifdef DEBUG
- printf("LKM: LMLOADBUF (loading @ %d of %d, i = %d)\n",
+ printf("LKM: LMLOADBUF (loading @ %ld of %ld, i = %d)\n",
curp->offset, curp->size, i);
#endif /* DEBUG */
} else {
@@ -494,10 +493,7 @@ sys_lkmnosys(p, v, retval)
* Place holder for device switch slots reserved for loadable modules.
*/
int
-lkmenodev(dev, oflags, devtype, p)
- dev_t dev;
- int oflags, devtype;
- struct proc *p;
+lkmenodev()
{
return (enodev());
@@ -701,7 +697,8 @@ _lkm_dev(lkmtp, cmd)
* Search the table looking for a slot...
*/
for (i = 0; i < nblkdev; i++)
- if (bdevsw[i].d_open == lkmenodev)
+ if (bdevsw[i].d_open ==
+ (dev_type_open((*))) lkmenodev)
break; /* found it! */
/* out of allocable slots? */
if (i == nblkdev) {
@@ -731,7 +728,8 @@ _lkm_dev(lkmtp, cmd)
* Search the table looking for a slot...
*/
for (i = 0; i < nchrdev; i++)
- if (cdevsw[i].d_open == lkmenodev)
+ if (cdevsw[i].d_open ==
+ (dev_type_open((*))) lkmenodev)
break; /* found it! */
/* out of allocable slots? */
if (i == nchrdev) {
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index bd570b4b990..50507a90acb 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: kern_malloc.c,v 1.3 1996/04/19 16:08:55 niklas Exp $ */
-/* $NetBSD: kern_malloc.c,v 1.14 1996/02/20 23:56:16 cgd Exp $ */
+/* $OpenBSD: kern_malloc.c,v 1.4 1996/04/21 22:27:03 deraadt Exp $ */
+/* $NetBSD: kern_malloc.c,v 1.15 1996/03/16 23:17:06 christos Exp $ */
/*
* Copyright (c) 1987, 1991, 1993
@@ -200,7 +200,7 @@ malloc(size, type, flags)
memname[freep->type] : "???";
if (kbp->kb_next &&
!kernacc(kbp->kb_next, sizeof(struct freelist), 0)) {
- printf("%s %d of object %p size %d %s %s (invalid addr %p)\n",
+ printf("%s %d of object %p size %ld %s %s (invalid addr %p)\n",
"Data modified on freelist: word",
(int32_t *)&kbp->kb_next - (int32_t *)kbp, va, size,
"previous type", savedtype, kbp->kb_next);
@@ -224,7 +224,7 @@ malloc(size, type, flags)
for (lp = (int32_t *)va; lp < end; lp++) {
if (*lp == WEIRD_ADDR)
continue;
- printf("%s %d of object %p size %d %s %s (0x%x != 0x%x)\n",
+ printf("%s %d of object %p size %ld %s %s (0x%x != 0x%x)\n",
"Data modified on freelist: word", lp - (int32_t *)va,
va, size, "previous type", savedtype, *lp, WEIRD_ADDR);
break;
@@ -290,7 +290,7 @@ free(addr, type)
else
alloc = addrmask[kup->ku_indx];
if (((u_long)addr & alloc) != 0)
- panic("free: unaligned addr 0x%x, size %d, type %s, mask %d\n",
+ panic("free: unaligned addr %p, size %ld, type %s, mask %ld\n",
addr, size, memname[type], alloc);
#endif /* DIAGNOSTIC */
if (size > MAXALLOCSAVE) {
diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c
index e0ae4093157..9886ff84cc1 100644
--- a/sys/kern/kern_subr.c
+++ b/sys/kern/kern_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_subr.c,v 1.14 1995/05/31 20:41:44 cgd Exp $ */
+/* $NetBSD: kern_subr.c,v 1.15 1996/04/09 17:21:56 ragge Exp $ */
/*
* Copyright (c) 1982, 1986, 1991, 1993
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index b60c2e4f6f3..2204e775f6d 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: kern_synch.c,v 1.2 1996/03/03 17:19:55 niklas Exp $ */
-/* $NetBSD: kern_synch.c,v 1.35 1996/02/09 18:59:50 christos Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.3 1996/04/21 22:27:08 deraadt Exp $ */
+/* $NetBSD: kern_synch.c,v 1.36 1996/03/30 22:23:25 christos Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1991, 1993
@@ -712,10 +712,10 @@ db_show_all_procs(addr, haddr, count, modif)
while (p != 0) {
pp = p->p_pptr;
if (p->p_stat) {
- db_printf("%5d %06x %06x ",
+ db_printf("%5d %p %p ",
p->p_pid, p, p->p_addr);
if (map)
- db_printf("%06x %s ",
+ db_printf("%p %s ",
p->p_vmspace, p->p_comm);
else
db_printf("%3d %5d %5d %06x %d %s %s ",
@@ -725,7 +725,7 @@ db_show_all_procs(addr, haddr, count, modif)
if (p->p_wchan) {
if (p->p_wmesg)
db_printf("%s ", p->p_wmesg);
- db_printf("%x", p->p_wchan);
+ db_printf("%p", p->p_wchan);
}
db_printf("\n");
}
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index aa3af083155..f46b360b905 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: kern_sysctl.c,v 1.4 1996/04/19 16:08:59 niklas Exp $ */
-/* $NetBSD: kern_sysctl.c,v 1.15 1996/02/27 04:20:40 jonathan Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.5 1996/04/21 22:27:10 deraadt Exp $ */
+/* $NetBSD: kern_sysctl.c,v 1.16 1996/04/12 23:21:37 thorpej Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -174,8 +174,7 @@ sys___sysctl(p, v, retval)
return (error);
if (SCARG(uap, oldlenp))
error = copyout(&oldlen, SCARG(uap, oldlenp), sizeof(oldlen));
- *retval = oldlen;
- return (0);
+ return (error);
}
/*
diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c
index c6f32eb4a2e..1e9ab0ae6ba 100644
--- a/sys/kern/subr_autoconf.c
+++ b/sys/kern/subr_autoconf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: subr_autoconf.c,v 1.3 1996/04/19 16:09:01 niklas Exp $ */
-/* $NetBSD: subr_autoconf.c,v 1.18 1996/02/27 21:45:46 cgd Exp $ */
+/* $OpenBSD: subr_autoconf.c,v 1.4 1996/04/21 22:27:13 deraadt Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -78,6 +78,20 @@ struct matchinfo {
static char *number __P((char *, int));
static void mapply __P((struct matchinfo *, struct cfdata *));
+struct devicelist alldevs; /* list of all devices */
+struct evcntlist allevents; /* list of all event counters */
+
+/*
+ * Initialize autoconfiguration data structures.
+ */
+void
+config_init()
+{
+
+ TAILQ_INIT(&alldevs);
+ TAILQ_INIT(&allevents);
+}
+
/*
* Apply the matching function and choose the best. This is used
* a few times and we want to keep the code small.
@@ -98,11 +112,11 @@ mapply(m, cf)
if (m->fn != NULL)
pri = (*m->fn)(m->parent, match, m->aux);
else {
- if (cf->cf_driver->cd_match == NULL) {
+ if (cf->cf_attach->ca_match == NULL) {
panic("mapply: no match function for '%s' device\n",
cf->cf_driver->cd_name);
}
- pri = (*cf->cf_driver->cd_match)(m->parent, match, m->aux);
+ pri = (*cf->cf_attach->ca_match)(m->parent, match, m->aux);
}
if (pri > m->pri) {
@@ -237,7 +251,7 @@ static char *msgs[3] = { "", " not configured\n", " unsupported\n" };
* functions) and attach it, and return true. If the device was
* not configured, call the given `print' function and return 0.
*/
-int
+struct device *
config_found_sm(parent, aux, print, submatch)
struct device *parent;
void *aux;
@@ -246,32 +260,27 @@ config_found_sm(parent, aux, print, submatch)
{
void *match;
- if ((match = config_search(submatch, parent, aux)) != NULL) {
- config_attach(parent, match, aux, print);
- return (1);
- }
+ if ((match = config_search(submatch, parent, aux)) != NULL)
+ return (config_attach(parent, match, aux, print));
if (print)
printf(msgs[(*print)(aux, parent->dv_xname)]);
- return (0);
+ return (NULL);
}
/*
* As above, but for root devices.
*/
-int
+struct device *
config_rootfound(rootname, aux)
char *rootname;
void *aux;
{
void *match;
- if ((match = config_rootsearch((cfmatch_t)NULL, rootname, aux))
- != NULL) {
- config_attach(ROOT, match, aux, (cfprint_t)NULL);
- return (1);
- }
+ if ((match = config_rootsearch((cfmatch_t)NULL, rootname, aux)) != NULL)
+ return (config_attach(ROOT, match, aux, (cfprint_t)NULL));
printf("root device %s not configured\n", rootname);
- return (0);
+ return (NULL);
}
/* just like sprintf(buf, "%d") except that it works from the end */
@@ -293,7 +302,7 @@ number(ep, n)
/*
* Attach a found device. Allocates memory for device variables.
*/
-void
+struct device *
config_attach(parent, match, aux, print)
register struct device *parent;
void *match;
@@ -303,7 +312,7 @@ config_attach(parent, match, aux, print)
register struct cfdata *cf;
register struct device *dev;
register struct cfdriver *cd;
- static struct device **nextp = &alldevs;
+ register struct cfattach *ca;
if (parent && parent->dv_cfdata->cf_driver->cd_indirect) {
dev = match;
@@ -314,6 +323,7 @@ config_attach(parent, match, aux, print)
}
cd = cf->cf_driver;
+ ca = cf->cf_attach;
cd->cd_devs[cf->cf_unit] = dev;
if (cf->cf_fstate == FSTATE_STAR)
@@ -321,8 +331,7 @@ config_attach(parent, match, aux, print)
else
cf->cf_fstate = FSTATE_FOUND;
- *nextp = dev; /* link up */
- nextp = &dev->dv_next;
+ TAILQ_INSERT_TAIL(&alldevs, dev, dv_list);
if (parent == ROOT)
printf("%s (root)", dev->dv_xname);
@@ -334,13 +343,18 @@ config_attach(parent, match, aux, print)
/*
* Before attaching, clobber any unfound devices that are
- * otherwise identical.
+ * otherwise identical, or bump the unit number on all starred
+ * cfdata for this device.
*/
for (cf = cfdata; cf->cf_driver; cf++)
- if (cf->cf_driver == cd && cf->cf_unit == dev->dv_unit &&
- cf->cf_fstate == FSTATE_NOTFOUND)
- cf->cf_fstate = FSTATE_FOUND;
- (*cd->cd_attach)(parent, dev, aux);
+ if (cf->cf_driver == cd && cf->cf_unit == dev->dv_unit) {
+ if (cf->cf_fstate == FSTATE_NOTFOUND)
+ cf->cf_fstate = FSTATE_FOUND;
+ if (cf->cf_fstate == FSTATE_STAR)
+ cf->cf_unit++;
+ }
+ (*ca->ca_attach)(parent, dev, aux);
+ return (dev);
}
struct device *
@@ -350,12 +364,14 @@ config_make_softc(parent, cf)
{
register struct device *dev;
register struct cfdriver *cd;
+ register struct cfattach *ca;
register size_t lname, lunit;
register char *xunit;
char num[10];
cd = cf->cf_driver;
- if (cd->cd_devsize < sizeof(struct device))
+ ca = cf->cf_attach;
+ if (ca->ca_devsize < sizeof(struct device))
panic("config_make_softc");
/* compute length of name and decimal expansion of unit number */
@@ -366,10 +382,10 @@ config_make_softc(parent, cf)
panic("config_attach: device name too long");
/* get memory for all device vars */
- dev = (struct device *)malloc(cd->cd_devsize, M_DEVBUF, M_NOWAIT);
+ dev = (struct device *)malloc(ca->ca_devsize, M_DEVBUF, M_NOWAIT);
if (!dev)
panic("config_attach: memory allocation for device softc failed");
- bzero(dev, cd->cd_devsize);
+ bzero(dev, ca->ca_devsize);
dev->dv_class = cd->cd_class;
dev->dv_cfdata = cf;
dev->dv_unit = cf->cf_unit;
@@ -420,7 +436,6 @@ evcnt_attach(dev, name, ev)
const char *name;
struct evcnt *ev;
{
- static struct evcnt **nextp = &allevents;
#ifdef DIAGNOSTIC
if (strlen(name) >= sizeof(ev->ev_name))
@@ -430,6 +445,5 @@ evcnt_attach(dev, name, ev)
ev->ev_dev = dev;
/* ev->ev_count = 0; */
strcpy(ev->ev_name, name);
- *nextp = ev;
- nextp = &ev->ev_next;
+ TAILQ_INSERT_TAIL(&allevents, ev, ev_list);
}
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index a4cf0dad7d5..5f6880467cc 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_disk.c,v 1.16 1996/02/09 18:59:56 christos Exp $ */
+/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
* Copyright (c) 1995 Jason R. Thorpe. All rights reserved.
@@ -215,7 +215,8 @@ diskerr(bp, dname, what, pri, blkdone, lp)
int sn;
if (pri != LOG_PRINTF) {
- log(pri, "");
+ static const char fmt[] = "";
+ log(pri, fmt);
pr = addlog;
} else
pr = printf;
diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c
index d676732a928..d874fe87a3f 100644
--- a/sys/kern/subr_log.c
+++ b/sys/kern/subr_log.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: subr_log.c,v 1.2 1996/03/03 17:20:00 niklas Exp $ */
-/* $NetBSD: subr_log.c,v 1.10 1996/02/09 18:59:58 christos Exp $ */
+/* $OpenBSD: subr_log.c,v 1.3 1996/04/21 22:27:17 deraadt Exp $ */
+/* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -49,8 +49,7 @@
#include <sys/file.h>
#include <sys/signalvar.h>
#include <sys/syslog.h>
-
-#include <kern/kern_conf.h>
+#include <sys/conf.h>
#define LOG_RDPRI (PZERO + 1)
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index f4124716cc0..4e5a6b0a5c8 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: subr_prf.c,v 1.3 1996/04/19 16:09:03 niklas Exp $ */
-/* $NetBSD: subr_prf.c,v 1.22 1996/03/14 19:01:11 christos Exp $ */
+/* $OpenBSD: subr_prf.c,v 1.4 1996/04/21 22:27:19 deraadt Exp $ */
+/* $NetBSD: subr_prf.c,v 1.24 1996/03/30 22:25:18 christos Exp $ */
/*-
* Copyright (c) 1986, 1988, 1991, 1993
@@ -55,6 +55,7 @@
#include <sys/tprintf.h>
#include <sys/syslog.h>
#include <sys/malloc.h>
+#include <sys/cpu.h>
#include <dev/cons.h>
@@ -96,10 +97,6 @@ const char *panicstr;
* and then reboots. If we are called twice, then we avoid trying to sync
* the disks as this often leads to recursive panics.
*/
-#ifdef __GNUC__
-volatile void boot(int flags); /* boot() does not return */
-volatile /* panic() does not return */
-#endif
void
#ifdef __STDC__
panic(const char *fmt, ...)
@@ -111,7 +108,6 @@ panic(fmt, va_alist)
{
int bootopt;
va_list ap;
- static const char fm[] = "panic: %r\n";
bootopt = RB_AUTOBOOT | RB_DUMP;
if (panicstr)
@@ -120,7 +116,7 @@ panic(fmt, va_alist)
panicstr = fmt;
va_start(ap, fmt);
- printf(fm, fmt, ap);
+ printf("panic: %:\n", fmt, ap);
va_end(ap);
#ifdef KGDB
@@ -360,14 +356,14 @@ printf(fmt, va_alist)
*
* reg=3<BITTWO,BITONE>
*
- * The format %r passes an additional format string and argument list
+ * The format %: passes an additional format string and argument list
* recursively. Its usage is:
*
* fn(char *fmt, ...)
* {
* va_list ap;
* va_start(ap, fmt);
- * printf("prefix: %r: suffix\n", fmt, ap);
+ * printf("prefix: %: suffix\n", fmt, ap);
* va_end(ap);
* }
*
@@ -437,7 +433,7 @@ reswitch: switch (ch = *(u_char *)fmt++) {
case 'c':
putchar(va_arg(ap, int), flags, tp);
break;
- case 'r':
+ case ':':
p = va_arg(ap, char *);
kprintf(p, flags, tp, va_arg(ap, va_list));
break;
diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c
index 6b86246954c..09f570c05b8 100644
--- a/sys/kern/subr_prof.c
+++ b/sys/kern/subr_prof.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: subr_prof.c,v 1.3 1996/03/03 17:20:01 niklas Exp $ */
-/* $NetBSD: subr_prof.c,v 1.10 1996/02/09 19:00:06 christos Exp $ */
+/* $OpenBSD: subr_prof.c,v 1.4 1996/04/21 22:27:21 deraadt Exp $ */
+/* $NetBSD: subr_prof.c,v 1.11 1996/03/17 02:44:40 pk Exp $ */
/*-
* Copyright (c) 1982, 1986, 1993
@@ -71,7 +71,7 @@ kmstartup()
p->lowpc = ROUNDDOWN(KERNBASE, HISTFRACTION * sizeof(HISTCOUNTER));
p->highpc = ROUNDUP((u_long)etext, HISTFRACTION * sizeof(HISTCOUNTER));
p->textsize = p->highpc - p->lowpc;
- printf("Profiling kernel, textsize=%d [%p..%p]\n",
+ printf("Profiling kernel, textsize=%ld [%lx..%lx]\n",
p->textsize, p->lowpc, p->highpc);
p->kcountsize = p->textsize / HISTFRACTION;
p->hashfraction = HASHFRACTION;
@@ -99,7 +99,8 @@ kmstartup()
/*
* Return kernel profiling information.
*/
-sysctl_doprof(name, namelen, oldp, oldlenp, newp, newlen, p)
+int
+sysctl_doprof(name, namelen, oldp, oldlenp, newp, newlen)
int *name;
u_int namelen;
void *oldp;
diff --git a/sys/kern/subr_rmap.c b/sys/kern/subr_rmap.c
index d2c070c031a..0e7662246ed 100644
--- a/sys/kern/subr_rmap.c
+++ b/sys/kern/subr_rmap.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: subr_rmap.c,v 1.2 1996/03/03 17:20:02 niklas Exp $ */
-/* $NetBSD: subr_rmap.c,v 1.10 1996/02/04 02:16:49 christos Exp $ */
+/* $OpenBSD: subr_rmap.c,v 1.3 1996/04/21 22:27:23 deraadt Exp $ */
+/* $NetBSD: subr_rmap.c,v 1.11 1996/03/16 23:17:11 christos Exp $ */
/*
* Copyright (C) 1992, 1994 Wolfgang Solfrank.
@@ -208,12 +208,12 @@ rmfree(mp, size, addr)
*/
if (fp->m_size > size) {
/* range to free is smaller, so drop that */
- printf("rmfree: map '%s' loses space (%d)\n",
+ printf("rmfree: map '%s' loses space (%ld)\n",
mp->m_name, size);
return;
} else {
/* drop the smallest slot in the list */
- printf("rmfree: map '%s' loses space (%d)\n",
+ printf("rmfree: map '%s' loses space (%ld)\n",
mp->m_name, fp->m_size);
ovbcopy(fp + 1, fp,
(char *)(mp->m_limit - 1) - (char *)fp);
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index a4af284533d..08f4d11b49d 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: sys_generic.c,v 1.2 1996/03/03 17:20:03 niklas Exp $ */
-/* $NetBSD: sys_generic.c,v 1.23 1996/02/09 19:00:09 christos Exp $ */
+/* $OpenBSD: sys_generic.c,v 1.3 1996/04/21 22:27:24 deraadt Exp $ */
+/* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -492,7 +492,7 @@ sys_ioctl(p, v, retval)
tmp = p1->p_pgrp->pg_id;
}
error = (*fp->f_ops->fo_ioctl)
- (fp, (int)TIOCSPGRP, (caddr_t)&tmp, p);
+ (fp, TIOCSPGRP, (caddr_t)&tmp, p);
break;
case FIOGETOWN:
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index b5955244de2..ae4cae35341 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: sysv_shm.c,v 1.3 1996/03/03 17:20:08 niklas Exp $ */
-/* $NetBSD: sysv_shm.c,v 1.36 1996/02/09 19:00:29 christos Exp $ */
+/* $OpenBSD: sysv_shm.c,v 1.4 1996/04/21 22:27:26 deraadt Exp $ */
+/* $NetBSD: sysv_shm.c,v 1.37 1996/03/16 23:17:13 christos Exp $ */
/*
* Copyright (c) 1994 Adam Glass and Charles Hannum. All rights reserved.
@@ -353,7 +353,7 @@ shmget_existing(p, uap, mode, segnum, retval)
return error;
if (SCARG(uap, size) && SCARG(uap, size) > shmseg->shm_segsz)
return EINVAL;
- if (SCARG(uap, shmflg) & (IPC_CREAT | IPC_EXCL) ==
+ if ((SCARG(uap, shmflg) & (IPC_CREAT | IPC_EXCL)) ==
(IPC_CREAT | IPC_EXCL))
return EEXIST;
*retval = IXSEQ_TO_IPCID(segnum, shmseg->shm_perm);
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 60235e20eca..5b1d770befb 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: tty.c,v 1.3 1996/03/03 17:20:09 niklas Exp $ */
-/* $NetBSD: tty.c,v 1.66 1996/02/09 19:00:38 christos Exp $ */
+/* $OpenBSD: tty.c,v 1.4 1996/04/21 22:27:28 deraadt Exp $ */
+/* $NetBSD: tty.c,v 1.68 1996/03/29 01:55:12 christos Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1991, 1993
@@ -1879,7 +1879,7 @@ ttyinfo(tp)
utime.tv_sec += 1;
utime.tv_usec -= 1000000;
}
- ttyprintf(tp, "%d.%02du ", utime.tv_sec,
+ ttyprintf(tp, "%ld.%02ldu ", utime.tv_sec,
utime.tv_usec / 10000);
/* Round up and print system time. */
@@ -1888,13 +1888,13 @@ ttyinfo(tp)
stime.tv_sec += 1;
stime.tv_usec -= 1000000;
}
- ttyprintf(tp, "%d.%02ds ", stime.tv_sec,
+ ttyprintf(tp, "%ld.%02lds ", stime.tv_sec,
stime.tv_usec / 10000);
-#define pgtok(a) (((a) * NBPG) / 1024)
+#define pgtok(a) (((u_long) ((a) * NBPG) / 1024))
/* Print percentage cpu, resident set size. */
tmp = (pick->p_pctcpu * 10000 + FSCALE / 2) >> FSHIFT;
- ttyprintf(tp, "%d%% %dk\n",
+ ttyprintf(tp, "%d%% %ldk\n",
tmp / 100,
pick->p_stat == SIDL || pick->p_stat == SZOMB ? 0 :
#ifdef pmap_resident_count
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index d1912abfe22..b6e07d9f5fd 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tty_pty.c,v 1.32 1996/02/09 19:00:41 christos Exp $ */
+/* $NetBSD: tty_pty.c,v 1.33 1996/03/30 22:24:45 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -52,9 +52,8 @@
#include <sys/vnode.h>
#include <sys/signalvar.h>
#include <sys/uio.h>
+#include <sys/conf.h>
-#undef NPTY /* XXX */
-#include <kern/kern_conf.h>
#if NPTY == 1
diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c
index 6115a9d5041..38c033636a4 100644
--- a/sys/kern/tty_tty.c
+++ b/sys/kern/tty_tty.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: tty_tty.c,v 1.2 1996/03/03 17:20:15 niklas Exp $ */
-/* $NetBSD: tty_tty.c,v 1.12 1996/02/04 02:17:39 christos Exp $ */
+/* $OpenBSD: tty_tty.c,v 1.3 1996/04/21 22:27:32 deraadt Exp $ */
+/* $NetBSD: tty_tty.c,v 1.13 1996/03/30 22:24:46 christos Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993
@@ -46,8 +46,8 @@
#include <sys/tty.h>
#include <sys/vnode.h>
#include <sys/file.h>
+#include <sys/conf.h>
-#include <kern/kern_conf.h>
#define cttyvp(p) ((p)->p_flag & P_CONTROLT ? (p)->p_session->s_ttyvp : NULL)
diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c
index bfc48c8c0ca..498b72b0b1a 100644
--- a/sys/kern/vfs_cluster.c
+++ b/sys/kern/vfs_cluster.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: vfs_cluster.c,v 1.2 1996/03/03 17:20:25 niklas Exp $ */
-/* $NetBSD: vfs_cluster.c,v 1.10 1996/02/09 19:00:56 christos Exp $ */
+/* $OpenBSD: vfs_cluster.c,v 1.3 1996/04/21 22:27:34 deraadt Exp $ */
+/* $NetBSD: vfs_cluster.c,v 1.11 1996/03/16 23:17:18 christos Exp $ */
/*-
* Copyright (c) 1993
@@ -297,7 +297,7 @@ cluster_rbuild(vp, filesize, bp, lbn, blkno, size, run, flags)
#ifdef DIAGNOSTIC
if (size != vp->v_mount->mnt_stat.f_iosize)
- panic("cluster_rbuild: size %d != filesize %d\n",
+ panic("cluster_rbuild: size %ld != filesize %ld\n",
size, vp->v_mount->mnt_stat.f_iosize);
#endif
if (size * (lbn + run + 1) > filesize)
@@ -624,7 +624,7 @@ cluster_wbuild(vp, last_bp, size, start_lbn, len, lbn)
#ifdef DIAGNOSTIC
if (size != vp->v_mount->mnt_stat.f_iosize)
- panic("cluster_wbuild: size %d != filesize %d\n",
+ panic("cluster_wbuild: size %ld != filesize %ld\n",
size, vp->v_mount->mnt_stat.f_iosize);
#endif
redo:
@@ -707,7 +707,7 @@ redo:
/* Move memory from children to parent */
if (tbp->b_blkno != (bp->b_blkno + btodb(bp->b_bufsize))) {
- printf("Clustered Block: %d addr %x bufsize: %d\n",
+ printf("Clustered Block: %d addr %x bufsize: %ld\n",
bp->b_lblkno, bp->b_blkno, bp->b_bufsize);
printf("Child Block: %d addr: %x\n", tbp->b_lblkno,
tbp->b_blkno);
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index d7c464703cd..eba355f8e7f 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_subr.c,v 1.51 1996/02/09 19:01:01 christos Exp $ */
+/* $NetBSD: vfs_subr.c,v 1.52 1996/03/16 23:17:20 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -1187,7 +1187,7 @@ vprint(label, vp)
if (label != NULL)
printf("%s: ", label);
- printf("type %s, usecount %d, writecount %d, refcount %d,",
+ printf("type %s, usecount %d, writecount %d, refcount %ld,",
typename[vp->v_type], vp->v_usecount, vp->v_writecount,
vp->v_holdcnt);
buf[0] = '\0';
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 617919acce6..0bb0223205a 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.5 1996/04/17 05:09:14 mickey Exp $ */
-/* $NetBSD: vfs_syscalls.c,v 1.68 1996/02/09 19:01:05 christos Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.6 1996/04/21 22:27:39 deraadt Exp $ */
+/* $NetBSD: vfs_syscalls.c,v 1.70 1996/03/22 06:51:04 thorpej Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -894,6 +894,9 @@ sys_mkfifo(p, v, retval)
void *v;
register_t *retval;
{
+#ifndef FIFO
+ return (EOPNOTSUPP);
+#else
register struct sys_mkfifo_args /* {
syscallarg(char *) path;
syscallarg(int) mode;
@@ -902,9 +905,6 @@ sys_mkfifo(p, v, retval)
int error;
struct nameidata nd;
-#ifndef FIFO
- return (EOPNOTSUPP);
-#else
NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
@@ -1090,8 +1090,8 @@ sys_unlink(p, v, retval)
goto out;
}
- if (vp->v_flag & VTEXT)
- (void)vnode_pager_uncache(vp);
+ (void)vnode_pager_uncache(vp);
+
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
error = VOP_REMOVE(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);