summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormjg <mjg@FreeBSD.org>2014-11-23 08:25:44 +0000
committermjg <mjg@FreeBSD.org>2014-11-23 08:25:44 +0000
commita4324a551403a06a930771b06adfb45163781e09 (patch)
treec9e32e45f83a185f1608ae2f2056b8a1dc2e3df6
parentfb402568c4370150544a6e913665f82e8f571b82 (diff)
downloadFreeBSD-src-a4324a551403a06a930771b06adfb45163781e09.zip
FreeBSD-src-a4324a551403a06a930771b06adfb45163781e09.tar.gz
ifdef RACCT ui_racct_foreach and struct uidinfo's ui_racct
Change racct_ create and destroy to macros evaluating to nothing without RACCT so that their callers passing ui_racct don't have to be ifdefed.
-rw-r--r--sys/kern/kern_resource.c2
-rw-r--r--sys/sys/racct.h11
-rw-r--r--sys/sys/resourcevar.h4
3 files changed, 8 insertions, 9 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index 037a257..50ea8ac 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -1334,6 +1334,7 @@ uifree(struct uidinfo *uip)
free(uip, M_UIDINFO);
}
+#ifdef RACCT
void
ui_racct_foreach(void (*callback)(struct racct *racct,
void *arg2, void *arg3), void *arg2, void *arg3)
@@ -1349,6 +1350,7 @@ ui_racct_foreach(void (*callback)(struct racct *racct,
}
rw_runlock(&uihashtbl_lock);
}
+#endif
/*
* Change the count associated with number of processes
diff --git a/sys/sys/racct.h b/sys/sys/racct.h
index 362529c..966d27a 100644
--- a/sys/sys/racct.h
+++ b/sys/sys/racct.h
@@ -220,15 +220,8 @@ racct_get_available(struct proc *p, int resource)
return (UINT64_MAX);
}
-static inline void
-racct_create(struct racct **racctp)
-{
-}
-
-static inline void
-racct_destroy(struct racct **racctp)
-{
-}
+#define racct_create(x)
+#define racct_destroy(x)
static inline int
racct_proc_fork(struct proc *parent, struct proc *child)
diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h
index 1a35a9e..a24e89a 100644
--- a/sys/sys/resourcevar.h
+++ b/sys/sys/resourcevar.h
@@ -102,7 +102,9 @@ struct uidinfo {
long ui_kqcnt; /* (b) number of kqueues */
uid_t ui_uid; /* (a) uid */
u_int ui_ref; /* (b) reference count */
+#ifdef RACCT
struct racct *ui_racct; /* (a) resource accounting */
+#endif
};
#define UIDINFO_VMSIZE_LOCK(ui) mtx_lock(&((ui)->ui_vmsize_mtx))
@@ -148,8 +150,10 @@ struct uidinfo
void uifree(struct uidinfo *uip);
void uihashinit(void);
void uihold(struct uidinfo *uip);
+#ifdef RACCT
void ui_racct_foreach(void (*callback)(struct racct *racct,
void *arg2, void *arg3), void *arg2, void *arg3);
+#endif
#endif /* _KERNEL */
#endif /* !_SYS_RESOURCEVAR_H_ */
OpenPOWER on IntegriCloud