add {proc,lwp}_initspecific and use them to init proc0 and lwp0.
This commit is contained in:
parent
3ad77842ea
commit
057b918239
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_lwp.c,v 1.41 2006/10/08 04:28:44 thorpej Exp $ */
|
||||
/* $NetBSD: kern_lwp.c,v 1.42 2006/10/08 22:57:11 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.41 2006/10/08 04:28:44 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.42 2006/10/08 22:57:11 christos Exp $");
|
||||
|
||||
#include "opt_multiprocessor.h"
|
||||
|
||||
@ -499,8 +499,7 @@ newlwp(struct lwp *l1, struct proc *p2, vaddr_t uaddr, boolean_t inmem,
|
||||
l2->l_forw = l2->l_back = NULL;
|
||||
l2->l_proc = p2;
|
||||
|
||||
error = specificdata_init(lwp_specificdata_domain, &l2->l_specdataref);
|
||||
KASSERT(error == 0);
|
||||
lwp_initspecific(l2);
|
||||
|
||||
memset(&l2->l_startzero, 0,
|
||||
(unsigned) ((caddr_t)&l2->l_endzero -
|
||||
@ -788,6 +787,14 @@ lwp_specific_key_delete(specificdata_key_t key)
|
||||
specificdata_key_delete(lwp_specificdata_domain, key);
|
||||
}
|
||||
|
||||
void
|
||||
lwp_initspecific(struct lwp *l)
|
||||
{
|
||||
int error;
|
||||
error = specificdata_init(lwp_specificdata_domain, &l->l_specdataref);
|
||||
KASSERT(error == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* lwp_getspecific --
|
||||
* Return lwp-specific data corresponding to the specified key.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_proc.c,v 1.95 2006/10/08 04:28:44 thorpej Exp $ */
|
||||
/* $NetBSD: kern_proc.c,v 1.96 2006/10/08 22:57:11 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -69,7 +69,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.95 2006/10/08 04:28:44 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.96 2006/10/08 22:57:11 christos Exp $");
|
||||
|
||||
#include "opt_kstack.h"
|
||||
#include "opt_maxuprc.h"
|
||||
@ -377,6 +377,9 @@ proc0_init(void)
|
||||
/* Initialize signal state for proc0. */
|
||||
p->p_sigacts = &sigacts0;
|
||||
siginit(p);
|
||||
|
||||
proc_initspecific(p);
|
||||
lwp_initspecific(l);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -615,9 +618,7 @@ proc_alloc(void)
|
||||
p = pool_get(&proc_pool, PR_WAITOK);
|
||||
p->p_stat = SIDL; /* protect against others */
|
||||
|
||||
error = specificdata_init(proc_specificdata_domain, &p->p_specdataref);
|
||||
KASSERT(error == 0);
|
||||
|
||||
proc_initspecific(p);
|
||||
/* allocate next free pid */
|
||||
|
||||
for (;;expand_pid_table()) {
|
||||
@ -1309,6 +1310,14 @@ proc_specific_key_delete(specificdata_key_t key)
|
||||
specificdata_key_delete(proc_specificdata_domain, key);
|
||||
}
|
||||
|
||||
void
|
||||
proc_initspecific(struct proc *p)
|
||||
{
|
||||
int error;
|
||||
error = specificdata_init(proc_specificdata_domain, &p->p_specdataref);
|
||||
KASSERT(error == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* proc_getspecific --
|
||||
* Return proc-specific data corresponding to the specified key.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lwp.h,v 1.42 2006/10/08 04:28:44 thorpej Exp $ */
|
||||
/* $NetBSD: lwp.h,v 1.43 2006/10/08 22:57:11 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -204,6 +204,7 @@ void lwp_update_creds(struct lwp *);
|
||||
|
||||
int lwp_specific_key_create(specificdata_key_t *, specificdata_dtor_t);
|
||||
void lwp_specific_key_delete(specificdata_key_t);
|
||||
void lwp_initspecific(struct lwp *);
|
||||
void * lwp_getspecific(struct lwp *, specificdata_key_t);
|
||||
void lwp_setspecific(struct lwp *, specificdata_key_t, void *);
|
||||
#endif /* _KERNEL */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: proc.h,v 1.228 2006/10/08 04:28:44 thorpej Exp $ */
|
||||
/* $NetBSD: proc.h,v 1.229 2006/10/08 22:57:11 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1986, 1989, 1991, 1993
|
||||
@ -519,6 +519,7 @@ void proc_crmod_enter(struct proc *);
|
||||
|
||||
int proc_specific_key_create(specificdata_key_t *, specificdata_dtor_t);
|
||||
void proc_specific_key_delete(specificdata_key_t);
|
||||
void proc_initspecific(struct proc *);
|
||||
void * proc_getspecific(struct proc *, specificdata_key_t);
|
||||
void proc_setspecific(struct proc *, specificdata_key_t, void *);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user