-/* $OpenBSD: machdep.c,v 1.31 2000/02/22 19:27:40 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.32 2000/03/23 09:59:52 art Exp $ */
/* $NetBSD: machdep.c,v 1.61 1996/12/07 01:54:49 cgd Exp $ */
/*
#ifdef REAL_CLISTS
#include <sys/clist.h>
#endif
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
#ifdef REAL_CLISTS
valloc(cfree, struct cblock, nclist);
#endif
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
- callout[i-1].c_next = NULL;
+ timeout_init();
#if defined(DEBUG)
pmapdebug = opmapdebug;
-/* $OpenBSD: machdep.c,v 1.36 2000/02/22 19:27:42 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.37 2000/03/23 09:59:53 art Exp $ */
/* $NetBSD: machdep.c,v 1.95 1997/08/27 18:31:17 is Exp $ */
/*
#include <sys/conf.h>
#include <sys/file.h>
#include <sys/clist.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
#define valloclim(name, type, num, lim) \
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
/* valloc(cfree, struct cblock, nclist); */
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
VM_MBUF_SIZE, FALSE);
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i - 1].c_next = &callout[i];
+ timeout_init();
#ifdef DEBUG
pmapdebug = opmapdebug;
-/* $OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $ */
+/* $OpenBSD: machdep.c,v 1.37 2000/03/23 09:59:53 art Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1992, 1993
* SUCH DAMAGE.
*
* from: @(#)machdep.c 8.3 (Berkeley) 1/12/94
- * $Id: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $
+ * $Id: machdep.c,v 1.37 2000/03/23 09:59:53 art Exp $
*/
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
#include <sys/conf.h>
#include <sys/file.h>
#include <sys/clist.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
#ifdef REAL_CLISTS
valloc(cfree, struct cblock, nclist);
#endif
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
- callout[i-1].c_next = NULL;
+ timeout_init();
#ifdef DEBUG
pmapdebug = opmapdebug;
-/* $OpenBSD: machdep.c,v 1.5 1999/05/22 21:22:20 weingart Exp $ */
+/* $OpenBSD: machdep.c,v 1.6 2000/03/23 09:59:53 art Exp $ */
/* $NetBSD: machdep.c,v 1.6 1996/03/13 21:32:39 mark Exp $ */
/*
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/reboot.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/proc.h>
#include <sys/user.h>
#include <sys/kernel.h>
*/
/*
- * Initialise callouts
+ * Initialise timeouts
*/
-
- callfree = callout;
-
- for (loop = 1; loop < ncallout; ++loop)
- callout[loop - 1].c_next = &callout[loop];
+ timeout_init();
printf("avail mem = %d (%d pages)\n", (int)ptoa(cnt.v_free_count),
(int)ptoa(cnt.v_free_count) / NBPG);
(caddr_t)(name) = (type *)v; \
v = (caddr_t)((name) + (num));
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#include <sys/conf.h>
#include <sys/file.h>
#include <sys/clist.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
#define valloclim(name, type, num, lim) \
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
/* valloc(cfree, struct cblock, nclist); */
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
VM_MBUF_SIZE, FALSE);
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
+ timeout_init();
#ifdef DEBUG
pmapdebug = opmapdebug;
-/* $OpenBSD: machdep.c,v 1.39 2000/02/22 19:27:46 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.40 2000/03/23 09:59:54 art Exp $ */
/* $NetBSD: machdep.c,v 1.94 1997/06/12 15:46:29 mrg Exp $ */
/*
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/clist.h>
#include <sys/conf.h>
#include <sys/exec.h>
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
- callout[i-1].c_next = NULL;
+ timeout_init();
#ifdef DEBUG
pmapdebug = opmapdebug;
#ifdef REAL_CLISTS
valloc(cfree, struct cblock, nclist);
#endif
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
-/* $OpenBSD: machdep.c,v 1.23 2000/03/16 22:11:03 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.24 2000/03/23 09:59:54 art Exp $ */
/*
* Copyright (c) 1999-2000 Michael Shalayeff
#include <sys/device.h>
#include <sys/conf.h>
#include <sys/file.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
valloc(cfree, struct cblock, nclist);
#endif
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
valloc(buf, struct buf, nbuf);
#ifdef SYSVSHM
VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL);
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
- callout[i-1].c_next = NULL;
+ timeout_init();
#ifdef DEBUG
pmapdebug = opmapdebug;
-/* $OpenBSD: machdep.c,v 1.127 2000/03/16 22:11:03 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.128 2000/03/23 09:59:54 art Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
#include <sys/reboot.h>
#include <sys/conf.h>
#include <sys/file.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
#endif
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
+ timeout_init();
#if defined(UVM)
printf("avail mem = %lu (%uK)\n", ptoa(uvmexp.free),
#ifdef REAL_CLISTS
valloc(cfree, struct cblock, nclist);
#endif
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
#include <sys/reboot.h>
#include <sys/conf.h>
#include <sys/file.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
+ timeout_init();
printf("avail mem = 0x%x\n", ptoa(cnt.v_free_count));
printf("using %d buffers containing %d bytes of memory\n",
(name) = (type *)v; v = (caddr_t)((name)+(num))
#define valloclim(name, type, num, lim) \
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
-/* $OpenBSD: machdep.c,v 1.65 2000/02/22 19:27:52 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.66 2000/03/23 09:59:54 art Exp $ */
/* $NetBSD: machdep.c,v 1.134 1997/02/14 06:15:30 scottr Exp $ */
/*
#include <sys/conf.h>
#include <sys/file.h>
#include <sys/clist.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
#ifdef REAL_CLISTS
valloc(cfree, struct cblock, nclist);
#endif
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
VM_MBUF_SIZE, FALSE);
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i - 1].c_next = &callout[i];
+ timeout_init();
printf("avail mem = %ld\n", ptoa(cnt.v_free_count));
printf("using %d buffers containing %d bytes of memory\n",
-/* $OpenBSD: machdep.c,v 1.32 2000/02/22 19:27:54 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.33 2000/03/23 09:59:55 art Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
#include <sys/conf.h>
#include <sys/file.h>
#include <sys/clist.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
#ifdef REAL_CLISTS
valloc(cfree, struct cblock, nclist);
#endif
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
- callout[i-1].c_next = NULL;
+ timeout_init();
#ifdef DEBUG
pmapdebug = opmapdebug;
-/* $OpenBSD: machdep.c,v 1.19 2000/02/22 19:27:55 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.20 2000/03/23 09:59:55 art Exp $ */
/*
* Copyright (c) 1998, 1999 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
#include <sys/reboot.h>
#include <sys/conf.h>
#include <sys/file.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/mount.h>
VM_MBUF_SIZE, FALSE);
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
- callout[i-1].c_next = NULL;
+ timeout_init();
printf("avail mem = %d\n", ptoa(cnt.v_free_count));
printf("using %d buffers containing %d bytes of memory\n",
#ifdef REAL_CLISTS
valloc(cfree, struct cblock, nclist);
#endif
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#if 0
valloc(swapmap, struct map, nswapmap = maxproc * 2);
#endif
#include <sys/reboot.h>
#include <sys/conf.h>
#include <sys/file.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
(name) = (type *)v; v = (caddr_t)((name)+(num))
#define valloclim(name, type, num, lim) \
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
+ timeout_init();
printf("avail mem = 0x%x\n", ptoa(cnt.v_free_count));
printf("using %d buffers containing %d bytes of memory\n",
#include <sys/conf.h>
#include <sys/file.h>
#include <sys/clist.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
#ifdef REAL_CLISTS
valloc(cfree, struct cblock, nclist);
#endif
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
- callout[i-1].c_next = NULL;
+ timeout_init();
#ifdef DEBUG
pmapdebug = opmapdebug;
-/* $OpenBSD: machdep.c,v 1.35 2000/03/23 04:01:55 rahnds Exp $ */
+/* $OpenBSD: machdep.c,v 1.36 2000/03/23 09:59:56 art Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
#include <sys/param.h>
#include <sys/buf.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/exec.h>
#include <sys/malloc.h>
#include <sys/map.h>
#endif
/*
- * Initialize callouts.
+ * Initialize timeouts.
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i - 1].c_next = &callout[i];
+ timeout_init();
#ifdef UVM
printf("avail mem = %d\n", ptoa(uvmexp.free));
#define valloc(name, type, num) \
v = (caddr_t)(((name) = (type *)v) + (num))
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
-/* $OpenBSD: machdep.c,v 1.47 2000/03/16 22:11:02 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.48 2000/03/23 09:59:56 art Exp $ */
/* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */
/*
#include <sys/conf.h>
#include <sys/file.h>
#include <sys/clist.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/mount.h>
VM_MBUF_SIZE, FALSE);
#endif
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
- callout[i-1].c_next = NULL;
+ timeout_init();
#ifdef DEBUG
pmapdebug = opmapdebug;
#define valloc(name, type, num) \
v = (caddr_t)(((name) = (type *)v) + (num))
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
-/* $OpenBSD: machdep.c,v 1.25 2000/03/02 23:02:14 todd Exp $ */
+/* $OpenBSD: machdep.c,v 1.26 2000/03/23 09:59:56 art Exp $ */
/* $NetBSD: machdep.c,v 1.77 1996/10/13 03:47:51 christos Exp $ */
/*
#include <sys/conf.h>
#include <sys/file.h>
#include <sys/clist.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
#ifdef REAL_CLISTS
valloc(cfree, struct cblock, nclist);
#endif
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeoutout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
VM_MBUF_SIZE, FALSE);
/*
- * Initialize callouts
+ * Initialize timeouts
*/
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
- callout[i-1].c_next = NULL;
+ timeout_init();
printf("avail mem = %ld\n", ptoa(cnt.v_free_count));
printf("using %d buffers containing %d bytes of memory\n",
-/* $OpenBSD: machdep.c,v 1.20 1999/12/08 06:50:17 itojun Exp $ */
+/* $OpenBSD: machdep.c,v 1.21 2000/03/23 09:59:56 art Exp $ */
/* $NetBSD: machdep.c,v 1.45 1997/07/26 10:12:49 ragge Exp $ */
/*
#include <sys/mbuf.h>
#include <sys/reboot.h>
#include <sys/conf.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/device.h>
#include <sys/exec.h>
#include <sys/mount.h>
phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, TRUE);
- /*
- * Initialize callouts
- */
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i - 1].c_next = &callout[i];
- callout[i - 1].c_next = NULL;
+ timeout_init();
printf("avail mem = %d\n", (int)ptoa(cnt.v_free_count));
printf("Using %d buffers containing %d bytes of memory.\n", nbuf,
#ifdef REAL_CLISTS
valloc(cfree, struct cblock, nclist);
#endif
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
-/* $OpenBSD: machdep.c,v 1.5 1999/05/22 21:22:32 weingart Exp $ */
+/* $OpenBSD: machdep.c,v 1.6 2000/03/23 09:59:56 art Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1992, 1993
* SUCH DAMAGE.
*
* from: @(#)machdep.c 8.3 (Berkeley) 1/12/94
- * $Id: machdep.c,v 1.5 1999/05/22 21:22:32 weingart Exp $
+ * $Id: machdep.c,v 1.6 2000/03/23 09:59:56 art Exp $
*/
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
#include <sys/conf.h>
#include <sys/file.h>
#include <sys/clist.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
#ifdef REAL_CLISTS
valloc(cfree, struct cblock, nclist);
#endif
- valloc(callout, struct callout, ncallout);
+ valloc(timeouts, struct timeout, ntimeout);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
- /*
- * Initialize callouts
- */
- callfree = callout;
- for (i = 1; i < ncallout; i++)
- callout[i-1].c_next = &callout[i];
- callout[i-1].c_next = NULL;
+
+ timeout_init();
#ifdef DEBUG
pmapdebug = opmapdebug;
-# $OpenBSD: files,v 1.154 2000/03/19 06:53:40 deraadt Exp $
+# $OpenBSD: files,v 1.155 2000/03/23 09:59:56 art Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
file kern/kern_sysctl.c
file kern/kern_synch.c
file kern/kern_time.c
+file kern/kern_timeout.c
file kern/kern_xxx.c
file kern/subr_autoconf.c
file kern/subr_disk.c
-/* $OpenBSD: param.c,v 1.8 2000/03/21 14:55:52 deraadt Exp $ */
+/* $OpenBSD: param.c,v 1.9 2000/03/23 09:59:56 art Exp $ */
/* $NetBSD: param.c,v 1.16 1996/03/12 03:08:40 mrg Exp $ */
/*
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/file.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#ifdef REAL_CLISTS
#include <sys/clist.h>
#endif
#define NVNODE (NPROC * 2 + NTEXT + 100)
int desiredvnodes = NVNODE;
int maxfiles = 3 * (NPROC + MAXUSERS) + 80;
-int ncallout = (16 + NPROC) * 2;
+int ntimeout = (16 + NPROC) * 2;
#ifdef REAL_CLISTS
int nclist = 60 + 12 * MAXUSERS;
#endif
* them here forces loader errors if this file is omitted
* (if they've been externed everywhere else; hah!).
*/
-struct callout *callout;
+struct timeout *timeouts;
struct cblock *cfree;
struct buf *buf, *swbuf;
char *buffers;
-/* $OpenBSD: kern_clock.c,v 1.21 1999/08/15 00:07:43 pjanzen Exp $ */
+/* $OpenBSD: kern_clock.c,v 1.22 2000/03/23 09:59:57 art Exp $ */
/* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */
/*-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/dkstat.h>
-#include <sys/callout.h>
+#include <sys/timeout.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
hardclock(frame)
register struct clockframe *frame;
{
- register struct callout *p1;
register struct proc *p;
register int delta, needsoft;
extern int tickdelta;
/*
* 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;
- }
+ needsoft = timeout_hardclock_update();
p = curproc;
if (p) {
}
}
-/*
- * 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.
clkinfo.stathz = stathz ? stathz : hz;
return (sysctl_rdstruct(where, sizep, NULL, &clkinfo, sizeof(clkinfo)));
}
-
-#ifdef DDB
-#include <machine/db_machdep.h>
-
-#include <ddb/db_interface.h>
-#include <ddb/db_access.h>
-#include <ddb/db_sym.h>
-#include <ddb/db_output.h>
-
-void db_show_callout(addr, haddr, count, modif)
- db_expr_t addr;
- int haddr;
- db_expr_t 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((db_addr_t)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
--- /dev/null
+/* $OpenBSD: kern_timeout.c,v 1.1 2000/03/23 09:59:57 art Exp $ */
+/*
+ * Copyright (c) 2000 Artur Grabowski <art@openbsd.org>
+ * 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. 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 ``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/param.h>
+#include <sys/systm.h>
+#include <sys/lock.h>
+#include <sys/timeout.h>
+
+#ifdef DDB
+#include <machine/db_machdep.h>
+#include <ddb/db_interface.h>
+#include <ddb/db_access.h>
+#include <ddb/db_sym.h>
+#include <ddb/db_output.h>
+#endif
+
+/*
+ * Timeouts are kept on a queue. The to_time is the value of the global
+ * variable "ticks" when the timeout should be called.
+ *
+ * In the future we might want to build a timer wheel to improve the speed
+ * of timeout_add (right now it's linear). See "Redesigning the BSD Callout
+ * and Timer Facilities" by Adam M. Costello and Geroge Varghese.
+ */
+
+TAILQ_HEAD(,timeout) timeout_todo; /* Queue of timeouts. */
+TAILQ_HEAD(,timeout) timeout_static; /* Static pool of timeouts. */
+
+/*
+ * All lists are locked with the same lock (which must also block out all
+ * interrupts).
+ */
+struct simplelock _timeout_lock;
+
+#define timeout_list_lock(s) \
+ do { *(s) = splhigh(); simple_lock(&_timeout_lock); } while (0)
+#define timeout_list_unlock(s) \
+ do { simple_unlock(&_timeout_lock); splx(s); } while (0)
+
+/*
+ * Some of the "math" in here is a bit tricky.
+ *
+ * We have to beware of wrapping ints.
+ * We use the fact that any element added to the list must be added with a
+ * positive time. That means that any element `to' on the list cannot be
+ * scheduled to timeout further in time than INT_MAX, but to->to_time can
+ * be positive or negative so comparing it with anything is dangerous.
+ * The only way we can use the to->to_time value in any predictable way
+ * is when we caluculate how far in the future `to' will timeout -
+ *"to->to_time - ticks". The result will always be positive for future
+ * timeouts and 0 or negative for due timeouts.
+ */
+extern int ticks; /* XXX - move to sys/X.h */
+
+void
+timeout_init()
+{
+ int i;
+
+ TAILQ_INIT(&timeout_todo);
+ TAILQ_INIT(&timeout_static);
+ simple_lock_init(&_timeout_lock);
+
+ for (i = 0; i < ntimeout; i++)
+ TAILQ_INSERT_HEAD(&timeout_static, &timeouts[i], to_list);
+}
+
+void
+timeout_set(to, fn, arg)
+ struct timeout *to;
+ void (*fn)(void *);
+ void *arg;
+{
+
+ to->to_func = fn;
+ to->to_arg = arg;
+ to->to_flags = 0;
+}
+
+void
+timeout_add(new, to_ticks)
+ struct timeout *new;
+ int to_ticks;
+{
+ struct timeout *to;
+ int s;
+
+ /*
+ * You are supposed to understand this function before you fiddle.
+ */
+
+#ifdef DIAGNOSTIC
+ if (to_ticks < 0)
+ panic("timeout_add: to_ticks < 0");
+#endif
+
+ timeout_list_lock(&s);
+
+ /*
+ * First we prepare the now timeout so that we can return right
+ * after the insertion in the queue (makes the code simpler).
+ */
+
+ /* If this timeout was already on a queue we remove it. */
+ if (new->to_flags & TIMEOUT_ONQUEUE)
+ TAILQ_REMOVE(&timeout_todo, to, to_list);
+ else
+ new->to_flags |= TIMEOUT_ONQUEUE;
+ /* Initialize the time here, it won't change. */
+ new->to_time = to_ticks + ticks;
+
+ /*
+ * Walk the list of pending timeouts and find an entry which
+ * will timeout after we do, insert the new timeout there.
+ */
+ TAILQ_FOREACH(to, &timeout_todo, to_list) {
+ if (to->to_time - ticks >= to_ticks) {
+ TAILQ_INSERT_BEFORE(to, new, to_list);
+ goto out;
+ }
+ }
+
+ /* We can only get here if we're the last (or only) entry */
+ TAILQ_INSERT_TAIL(&timeout_todo, new, to_list);
+out:
+ timeout_list_unlock(s);
+}
+
+void
+timeout_del(to)
+ struct timeout *to;
+{
+ int s;
+
+ timeout_list_lock(&s);
+ if (to->to_flags & TIMEOUT_ONQUEUE) {
+ TAILQ_REMOVE(&timeout_todo, to, to_list);
+ to->to_flags &= ~TIMEOUT_ONQUEUE;
+ }
+ timeout_list_unlock(s);
+}
+
+/*
+ * This is called from hardclock() once every tick.
+ * We return !0 if we need to schedule a softclock.
+ *
+ * We don't need locking in here.
+ */
+int
+timeout_hardclock_update()
+{
+ return (TAILQ_FIRST(&timeout_todo)->to_time - ticks <= 0);
+}
+
+void
+softclock()
+{
+ int s;
+ struct timeout *to;
+ void (*fn) __P((void *));
+ void *arg;
+
+ timeout_list_lock(&s);
+ while ((to = TAILQ_FIRST(&timeout_todo)) != NULL &&
+ to->to_time - ticks <= 0) {
+
+ TAILQ_REMOVE(&timeout_todo, to, to_list);
+ to->to_flags &= ~TIMEOUT_ONQUEUE;
+
+ fn = to->to_func;
+ arg = to->to_arg;
+
+ if (to->to_flags & TIMEOUT_STATIC)
+ TAILQ_INSERT_HEAD(&timeout_static, to, to_list);
+ timeout_list_unlock(s);
+ fn(arg);
+ timeout_list_lock(&s);
+ }
+ timeout_list_unlock(s);
+}
+
+/*
+ * Legacy interfaces. timeout() and untimeout()
+ *
+ * Kill those when everything is converted. They are slow and use the
+ * static pool (which causes (potential and real) problems).
+ */
+
+void
+timeout(fn, arg, to_ticks)
+ void (*fn) __P((void *));
+ void *arg;
+ int to_ticks;
+{
+ struct timeout *to;
+ int s;
+
+ if (to_ticks <= 0)
+ to_ticks = 1;
+
+ /*
+ * Get a timeout struct from the static list.
+ */
+ timeout_list_lock(&s);
+
+ to = TAILQ_FIRST(&timeout_static);
+ if (to == NULL)
+ panic("timeout table full");
+ TAILQ_REMOVE(&timeout_static, to, to_list);
+
+ timeout_list_unlock(s);
+
+ timeout_set(to, fn, arg);
+ to->to_flags = TIMEOUT_STATIC;
+ timeout_add(to, to_ticks);
+}
+
+void
+untimeout(fn, arg)
+ void (*fn) __P((void *));
+ void *arg;
+{
+ int s;
+ struct timeout *to;
+
+ timeout_list_lock(&s);
+ TAILQ_FOREACH(to, &timeout_todo, to_list) {
+ if (to->to_func == fn && to->to_arg == arg) {
+#ifdef DIAGNOSTIC
+ if ((to->to_flags & TIMEOUT_ONQUEUE) == 0)
+ panic("untimeout: not TIMEOUT_ONQUEUE");
+ if ((to->to_flags & TIMEOUT_STATIC) == 0)
+ panic("untimeout: not static");
+#endif
+ TAILQ_REMOVE(&timeout_todo, to, to_list);
+ to->to_flags &= ~TIMEOUT_ONQUEUE;
+ /* return it to the static pool */
+ TAILQ_INSERT_HEAD(&timeout_static, to, to_list);
+ break;
+ }
+ }
+ timeout_list_unlock(s);
+}
+
+#ifdef DDB
+void
+db_show_callout(addr, haddr, count, modif)
+ db_expr_t addr;
+ int haddr;
+ db_expr_t count;
+ char *modif;
+{
+ struct timeout *to;
+ int s;
+ db_expr_t offset;
+ char *name;
+
+ db_printf("ticks now: %d\n", ticks);
+ db_printf(" ticks arg func\n");
+
+ timeout_list_lock(&s);
+
+ TAILQ_FOREACH(to, &timeout_todo, to_list) {
+ db_find_sym_and_offset((db_addr_t)to->to_func, &name, &offset);
+
+ name = name ? name : "?";
+
+ db_printf("%9d %8x %s\n", to->to_time, to->to_arg, name);
+ }
+
+ timeout_list_unlock(s);
+
+}
+#endif
+++ /dev/null
-/* $OpenBSD: callout.h,v 1.2 1996/03/03 12:11:22 niklas Exp $ */
-/* $NetBSD: callout.h,v 1.10 1995/03/26 20:23:56 jtc Exp $ */
-
-/*-
- * Copyright (c) 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.
- *
- * @(#)callout.h 8.2 (Berkeley) 1/21/94
- */
-
-struct callout {
- struct callout *c_next; /* next callout in queue */
- void *c_arg; /* function argument */
- void (*c_func) __P((void *)); /* function to call */
- int c_time; /* ticks to the event */
-};
-
-#ifdef _KERNEL
-struct callout *callfree, *callout, calltodo;
-int ncallout;
-#endif
--- /dev/null
+/* $OpenBSD: timeout.h,v 1.1 2000/03/23 09:59:57 art Exp $ */
+/*
+ * Copyright (c) 2000 Artur Grabowski <art@openbsd.org>
+ * 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. 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 ``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/queue.h>
+
+/*
+ * Interface for handling time driven events in the kernel.
+ *
+ * The basic component of this API is the struct timeout. The user should
+ * touch the internals of this structure, but it's the users responsibility
+ * to allocate and deallocate timeouts.
+ *
+ * Ther functions used to manipulate timeouts are:
+ * - timeout_set(timeout, function, argument)
+ * Initializes a timeout struct to call the function with the argument.
+ * A timeout only needs to be initialized once.
+ * - timeout_add(timeout, ticks)
+ * Schedule this timeout to run in "ticks" ticks (there are hz ticks in
+ * one second). You may not touch the timeout with timeout_set once the
+ * timeout is scheduled. A second call to timeout_add with an already
+ * scheduled timeout will cause the old timeout to be canceled and the
+ * new will be scheduled.
+ * - timeout_del(timeout)
+ * Remove the timeout from the timeout queue. It's legal to remove
+ * a timeout that has already happened.
+ *
+ * These functions may be called in interrupt context (anything below splhigh).
+ *
+ * XXX - the old timeout()/untimeout() API is kept for compatibility, you may
+ * not use the new API if there is a risk that the same function/argument
+ * pairs are mixed in the new and old API.
+ */
+
+struct timeout {
+ TAILQ_ENTRY(timeout) to_list; /* timeout queue */
+ void (*to_func) __P((void *)); /* function to call */
+ void *to_arg; /* function argument */
+ int to_time; /* ticks on event */
+ int to_flags; /* misc flags */
+};
+
+/*
+ * flags in the to_flags field.
+ */
+#define TIMEOUT_STATIC 1 /* allocated from static pool */
+#define TIMEOUT_ONQUEUE 2 /* timeout is on the todo queue */
+
+void timeout_set __P((struct timeout *, void (*)(void *), void *));
+void timeout_add __P((struct timeout *, int));
+void timeout_del __P((struct timeout *));
+
+/*
+ * timeout_init - called by the machine dependent code to initialize a static
+ * list of preallocated timeout structures.
+ */
+void timeout_init __P((void));
+
+/*
+ * called once every hardclock. returns non-zero if we need to schedule a
+ * softclock.
+ */
+int timeout_hardclock_update __P((void));
+
+/*
+ * XXX - this should go away.
+ */
+extern int ntimeout;
+extern struct timeout *timeouts;