mirror of https://github.com/xzeldon/htop.git
Merge branch 'master' into wip
Conflicts: Process.c Process.h linux/LinuxProcess.c linux/LinuxProcess.h linux/LinuxProcessList.c unsupported/Platform.c unsupported/Platform.h
This commit is contained in:
commit
5c8b83405b
|
@ -13,6 +13,7 @@ This meter written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com).
|
||||||
#include "ProcessList.h"
|
#include "ProcessList.h"
|
||||||
#include "CRT.h"
|
#include "CRT.h"
|
||||||
#include "String.h"
|
#include "String.h"
|
||||||
|
#include "Platform.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -361,22 +361,27 @@ static void LinuxProcessList_readCGroupFile(LinuxProcess* process, const char* d
|
||||||
process->cgroup = strdup("");
|
process->cgroup = strdup("");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char buffer[256];
|
char output[256];
|
||||||
char *ok = fgets(buffer, 255, file);
|
output[0] = '\0';
|
||||||
if (ok) {
|
char* at = output;
|
||||||
char* trimmed = String_trim(buffer);
|
int left = 255;
|
||||||
int nFields;
|
while (!feof(file) && left > 0) {
|
||||||
char** fields = String_split(trimmed, ':', &nFields);
|
char buffer[256];
|
||||||
free(trimmed);
|
char *ok = fgets(buffer, 255, file);
|
||||||
free(process->cgroup);
|
if (!ok) break;
|
||||||
if (nFields >= 3) {
|
char* group = strchr(buffer, ':');
|
||||||
process->cgroup = strndup(fields[2] + 1, 10);
|
if (!group) break;
|
||||||
} else {
|
if (at != output) {
|
||||||
process->cgroup = strdup("");
|
*at = ';';
|
||||||
|
at++;
|
||||||
|
left--;
|
||||||
}
|
}
|
||||||
String_freeArray(fields);
|
int wrote = snprintf(at, left, "%s", group);
|
||||||
|
left -= wrote;
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
free(process->cgroup);
|
||||||
|
process->cgroup = strdup(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,6 +30,7 @@ in the source distribution for its full text.
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
#include "MainPanel.h"
|
#include "MainPanel.h"
|
||||||
#include "BatteryMeter.h"
|
#include "BatteryMeter.h"
|
||||||
|
#include "LinuxProcess.h"
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, M_SHARE, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };
|
ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, M_SHARE, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };
|
||||||
|
|
|
@ -12,6 +12,7 @@ in the source distribution for its full text.
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
#include "MainPanel.h"
|
#include "MainPanel.h"
|
||||||
#include "BatteryMeter.h"
|
#include "BatteryMeter.h"
|
||||||
|
#include "LinuxProcess.h"
|
||||||
|
|
||||||
extern ProcessField Platform_defaultFields[];
|
extern ProcessField Platform_defaultFields[];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue