diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2010-10-30 19:24:07 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2010-10-30 19:24:07 +0000 |
commit | 84ed4c01f6a5551caf94b16aac7c116e5ff67825 (patch) | |
tree | f7109308a7fc78013357a8e8e1537254bfbd9987 /ProcessList.c | |
parent | b2fee47a14261bb8c52a9ef5dcd144fa119b8a1d (diff) |
Support for cgroups (thanks to Guillaume Zitta and Daniel Lezcano)
Diffstat (limited to 'ProcessList.c')
-rw-r--r-- | ProcessList.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ProcessList.c b/ProcessList.c index d65baef5..dfd5ce9f 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -642,6 +642,26 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P } #endif + #ifdef HAVE_CGROUP + snprintf(statusfilename, MAX_NAME, "%s/%s/cgroup", dirname, name); + status = ProcessList_fopen(this, statusfilename, "r"); + if (status) { + char buffer[256]; + char *ok = fgets(buffer, 255, status); + if (ok) { + char* trimmed = String_trim(buffer); + char** fields = String_split(trimmed, ':'); + free(trimmed); + + char* value = String_cat(fields[2], " "); + String_freeArray(fields); + process->cgroup = strndup(value + 1, 10); + free(value); + } + fclose(status); + } + #endif + #ifdef HAVE_VSERVER snprintf(statusfilename, MAX_NAME, "%s/%s/status", dirname, name); status = ProcessList_fopen(this, statusfilename, "r"); |