mirror of https://github.com/xzeldon/htop.git
Add Linux-VServer support,
contributed by Jonathan Sambrook and Benedikt Bohm
This commit is contained in:
parent
6beb27d803
commit
a5dfaa2393
|
@ -1,4 +1,9 @@
|
|||
|
||||
What's new in version 0.8.1
|
||||
|
||||
* Linux-VServer support
|
||||
(thanks to Jonathan Sambrook and Benedikt Bohm)
|
||||
|
||||
What's new in version 0.8
|
||||
|
||||
* Ability to change sort column with the mouse by
|
||||
|
|
19
Process.c
19
Process.c
|
@ -49,6 +49,9 @@ typedef enum ProcessField_ {
|
|||
#ifdef HAVE_OPENVZ
|
||||
VEID, VPID,
|
||||
#endif
|
||||
#ifdef HAVE_VSERVER
|
||||
VXID,
|
||||
#endif
|
||||
#ifdef HAVE_TASKSTATS
|
||||
RCHAR, WCHAR, SYSCR, SYSCW, RBYTES, WBYTES, CNCLWB, IO_READ_RATE, IO_WRITE_RATE, IO_RATE,
|
||||
#endif
|
||||
|
@ -124,6 +127,9 @@ typedef struct Process_ {
|
|||
unsigned int veid;
|
||||
unsigned int vpid;
|
||||
#endif
|
||||
#ifdef HAVE_VSERVER
|
||||
unsigned int vxid;
|
||||
#endif
|
||||
#ifdef HAVE_TASKSTATS
|
||||
unsigned long long io_rchar;
|
||||
unsigned long long io_wchar;
|
||||
|
@ -159,6 +165,9 @@ char *Process_fieldNames[] = {
|
|||
#ifdef HAVE_OPENVZ
|
||||
"VEID", "VPID",
|
||||
#endif
|
||||
#ifdef HAVE_VSERVER
|
||||
"VXID",
|
||||
#endif
|
||||
#ifdef HAVE_TASKSTATS
|
||||
"RCHAR", "WCHAR", "SYSCR", "SYSCW", "RBYTES", "WBYTES", "CNCLWB",
|
||||
"IO_READ_RATE", "IO_WRITE_RATE", "IO_RATE",
|
||||
|
@ -178,6 +187,9 @@ char *Process_fieldTitles[] = {
|
|||
#ifdef HAVE_OPENVZ
|
||||
" VEID ", " VPID ",
|
||||
#endif
|
||||
#ifdef HAVE_VSERVER
|
||||
" VXID ",
|
||||
#endif
|
||||
#ifdef HAVE_TASKSTATS
|
||||
" RD_CHAR ", " WR_CHAR ", " RD_SYSC ", " WR_SYSC ", " IO_RD ", " IO_WR ", " IO_CANCEL ",
|
||||
" IORR ", " IOWR ", " IO ",
|
||||
|
@ -388,6 +400,9 @@ static void Process_writeField(Process* this, RichString* str, ProcessField fiel
|
|||
case VEID: snprintf(buffer, n, "%5u ", this->veid); break;
|
||||
case VPID: snprintf(buffer, n, "%5u ", this->vpid); break;
|
||||
#endif
|
||||
#ifdef HAVE_VSERVER
|
||||
case VXID: snprintf(buffer, n, "%5u ", this->vxid); break;
|
||||
#endif
|
||||
#ifdef HAVE_TASKSTATS
|
||||
case RCHAR: snprintf(buffer, n, "%10llu ", this->io_rchar); break;
|
||||
case WCHAR: snprintf(buffer, n, "%10llu ", this->io_wchar); break;
|
||||
|
@ -556,6 +571,10 @@ int Process_compare(const void* v1, const void* v2) {
|
|||
case VPID:
|
||||
return (p1->vpid - p2->vpid);
|
||||
#endif
|
||||
#ifdef HAVE_VSERVER
|
||||
case VXID:
|
||||
return (p1->vxid - p2->vxid);
|
||||
#endif
|
||||
#ifdef HAVE_TASKSTATS
|
||||
case RCHAR: diff = p2->io_rchar - p1->io_rchar; goto test_diff;
|
||||
case WCHAR: diff = p2->io_wchar - p1->io_wchar; goto test_diff;
|
||||
|
|
|
@ -51,6 +51,9 @@ typedef enum ProcessField_ {
|
|||
#ifdef HAVE_OPENVZ
|
||||
VEID, VPID,
|
||||
#endif
|
||||
#ifdef HAVE_VSERVER
|
||||
VXID,
|
||||
#endif
|
||||
#ifdef HAVE_TASKSTATS
|
||||
RCHAR, WCHAR, SYSCR, SYSCW, RBYTES, WBYTES, CNCLWB, IO_READ_RATE, IO_WRITE_RATE, IO_RATE,
|
||||
#endif
|
||||
|
@ -126,6 +129,9 @@ typedef struct Process_ {
|
|||
unsigned int veid;
|
||||
unsigned int vpid;
|
||||
#endif
|
||||
#ifdef HAVE_VSERVER
|
||||
unsigned int vxid;
|
||||
#endif
|
||||
#ifdef HAVE_TASKSTATS
|
||||
unsigned long long io_rchar;
|
||||
unsigned long long io_wchar;
|
||||
|
|
|
@ -640,6 +640,40 @@ static bool ProcessList_processEntries(ProcessList* this, char* dirname, Process
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VSERVER
|
||||
snprintf(statusfilename, MAX_NAME, "%s/%s/status", dirname, name);
|
||||
status = ProcessList_fopen(this, statusfilename, "r");
|
||||
if (status == NULL)
|
||||
goto errorReadingProcess;
|
||||
else {
|
||||
char buffer[256];
|
||||
process->vxid = 0;
|
||||
while (!feof(status)) {
|
||||
char* ok = fgets(buffer, 255, status);
|
||||
if (!ok)
|
||||
break;
|
||||
|
||||
if (String_startsWith(buffer, "VxID:")) {
|
||||
int vxid;
|
||||
int ok = ProcessList_read(this, buffer, "VxID:\t%d", &vxid);
|
||||
if (ok >= 1) {
|
||||
process->vxid = vxid;
|
||||
}
|
||||
}
|
||||
#if defined HAVE_ANCIENT_VSERVER
|
||||
else if (String_startsWith(buffer, "s_context:")) {
|
||||
int vxid;
|
||||
int ok = ProcessList_read(this, buffer, "s_context:\t%d", &vxid);
|
||||
if (ok >= 1) {
|
||||
process->vxid = vxid;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
fclose(status);
|
||||
}
|
||||
#endif
|
||||
|
||||
snprintf(statusfilename, MAX_NAME, "%s/%s/cmdline", dirname, name);
|
||||
status = ProcessList_fopen(this, statusfilename, "r");
|
||||
if (!status) {
|
||||
|
|
11
configure.ac
11
configure.ac
|
@ -69,6 +69,17 @@ if test "x$enable_openvz" = xyes; then
|
|||
AC_DEFINE(HAVE_OPENVZ, 1, [Define if openvz support enabled.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(vserver, [AC_HELP_STRING([--enable-vserver], [enable VServer support])], ,enable_vserver="no")
|
||||
if test "x$enable_vserver" = xyes; then
|
||||
AC_DEFINE(HAVE_VSERVER, 1, [Define if vserver support enabled.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(ancient_vserver, [AC_HELP_STRING([--enable-ancient-vserver], [enable ancient VServer support (implies --enable-vserver)])], ,enable_ancient_vserver="no")
|
||||
if test "x$enable_ancient_vserver" = xyes; then
|
||||
AC_DEFINE(HAVE_VSERVER, 1, [Define if vserver support enabled.])
|
||||
AC_DEFINE(HAVE_ANCIENT_VSERVER, 1, [Define if ancient vserver support enabled.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(taskstats, [AC_HELP_STRING([--enable-taskstats], [enable per-task IO Stats (taskstats kernel sup required)])], ,enable_taskstats="yes")
|
||||
if test "x$enable_taskstats" = xyes; then
|
||||
AC_DEFINE(HAVE_TASKSTATS, 1, [Define if taskstats support enabled.])
|
||||
|
|
Loading…
Reference in New Issue