aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/racct.h
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2014-10-06 02:31:33 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2014-10-06 02:31:33 +0000
commitdd2390be68e0245e45e2289f91b70e844a076078 (patch)
treee969994de7308d5af8ae027deab18287ae98e81b /sys/sys/racct.h
parent1769d465c89d074cb52a64a558147e6dfbb9e03a (diff)
downloadsrc-dd2390be68e0245e45e2289f91b70e844a076078.tar.gz
src-dd2390be68e0245e45e2289f91b70e844a076078.zip
Convert racct stubs to inline functions.
This saves some symbols and function calls for kernel without RACCT. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=272582
Diffstat (limited to 'sys/sys/racct.h')
-rw-r--r--sys/sys/racct.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/sys/sys/racct.h b/sys/sys/racct.h
index 3b34891af14c..362529c4857b 100644
--- a/sys/sys/racct.h
+++ b/sys/sys/racct.h
@@ -37,6 +37,7 @@
#define _RACCT_H_
#include <sys/cdefs.h>
+#include <sys/stdint.h>
#include <sys/queue.h>
#include <sys/types.h>
@@ -141,6 +142,8 @@ struct racct {
LIST_HEAD(, rctl_rule_link) r_rule_links;
};
+#ifdef RACCT
+
int racct_add(struct proc *p, int resource, uint64_t amount);
void racct_add_cred(struct ucred *cred, int resource, uint64_t amount);
void racct_add_force(struct proc *p, int resource, uint64_t amount);
@@ -162,4 +165,88 @@ void racct_proc_ucred_changed(struct proc *p, struct ucred *oldcred,
struct ucred *newcred);
void racct_move(struct racct *dest, struct racct *src);
+#else
+
+static inline int
+racct_add(struct proc *p, int resource, uint64_t amount)
+{
+
+ return (0);
+}
+
+static inline void
+racct_add_cred(struct ucred *cred, int resource, uint64_t amount)
+{
+}
+
+static inline void
+racct_add_force(struct proc *p, int resource, uint64_t amount)
+{
+}
+
+static inline int
+racct_set(struct proc *p, int resource, uint64_t amount)
+{
+
+ return (0);
+}
+
+static inline void
+racct_set_force(struct proc *p, int resource, uint64_t amount)
+{
+}
+
+static inline void
+racct_sub(struct proc *p, int resource, uint64_t amount)
+{
+}
+
+static inline void
+racct_sub_cred(struct ucred *cred, int resource, uint64_t amount)
+{
+}
+
+static inline uint64_t
+racct_get_limit(struct proc *p, int resource)
+{
+
+ return (UINT64_MAX);
+}
+
+static inline uint64_t
+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)
+{
+}
+
+static inline int
+racct_proc_fork(struct proc *parent, struct proc *child)
+{
+
+ return (0);
+}
+
+static inline void
+racct_proc_fork_done(struct proc *child)
+{
+}
+
+static inline void
+racct_proc_exit(struct proc *p)
+{
+}
+
+#endif
+
#endif /* !_RACCT_H_ */