1 #if defined(__KERNEL__) && defined(_VX_INFO_DEF_)
3 #include <linux/utsname.h>
4 #include <linux/rwsem.h>
5 #include <linux/jiffies.h>
6 #include <linux/time.h>
7 #include <asm/atomic.h>
9 /* context sub struct */
20 unsigned long total_forks;
22 unsigned int bias_cswtch;
23 struct timespec bias_idle;
24 struct timespec bias_tp;
25 uint64_t bias_jiffies;
27 struct new_utsname utsname;
29 struct sock_acc sock[5][3];
33 static inline long vx_sock_count(struct _vx_cvirt *cvirt, int type, int pos)
35 return atomic_read(&cvirt->sock[type][pos].count);
39 static inline long vx_sock_total(struct _vx_cvirt *cvirt, int type, int pos)
41 return atomic_read(&cvirt->sock[type][pos].total);
45 extern uint64_t vx_idle_jiffies(void);
47 static inline void vx_info_init_cvirt(struct _vx_cvirt *cvirt)
50 uint64_t idle_jiffies = vx_idle_jiffies();
52 cvirt->nr_threads = 1;
53 // new->virt.bias_cswtch = kstat.context_swtch;
54 cvirt->bias_jiffies = get_jiffies_64();
56 jiffies_to_timespec(idle_jiffies, &cvirt->bias_idle);
57 do_posix_clock_monotonic_gettime(&cvirt->bias_tp);
60 cvirt->utsname = system_utsname;
65 atomic_set(&cvirt->sock[i][j].count, 0);
66 atomic_set(&cvirt->sock[i][j].total, 0);
71 static inline int vx_info_proc_cvirt(struct _vx_cvirt *cvirt, char *buffer)
74 static char *type[] = { "UNSPEC", "UNIX", "INET", "INET6", "OTHER" };
77 length += sprintf(buffer + length,
80 length += sprintf(buffer + length,
82 ,vx_sock_count(cvirt, i, j)
83 ,vx_sock_total(cvirt, i, j)
86 buffer[length++] = '\n';
91 #else /* _VX_INFO_DEF_ */
97 /* cvirt vserver commands */
104 void vx_vsi_uptime(struct timespec *uptime, struct timespec *idle);
106 #endif /* __KERNEL__ */
108 #endif /* _VX_CVIRT_H */