X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=kernel%2Fvserver%2Fcvirt_proc.h;h=ed36a0d8c7e0dc3516c7f40e7056d6f51386fc5b;hb=refs%2Fheads%2Fvserver;hp=9143c2d24aa0d517ec939cadd9f3a4a6acf4025a;hpb=76828883507a47dae78837ab5dec5a5b4513c667;p=linux-2.6.git diff --git a/kernel/vserver/cvirt_proc.h b/kernel/vserver/cvirt_proc.h index 9143c2d24..ed36a0d8c 100644 --- a/kernel/vserver/cvirt_proc.h +++ b/kernel/vserver/cvirt_proc.h @@ -1,21 +1,52 @@ #ifndef _VX_CVIRT_PROC_H #define _VX_CVIRT_PROC_H -#include - +#include +#include +#include +#include -#define LOAD_INT(x) ((x) >> FSHIFT) -#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100) -static inline int vx_info_proc_cvirt(struct _vx_cvirt *cvirt, char *buffer) +static inline +int vx_info_proc_nsproxy(struct nsproxy *nsproxy, char *buffer) { + struct mnt_namespace *ns; + struct uts_namespace *uts; + struct ipc_namespace *ipc; + struct vfsmount *mnt; + char *path, *root; int length = 0; - int a, b, c; + + if (!nsproxy) + goto out; length += sprintf(buffer + length, - "BiasUptime:\t%lu.%02lu\n", - (unsigned long)cvirt->bias_uptime.tv_sec, - (cvirt->bias_uptime.tv_nsec / (NSEC_PER_SEC / 100))); + "NSProxy:\t%p [%p,%p,%p]\n", + nsproxy, nsproxy->mnt_ns, + nsproxy->uts_ns, nsproxy->ipc_ns); + + ns = nsproxy->mnt_ns; + if (!ns) + goto skip_ns; + + path = kmalloc(PATH_MAX, GFP_KERNEL); + if (!path) + goto skip_ns; + + mnt = ns->root; + root = d_path(mnt->mnt_root, mnt->mnt_parent, path, PATH_MAX-2); + length += sprintf(buffer + length, + "Namespace:\t%p [#%u]\n" + "RootPath:\t%s\n" + ,ns , atomic_read(&ns->count) + ,root); + kfree(path); +skip_ns: + + uts = nsproxy->uts_ns; + if (!uts) + goto skip_uts; + length += sprintf(buffer + length, "SysName:\t%.*s\n" "NodeName:\t%.*s\n" @@ -23,13 +54,53 @@ static inline int vx_info_proc_cvirt(struct _vx_cvirt *cvirt, char *buffer) "Version:\t%.*s\n" "Machine:\t%.*s\n" "DomainName:\t%.*s\n" - ,__NEW_UTS_LEN, cvirt->utsname.sysname - ,__NEW_UTS_LEN, cvirt->utsname.nodename - ,__NEW_UTS_LEN, cvirt->utsname.release - ,__NEW_UTS_LEN, cvirt->utsname.version - ,__NEW_UTS_LEN, cvirt->utsname.machine - ,__NEW_UTS_LEN, cvirt->utsname.domainname + ,__NEW_UTS_LEN, uts->name.sysname + ,__NEW_UTS_LEN, uts->name.nodename + ,__NEW_UTS_LEN, uts->name.release + ,__NEW_UTS_LEN, uts->name.version + ,__NEW_UTS_LEN, uts->name.machine + ,__NEW_UTS_LEN, uts->name.domainname + ); +skip_uts: + + ipc = nsproxy->ipc_ns; + if (!ipc) + goto skip_ipc; + + length += sprintf(buffer + length, + "SEMS:\t\t%d %d %d %d %d\n" + "MSG:\t\t%d %d %d\n" + "SHM:\t\t%lu %lu %d %d\n" + ,ipc->sem_ctls[0], ipc->sem_ctls[1] + ,ipc->sem_ctls[2], ipc->sem_ctls[3] + ,ipc->used_sems + ,ipc->msg_ctlmax, ipc->msg_ctlmnb, ipc->msg_ctlmni + ,(unsigned long)ipc->shm_ctlmax + ,(unsigned long)ipc->shm_ctlall + ,ipc->shm_ctlmni, ipc->shm_tot ); +skip_ipc: + +out: + return length; +} + + +#include + +#define LOAD_INT(x) ((x) >> FSHIFT) +#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100) + +static inline +int vx_info_proc_cvirt(struct _vx_cvirt *cvirt, char *buffer) +{ + int length = 0; + int a, b, c; + + length += sprintf(buffer + length, + "BiasUptime:\t%lu.%02lu\n", + (unsigned long)cvirt->bias_uptime.tv_sec, + (cvirt->bias_uptime.tv_nsec / (NSEC_PER_SEC / 100))); a = cvirt->load[0] + (FIXED_1/200); b = cvirt->load[1] + (FIXED_1/200); @@ -52,40 +123,15 @@ static inline int vx_info_proc_cvirt(struct _vx_cvirt *cvirt, char *buffer) ,LOAD_INT(c), LOAD_FRAC(c) ,atomic_read(&cvirt->total_forks) ); - return length; -} - - -static inline long vx_sock_count(struct _vx_cacct *cacct, int type, int pos) -{ - return atomic_read(&cacct->sock[type][pos].count); -} - -static inline long vx_sock_total(struct _vx_cacct *cacct, int type, int pos) -{ - return atomic_read(&cacct->sock[type][pos].total); + return length; } -static inline int vx_info_proc_cacct(struct _vx_cacct *cacct, char *buffer) +static inline +int vx_info_proc_cvirt_pc(struct _vx_cvirt_pc *cvirt_pc, + char *buffer, int cpu) { - int i,j, length = 0; - static char *type[] = { "UNSPEC", "UNIX", "INET", "INET6", "OTHER" }; - - 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(cacct, i, j) - ,vx_sock_total(cacct, i, j) - ); - } - buffer[length++] = '\n'; - } - length += sprintf(buffer + length, - "forks:\t%lu\n", cacct->total_forks); + int length = 0; return length; }