X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fkernel%2Fcvirt.h;h=eb138787ffa2629a4ec5630a8b896f68545b0dfe;hb=ba02066b569340ffb5a74184caceeb67fe87ac1c;hp=da8c1850adc934885baa2ebe1390f940b0b3da9c;hpb=a5606aace6e9ef811af10ff21e704f81bae09bc3;p=util-vserver.git diff --git a/util-vserver/kernel/cvirt.h b/util-vserver/kernel/cvirt.h index da8c185..eb13878 100644 --- a/util-vserver/kernel/cvirt.h +++ b/util-vserver/kernel/cvirt.h @@ -1,107 +1,25 @@ -#if defined(__KERNEL__) && defined(_VX_INFO_DEF_) - -#include -#include -#include -#include -#include - -/* context sub struct */ - -struct sock_acc { - atomic_t count; - atomic_t total; -}; - -struct _vx_cvirt { - int nr_threads; - int nr_running; - int max_threads; - unsigned long total_forks; - - unsigned int bias_cswtch; - long bias_jiffies; - long bias_idle; - struct timespec bias_tp; - - struct new_utsname utsname; - - struct sock_acc sock[5][3]; -}; - - -static inline long vx_sock_count(struct _vx_cvirt *cvirt, int type, int pos) -{ - return atomic_read(&cvirt->sock[type][pos].count); -} - - -static inline long vx_sock_total(struct _vx_cvirt *cvirt, int type, int pos) -{ - return atomic_read(&cvirt->sock[type][pos].total); -} - - -static inline void vx_info_init_cvirt(struct _vx_cvirt *cvirt) -{ - int i,j; - - cvirt->nr_threads = 1; - // new->virt.bias_cswtch = kstat.context_swtch; - cvirt->bias_jiffies = jiffies; - /* new->virt.bias_idle = init_tasks[0]->times.tms_utime + - init_tasks[0]->times.tms_stime; - */ - do_posix_clock_monotonic_gettime(&cvirt->bias_tp); - - down_read(&uts_sem); - cvirt->utsname = system_utsname; - up_read(&uts_sem); +#ifndef _VX_CVIRT_H +#define _VX_CVIRT_H - for (i=0; i<5; i++) { - for (j=0; j<3; j++) { - atomic_set(&cvirt->sock[i][j].count, 0); - atomic_set(&cvirt->sock[i][j].total, 0); - } - } -} +#ifdef __KERNEL__ -static inline int vx_info_proc_cvirt(struct _vx_cvirt *cvirt, char *buffer) -{ - int i,j, length = 0; - static char *type[] = { "UNSPEC", "UNIX", "INET", "INET6", "OTHER" }; +struct timespec; - for (i=0; i<5; i++) { - length += sprintf(buffer + length, - "%s:", type[i]); - for (j=0; j<3; j++) { - length += sprintf(buffer + length, - "\t%12lu/%-12lu" - ,vx_sock_count(cvirt, i, j) - ,vx_sock_total(cvirt, i, j) - ); - } - buffer[length++] = '\n'; - } - return length; -} +void vx_vsi_uptime(struct timespec *, struct timespec *); -#else /* _VX_INFO_DEF_ */ -#ifndef _VX_CVIRT_H -#define _VX_CVIRT_H -#include "switch.h" +struct vx_info; -/* cvirt vserver commands */ +void vx_update_load(struct vx_info *); -#ifdef __KERNEL__ +int vx_uts_virt_handler(struct ctl_table *ctl, int write, xid_t xid, + void **datap, size_t *lenp); -struct timespec; -void vx_vsi_uptime(struct timespec *uptime); +int vx_do_syslog(int, char __user *, int); #endif /* __KERNEL__ */ - +#else /* _VX_CVIRT_H */ +#warning duplicate inclusion #endif /* _VX_CVIRT_H */ -#endif