4 #include "vserver/cvirt.h"
5 #include "vserver/debug.h"
8 /* utsname virtualization */
10 static inline struct new_utsname *vx_new_utsname(void)
13 return ¤t->vx_info->cvirt.utsname;
14 return &system_utsname;
17 #define vx_new_uts(x) ((vx_new_utsname())->x)
20 /* pid faking stuff */
23 #define vx_info_map_pid(v,p) \
24 __vx_info_map_pid((v), (p), __FUNC__, __FILE__, __LINE__)
25 #define vx_info_map_tgid(v,p) vx_info_map_pid(v,p)
26 #define vx_map_pid(p) vx_info_map_pid(current->vx_info, p)
27 #define vx_map_tgid(p) vx_map_pid(p)
29 static inline int __vx_info_map_pid(struct vx_info *vxi, int pid,
30 const char *func, const char *file, int line)
32 if (vx_info_flags(vxi, VXF_INFO_INIT, 0)) {
33 vxfprintk(VXD_CBIT(cvirt, 2),
34 "vx_map_tgid: %p/%llx: %d -> %d",
35 vxi, (long long)vxi->vx_flags, pid,
36 (pid && pid == vxi->vx_initpid)?1:pid,
40 if (pid == vxi->vx_initpid)
46 #define vx_info_rmap_pid(v,p) \
47 __vx_info_rmap_pid((v), (p), __FUNC__, __FILE__, __LINE__)
48 #define vx_rmap_pid(p) vx_info_rmap_pid(current->vx_info, p)
49 #define vx_rmap_tgid(p) vx_rmap_pid(p)
51 static inline int __vx_info_rmap_pid(struct vx_info *vxi, int pid,
52 const char *func, const char *file, int line)
54 if (vx_info_flags(vxi, VXF_INFO_INIT, 0)) {
55 vxfprintk(VXD_CBIT(cvirt, 2),
56 "vx_rmap_tgid: %p/%llx: %d -> %d",
57 vxi, (long long)vxi->vx_flags, pid,
58 (pid == 1)?vxi->vx_initpid:pid,
60 if ((pid == 1) && vxi->vx_initpid)
61 return vxi->vx_initpid;
62 if (pid == vxi->vx_initpid)
69 static inline void vx_activate_task(struct task_struct *p)
73 if ((vxi = p->vx_info)) {
75 atomic_inc(&vxi->cvirt.nr_running);
79 static inline void vx_deactivate_task(struct task_struct *p)
83 if ((vxi = p->vx_info)) {
85 atomic_dec(&vxi->cvirt.nr_running);
89 static inline void vx_uninterruptible_inc(struct task_struct *p)
93 if ((vxi = p->vx_info))
94 atomic_inc(&vxi->cvirt.nr_uninterruptible);
97 static inline void vx_uninterruptible_dec(struct task_struct *p)
101 if ((vxi = p->vx_info))
102 atomic_dec(&vxi->cvirt.nr_uninterruptible);
107 #warning duplicate inclusion