PERFORCE change 105165 for review
Alex Lyashkov
als at FreeBSD.org
Sun Aug 27 08:44:41 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=105165
Change 105165 by als at als_head on 2006/08/27 08:44:04
kill duplicate code
Affected files ...
.. //depot/projects/jail2/sys/sys/jail2_task.h#2 edit
Differences ...
==== //depot/projects/jail2/sys/sys/jail2_task.h#2 (text+ko) ====
@@ -11,7 +11,7 @@
struct jail_tasks {
uint32_t jt_count; /* (p) total process count */
uint32_t jt_limit; /* (p) limits process in jail */
-/* */
+/* */
uint32_t jt_hcpu_limit; /* (a) hard cpu usage limit */
uint32_t jt_qcpu_limit; /* (a) quarantee cpu usage limit */
uint32_t jt_cpu_used; /* (a) total cpu usage in context */
@@ -32,11 +32,11 @@
(pr)->pr_tasks.jt_next_timer = 0; \
}
-#define JAIL_NPROCS(prison) ((prison)->pr_tasks.jt_count)
-#define JAIL_MAXPROC(prison) ((prison)->pr_tasks.jt_limit)
+#define JAIL_NPROCS(prison) ((prison)->pr_tasks.jt_count)
+#define JAIL_MAXPROC(prison) ((prison)->pr_tasks.jt_limit)
-#define JAIL_CAN_FORK(prison) (JAIL_STARTED(prison) && \
- (!JAIL_HAVE_PROCLIMIT(prison) || \
+#define JAIL_CAN_FORK(prison) (JAIL_STARTED(prison) && \
+ (!JAIL_HAVE_PROCLIMIT(prison) || \
(JAIL_HAVE_PROCLIMIT(prison) && (JAIL_NPROCS(prison) <= JAIL_MAXPROC(prison)))))
static inline void
@@ -45,7 +45,7 @@
jt->jt_count++;
}
-static inline void
+static inline void
jail_task_del(struct jail_tasks *jt, struct proc *p)
{
jt->jt_count--;
@@ -53,58 +53,4 @@
#endif /* _KERNEL */
#endif /* !_SYS_JAIL_TASKS_H_ */
-#ifndef _SYS_JAIL_TASKS_H_
-
-#define _SYS_JAIL_TASKS_H_
-
-#if defined(_KERNEL) || defined(_WANT_PRISON)
-
-/*
- * (p) under allproclock or atomic
- * (a) atomic
- */
-struct jail_tasks {
- uint32_t jt_count; /* (p) total process count */
- uint32_t jt_limit; /* (p) limits process in jail */
-/* */
- uint32_t jt_hcpu_limit; /* (a) hard cpu usage limit */
- uint32_t jt_qcpu_limit; /* (a) quarantee cpu usage limit */
- uint32_t jt_cpu_used; /* (a) total cpu usage in context */
- uint32_t jt_prio; /* (a) priority beetwen contexts */
- uint64_t jt_next_timer; /* (a) time end of limit */
-};
-#endif
-#ifdef _KERNEL
-#include <machine/atomic.h>
-
-#define JAIL_TASKS_INIT(pr) {(pr)->pr_tasks.jt_count = 0; \
- (pr)->pr_tasks.jt_limit = 0; \
- (pr)->pr_tasks.jt_hcpu_limit = 0; \
- (pr)->pr_tasks.jt_qcpu_limit = 0; \
- (pr)->pr_tasks.jt_cpu_used = 0; \
- (pr)->pr_tasks.jt_prio = 0; \
- (pr)->pr_tasks.jt_next_timer = 0; \
- }
-
-#define JAIL_NPROCS(prison) ((prison)->pr_tasks.jt_count)
-#define JAIL_MAXPROC(prison) ((prison)->pr_tasks.jt_limit)
-
-#define JAIL_CAN_FORK(prison) (JAIL_STARTED(prison) && \
- (!JAIL_HAVE_PROCLIMIT(prison) || \
- (JAIL_HAVE_PROCLIMIT(prison) && (JAIL_NPROCS(prison) <= JAIL_MAXPROC(prison)))))
-
-static inline void
-jail_task_add(struct jail_tasks *jt, struct proc *p)
-{
- jt->jt_count++;
-}
-
-static inline void
-jail_task_del(struct jail_tasks *jt, struct proc *p)
-{
- jt->jt_count--;
-}
-#endif /* _KERNEL */
-
-#endif /* !_SYS_JAIL_TASKS_H_ */
More information about the p4-projects
mailing list