1 #if defined(__KERNEL__) && defined(_VX_INFO_DEF_)
3 #include <asm/atomic.h>
4 #include <asm/resource.h>
6 /* context sub struct */
11 unsigned long rlim[RLIM_NLIMITS]; /* Per context limit */
12 atomic_t res[RLIM_NLIMITS]; /* Current value */
15 static inline void vx_info_init_limit(struct _vx_limit *limit)
19 for (lim=0; lim<RLIM_NLIMITS; lim++)
20 limit->rlim[lim] = RLIM_INFINITY;
23 static inline int vx_info_proc_limit(struct _vx_limit *limit, char *buffer)
25 return sprintf(buffer,
30 ,atomic_read(&limit->res[RLIMIT_NPROC])
31 ,limit->rlim[RLIMIT_NPROC]
32 ,atomic_read(&limit->res[RLIMIT_AS])
33 ,limit->rlim[RLIMIT_AS]
34 ,atomic_read(&limit->res[RLIMIT_MEMLOCK])
35 ,limit->rlim[RLIMIT_MEMLOCK]
36 ,atomic_read(&limit->res[RLIMIT_RSS])
37 ,limit->rlim[RLIMIT_RSS]
41 #else /* _VX_INFO_DEF_ */
47 /* rlimit vserver commands */
49 #define VCMD_get_rlimit VC_CMD(RLIMIT, 1, 0)
50 #define VCMD_set_rlimit VC_CMD(RLIMIT, 2, 0)
51 #define VCMD_get_rlimit_mask VC_CMD(RLIMIT, 3, 0)
53 struct vcmd_ctx_rlimit_v0 {
60 struct vcmd_ctx_rlimit_mask_v0 {
66 #define CRLIM_UNSET (0ULL)
67 #define CRLIM_INFINITY (~0ULL)
68 #define CRLIM_KEEP (~1ULL)
71 extern int vc_get_rlimit(uint32_t, void *);
72 extern int vc_set_rlimit(uint32_t, void *);
73 extern int vc_get_rlimit_mask(uint32_t, void *);
77 void vx_vsi_meminfo(struct sysinfo *);
78 void vx_vsi_swapinfo(struct sysinfo *);
80 #endif /* __KERNEL__ */
82 #endif /* _VX_LIMIT_H */