- Initialize uihashtbl in resource_init();
- Make some variables static, remove the externs from header; - Wrap few long lines, misc; No functional changes are intended.
This commit is contained in:
parent
b09761a4bb
commit
05595560a2
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: kern_proc.c,v 1.129 2008/01/02 11:48:51 ad Exp $ */
|
/* $NetBSD: kern_proc.c,v 1.130 2008/03/17 00:18:24 rmind Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1999, 2006, 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 1999, 2006, 2007 The NetBSD Foundation, Inc.
|
||||||
@ -69,7 +69,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.129 2008/01/02 11:48:51 ad Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.130 2008/03/17 00:18:24 rmind Exp $");
|
||||||
|
|
||||||
#include "opt_kstack.h"
|
#include "opt_kstack.h"
|
||||||
#include "opt_maxuprc.h"
|
#include "opt_maxuprc.h"
|
||||||
@ -330,9 +330,6 @@ procinit(void)
|
|||||||
pid_alloc_lim = pid_tbl_mask - 1;
|
pid_alloc_lim = pid_tbl_mask - 1;
|
||||||
#undef LINK_EMPTY
|
#undef LINK_EMPTY
|
||||||
|
|
||||||
uihashtbl =
|
|
||||||
hashinit(maxproc / 16, HASH_LIST, M_PROC, M_WAITOK, &uihash);
|
|
||||||
|
|
||||||
proc_specificdata_domain = specificdata_domain_create();
|
proc_specificdata_domain = specificdata_domain_create();
|
||||||
KASSERT(proc_specificdata_domain != NULL);
|
KASSERT(proc_specificdata_domain != NULL);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: kern_resource.c,v 1.133 2008/02/24 21:44:51 christos Exp $ */
|
/* $NetBSD: kern_resource.c,v 1.134 2008/03/17 00:18:24 rmind Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1982, 1986, 1991, 1993
|
* Copyright (c) 1982, 1986, 1991, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.133 2008/02/24 21:44:51 christos Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.134 2008/03/17 00:18:24 rmind Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -65,12 +65,14 @@ __KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.133 2008/02/24 21:44:51 christos
|
|||||||
rlim_t maxdmap = MAXDSIZ;
|
rlim_t maxdmap = MAXDSIZ;
|
||||||
rlim_t maxsmap = MAXSSIZ;
|
rlim_t maxsmap = MAXSSIZ;
|
||||||
|
|
||||||
struct uihashhead *uihashtbl;
|
static kmutex_t uihashtbl_lock;
|
||||||
u_long uihash; /* size of hash table - 1 */
|
static LIST_HEAD(uihashhead, uidinfo) *uihashtbl;
|
||||||
kmutex_t uihashtbl_lock;
|
static u_long uihash;
|
||||||
|
|
||||||
static pool_cache_t plimit_cache;
|
#define UIHASH(uid) (&uihashtbl[(uid) & uihash])
|
||||||
static pool_cache_t pstats_cache;
|
|
||||||
|
static pool_cache_t plimit_cache;
|
||||||
|
static pool_cache_t pstats_cache;
|
||||||
|
|
||||||
void
|
void
|
||||||
resource_init(void)
|
resource_init(void)
|
||||||
@ -80,6 +82,8 @@ resource_init(void)
|
|||||||
"plimitpl", NULL, IPL_NONE, NULL, NULL, NULL);
|
"plimitpl", NULL, IPL_NONE, NULL, NULL, NULL);
|
||||||
pstats_cache = pool_cache_init(sizeof(struct pstats), 0, 0, 0,
|
pstats_cache = pool_cache_init(sizeof(struct pstats), 0, 0, 0,
|
||||||
"pstatspl", NULL, IPL_NONE, NULL, NULL, NULL);
|
"pstatspl", NULL, IPL_NONE, NULL, NULL, NULL);
|
||||||
|
uihashtbl = hashinit(maxproc / 16, HASH_LIST, M_PROC,
|
||||||
|
M_WAITOK, &uihash);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -87,7 +91,8 @@ resource_init(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
sys_getpriority(struct lwp *l, const struct sys_getpriority_args *uap, register_t *retval)
|
sys_getpriority(struct lwp *l, const struct sys_getpriority_args *uap,
|
||||||
|
register_t *retval)
|
||||||
{
|
{
|
||||||
/* {
|
/* {
|
||||||
syscallarg(int) which;
|
syscallarg(int) which;
|
||||||
@ -148,7 +153,8 @@ sys_getpriority(struct lwp *l, const struct sys_getpriority_args *uap, register_
|
|||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
int
|
int
|
||||||
sys_setpriority(struct lwp *l, const struct sys_setpriority_args *uap, register_t *retval)
|
sys_setpriority(struct lwp *l, const struct sys_setpriority_args *uap,
|
||||||
|
register_t *retval)
|
||||||
{
|
{
|
||||||
/* {
|
/* {
|
||||||
syscallarg(int) which;
|
syscallarg(int) which;
|
||||||
@ -251,7 +257,8 @@ donice(struct lwp *l, struct proc *chgp, int n)
|
|||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
int
|
int
|
||||||
sys_setrlimit(struct lwp *l, const struct sys_setrlimit_args *uap, register_t *retval)
|
sys_setrlimit(struct lwp *l, const struct sys_setrlimit_args *uap,
|
||||||
|
register_t *retval)
|
||||||
{
|
{
|
||||||
/* {
|
/* {
|
||||||
syscallarg(int) which;
|
syscallarg(int) which;
|
||||||
@ -384,7 +391,8 @@ dosetrlimit(struct lwp *l, struct proc *p, int which, struct rlimit *limp)
|
|||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
int
|
int
|
||||||
sys_getrlimit(struct lwp *l, const struct sys_getrlimit_args *uap, register_t *retval)
|
sys_getrlimit(struct lwp *l, const struct sys_getrlimit_args *uap,
|
||||||
|
register_t *retval)
|
||||||
{
|
{
|
||||||
/* {
|
/* {
|
||||||
syscallarg(int) which;
|
syscallarg(int) which;
|
||||||
@ -478,7 +486,8 @@ calcru(struct proc *p, struct timeval *up, struct timeval *sp,
|
|||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
int
|
int
|
||||||
sys_getrusage(struct lwp *l, const struct sys_getrusage_args *uap, register_t *retval)
|
sys_getrusage(struct lwp *l, const struct sys_getrusage_args *uap,
|
||||||
|
register_t *retval)
|
||||||
{
|
{
|
||||||
/* {
|
/* {
|
||||||
syscallarg(int) who;
|
syscallarg(int) who;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: resourcevar.h,v 1.41 2007/12/26 16:01:38 ad Exp $ */
|
/* $NetBSD: resourcevar.h,v 1.42 2008/03/17 00:18:24 rmind Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1991, 1993
|
* Copyright (c) 1991, 1993
|
||||||
@ -105,12 +105,9 @@ struct uidinfo {
|
|||||||
kmutex_t ui_lock; /* mutex for everything */
|
kmutex_t ui_lock; /* mutex for everything */
|
||||||
|
|
||||||
};
|
};
|
||||||
#define UIHASH(uid) (&uihashtbl[(uid) & uihash])
|
|
||||||
|
|
||||||
extern LIST_HEAD(uihashhead, uidinfo) *uihashtbl;
|
int chgproccnt(uid_t, int);
|
||||||
extern u_long uihash; /* size of hash table - 1 */
|
int chgsbsize(struct uidinfo *, u_long *, u_long, rlim_t);
|
||||||
int chgproccnt(uid_t, int);
|
|
||||||
int chgsbsize(struct uidinfo *, u_long *, u_long, rlim_t);
|
|
||||||
struct uidinfo *uid_find(uid_t);
|
struct uidinfo *uid_find(uid_t);
|
||||||
void uid_init(void);
|
void uid_init(void);
|
||||||
|
|
||||||
@ -122,15 +119,15 @@ extern uid_t security_setidcore_owner;
|
|||||||
extern gid_t security_setidcore_group;
|
extern gid_t security_setidcore_group;
|
||||||
extern mode_t security_setidcore_mode;
|
extern mode_t security_setidcore_mode;
|
||||||
|
|
||||||
void addupc_intr(struct lwp *, u_long);
|
void addupc_intr(struct lwp *, u_long);
|
||||||
void addupc_task(struct lwp *, u_long, u_int);
|
void addupc_task(struct lwp *, u_long, u_int);
|
||||||
void calcru(struct proc *, struct timeval *, struct timeval *,
|
void calcru(struct proc *, struct timeval *, struct timeval *,
|
||||||
struct timeval *, struct timeval *);
|
struct timeval *, struct timeval *);
|
||||||
|
|
||||||
struct plimit *lim_copy(struct plimit *lim);
|
struct plimit *lim_copy(struct plimit *lim);
|
||||||
void lim_addref(struct plimit *lim);
|
void lim_addref(struct plimit *lim);
|
||||||
void lim_privatise(struct proc *p, bool set_shared);
|
void lim_privatise(struct proc *p, bool set_shared);
|
||||||
void limfree(struct plimit *);
|
void limfree(struct plimit *);
|
||||||
|
|
||||||
void resource_init(void);
|
void resource_init(void);
|
||||||
void ruadd(struct rusage *, struct rusage *);
|
void ruadd(struct rusage *, struct rusage *);
|
||||||
|
Loading…
Reference in New Issue
Block a user