diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2004-05-23 19:37:25 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2004-05-23 19:37:25 +0000 |
commit | c6dc25d23c99899b769c7a094fcf6b17b52c1eaf (patch) | |
tree | f42376d3c60bee949bf91e05b38478b32a210f1b | |
parent | 9e61a8a078d45d84be55c7d6d4894930aba60e58 (diff) |
according to fork1(9), retval is optional. make it so.
from form@pdp-11.org.ru via mpech. ok millert
-rw-r--r-- | sys/kern/kern_fork.c | 14 | ||||
-rw-r--r-- | sys/kern/kern_malloc.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_sysctl.c | 11 | ||||
-rw-r--r-- | sys/kern/uipc_mbuf.c | 8 |
4 files changed, 21 insertions, 15 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index cbcbc568c91..b2b196c20b9 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.64 2004/04/02 19:08:58 tedu Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.65 2004/05/23 19:37:24 tedu Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -184,10 +184,6 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize, /* Allocate new proc. */ p2 = pool_get(&proc_pool, PR_WAITOK); - p2->p_stat = SIDL; /* protect against others */ - p2->p_exitsig = exitsig; - p2->p_forw = p2->p_back = NULL; - /* * Make a proc table entry for the new process. * Start by zeroing the section of proc that is zero-initialized, @@ -197,6 +193,8 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize, (unsigned) ((caddr_t)&p2->p_endzero - (caddr_t)&p2->p_startzero)); bcopy(&p1->p_startcopy, &p2->p_startcopy, (unsigned) ((caddr_t)&p2->p_endcopy - (caddr_t)&p2->p_startcopy)); + p2->p_stat = SIDL; /* protect against others */ + p2->p_exitsig = exitsig; /* * Initialize the timeouts. @@ -371,8 +369,10 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize, * Return child pid to parent process, * marking us as parent via retval[1]. */ - retval[0] = p2->p_pid; - retval[1] = 0; + if (retval != NULL) { + retval[0] = p2->p_pid; + retval[1] = 0; + } return (0); } diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 082a7b2d764..cdca5cc3995 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.56 2003/12/28 16:35:46 tedu Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.57 2004/05/23 19:37:24 tedu Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -40,6 +40,7 @@ #include <sys/sysctl.h> #include <uvm/uvm_extern.h> +#include <ddb/db_output.h> static struct vm_map_intrsafe kmem_map_store; struct vm_map *kmem_map = NULL; diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index ece5249fa89..728bc484fe6 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.106 2004/04/19 22:52:33 tedu Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.107 2004/05/23 19:37:24 tedu Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -525,7 +525,6 @@ hw_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) int err; int cpuspeed; static int perflevel = 100; - int operflevel; /* all sysctl names at this level except sensors are terminal */ if (name[0] != HW_SENSORS && namelen != 1) @@ -577,17 +576,17 @@ hw_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) case HW_SETPERF: if (!cpu_setperf) return (EOPNOTSUPP); - operflevel = perflevel; err = sysctl_int(oldp, oldlenp, newp, newlen, &perflevel); if (err) return err; - if (perflevel == operflevel) - return (0); if (perflevel > 100) perflevel = 100; if (perflevel < 0) perflevel = 0; - return (cpu_setperf(perflevel)); + if (newp) + return (cpu_setperf(perflevel)); + else + return (0); default: return (EOPNOTSUPP); } diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 9a8fd13e121..9520dd2552a 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.67 2004/04/19 22:52:33 tedu Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.68 2004/05/23 19:37:24 tedu Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -92,6 +92,9 @@ struct mbstat mbstat; /* mbuf stats */ struct pool mbpool; /* mbuf pool */ struct pool mclpool; /* mbuf cluster pool */ +struct pool_cache mbpool_cache; +struct pool_cache mclpool_cache; + struct vm_map *mb_map; int max_linkhdr; /* largest link-level header */ @@ -124,6 +127,9 @@ mbinit() pool_set_drain_hook(&mbpool, m_reclaim, NULL); pool_set_drain_hook(&mclpool, m_reclaim, NULL); + pool_cache_init(&mbpool_cache, &mbpool, NULL, NULL, NULL); + pool_cache_init(&mclpool_cache, &mclpool, NULL, NULL, NULL); + nmbclust_update(); /* |