mirror of https://github.com/xzeldon/htop.git
no need to pad values; provide a default on machines without cgroup
This commit is contained in:
parent
84ed4c01f6
commit
45de5694ac
|
@ -65,6 +65,9 @@ typedef enum ProcessField_ {
|
||||||
#ifdef HAVE_TASKSTATS
|
#ifdef HAVE_TASKSTATS
|
||||||
RCHAR, WCHAR, SYSCR, SYSCW, RBYTES, WBYTES, CNCLWB, IO_READ_RATE, IO_WRITE_RATE, IO_RATE,
|
RCHAR, WCHAR, SYSCR, SYSCW, RBYTES, WBYTES, CNCLWB, IO_READ_RATE, IO_WRITE_RATE, IO_RATE,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_CGROUP
|
||||||
|
CGROUP,
|
||||||
|
#endif
|
||||||
LAST_PROCESSFIELD
|
LAST_PROCESSFIELD
|
||||||
} ProcessField;
|
} ProcessField;
|
||||||
|
|
||||||
|
@ -155,6 +158,9 @@ typedef struct Process_ {
|
||||||
double io_rate_write_bps;
|
double io_rate_write_bps;
|
||||||
unsigned long long io_rate_write_time;
|
unsigned long long io_rate_write_time;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_CGROUP
|
||||||
|
char* cgroup;
|
||||||
|
#endif
|
||||||
} Process;
|
} Process;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -653,12 +653,12 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
|
||||||
char** fields = String_split(trimmed, ':');
|
char** fields = String_split(trimmed, ':');
|
||||||
free(trimmed);
|
free(trimmed);
|
||||||
|
|
||||||
char* value = String_cat(fields[2], " ");
|
process->cgroup = strndup(fields[2] + 1, 10);
|
||||||
String_freeArray(fields);
|
String_freeArray(fields);
|
||||||
process->cgroup = strndup(value + 1, 10);
|
|
||||||
free(value);
|
|
||||||
}
|
}
|
||||||
fclose(status);
|
fclose(status);
|
||||||
|
} else {
|
||||||
|
process->cgroup = strdup("");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue