svn commit: r272582 - in head/sys: kern sys
Mateusz Guzik
mjg at FreeBSD.org
Mon Oct 6 02:31:35 UTC 2014
Author: mjg
Date: Mon Oct 6 02:31:33 2014
New Revision: 272582
URL: https://svnweb.freebsd.org/changeset/base/272582
Log:
Convert racct stubs to inline functions.
This saves some symbols and function calls for kernel without RACCT.
MFC after: 1 week
Modified:
head/sys/kern/kern_racct.c
head/sys/sys/racct.h
Modified: head/sys/kern/kern_racct.c
==============================================================================
--- head/sys/kern/kern_racct.c Mon Oct 6 00:31:31 2014 (r272581)
+++ head/sys/kern/kern_racct.c Mon Oct 6 02:31:33 2014 (r272582)
@@ -1203,88 +1203,4 @@ racct_init(void)
}
SYSINIT(racct, SI_SUB_RACCT, SI_ORDER_FIRST, racct_init, NULL);
-#else /* !RACCT */
-
-int
-racct_add(struct proc *p, int resource, uint64_t amount)
-{
-
- return (0);
-}
-
-void
-racct_add_cred(struct ucred *cred, int resource, uint64_t amount)
-{
-}
-
-void
-racct_add_force(struct proc *p, int resource, uint64_t amount)
-{
-
- return;
-}
-
-int
-racct_set(struct proc *p, int resource, uint64_t amount)
-{
-
- return (0);
-}
-
-void
-racct_set_force(struct proc *p, int resource, uint64_t amount)
-{
-}
-
-void
-racct_sub(struct proc *p, int resource, uint64_t amount)
-{
-}
-
-void
-racct_sub_cred(struct ucred *cred, int resource, uint64_t amount)
-{
-}
-
-uint64_t
-racct_get_limit(struct proc *p, int resource)
-{
-
- return (UINT64_MAX);
-}
-
-uint64_t
-racct_get_available(struct proc *p, int resource)
-{
-
- return (UINT64_MAX);
-}
-
-void
-racct_create(struct racct **racctp)
-{
-}
-
-void
-racct_destroy(struct racct **racctp)
-{
-}
-
-int
-racct_proc_fork(struct proc *parent, struct proc *child)
-{
-
- return (0);
-}
-
-void
-racct_proc_fork_done(struct proc *child)
-{
-}
-
-void
-racct_proc_exit(struct proc *p)
-{
-}
-
#endif /* !RACCT */
Modified: head/sys/sys/racct.h
==============================================================================
--- head/sys/sys/racct.h Mon Oct 6 00:31:31 2014 (r272581)
+++ head/sys/sys/racct.h Mon Oct 6 02:31:33 2014 (r272582)
@@ -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 pro
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_ */
More information about the svn-src-head
mailing list