1 #if defined(__KERNEL__) && defined(_VX_INFO_DEF_)
3 #include <asm/atomic.h>
4 #include <asm/resource.h>
6 /* context sub struct */
10 #define VLIMIT_SOCK 16
16 unsigned long rlim[NUM_RLIMITS]; /* Per context limit */
17 atomic_t res[NUM_RLIMITS]; /* Current value */
20 static inline void vx_info_init_limit(struct _vx_limit *limit)
24 for (lim=0; lim<NUM_RLIMITS; lim++) {
25 limit->rlim[lim] = RLIM_INFINITY;
26 atomic_set(&limit->res[lim], 0);
30 static inline int vx_info_proc_limit(struct _vx_limit *limit, char *buffer)
32 return sprintf(buffer,
38 ,atomic_read(&limit->res[RLIMIT_NPROC])
39 ,limit->rlim[RLIMIT_NPROC]
40 ,atomic_read(&limit->res[RLIMIT_AS])
41 ,limit->rlim[RLIMIT_AS]
42 ,atomic_read(&limit->res[RLIMIT_MEMLOCK])
43 ,limit->rlim[RLIMIT_MEMLOCK]
44 ,atomic_read(&limit->res[RLIMIT_RSS])
45 ,limit->rlim[RLIMIT_RSS]
46 ,atomic_read(&limit->res[RLIMIT_NOFILE])
47 ,limit->rlim[RLIMIT_NOFILE]
51 #else /* _VX_INFO_DEF_ */
57 /* rlimit vserver commands */
59 #define VCMD_get_rlimit VC_CMD(RLIMIT, 1, 0)
60 #define VCMD_set_rlimit VC_CMD(RLIMIT, 2, 0)
61 #define VCMD_get_rlimit_mask VC_CMD(RLIMIT, 3, 0)
63 struct vcmd_ctx_rlimit_v0 {
70 struct vcmd_ctx_rlimit_mask_v0 {
76 #define CRLIM_UNSET (0ULL)
77 #define CRLIM_INFINITY (~0ULL)
78 #define CRLIM_KEEP (~1ULL)
82 #include <linux/compiler.h>
84 extern int vc_get_rlimit(uint32_t, void __user *);
85 extern int vc_set_rlimit(uint32_t, void __user *);
86 extern int vc_get_rlimit_mask(uint32_t, void __user *);
90 void vx_vsi_meminfo(struct sysinfo *);
91 void vx_vsi_swapinfo(struct sysinfo *);
94 #endif /* __KERNEL__ */
96 #endif /* _VX_LIMIT_H */