mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 04:04:35 +03:00
Merge branch 'hishamhm-pull-960'
This commit is contained in:
@ -61,7 +61,7 @@ typedef struct CPUData_ {
|
||||
unsigned long long int softIrqTime;
|
||||
unsigned long long int stealTime;
|
||||
unsigned long long int guestTime;
|
||||
|
||||
|
||||
unsigned long long int totalPeriod;
|
||||
unsigned long long int userPeriod;
|
||||
unsigned long long int systemPeriod;
|
||||
@ -85,11 +85,11 @@ typedef struct TtyDriver_ {
|
||||
|
||||
typedef struct LinuxProcessList_ {
|
||||
ProcessList super;
|
||||
|
||||
|
||||
CPUData* cpus;
|
||||
TtyDriver* ttyDrivers;
|
||||
bool haveSmapsRollup;
|
||||
|
||||
|
||||
#ifdef HAVE_DELAYACCT
|
||||
struct nl_sock *netlink_socket;
|
||||
int netlink_family;
|
||||
@ -328,7 +328,7 @@ static bool LinuxProcessList_readStatFile(Process *process, const char* dirname,
|
||||
location += 2;
|
||||
char *end = strrchr(location, ')');
|
||||
if (!end) return false;
|
||||
|
||||
|
||||
int commsize = end - location;
|
||||
memcpy(command, location, commsize);
|
||||
command[commsize] = '\0';
|
||||
@ -379,9 +379,9 @@ static bool LinuxProcessList_readStatFile(Process *process, const char* dirname,
|
||||
location += 1;
|
||||
assert(location != NULL);
|
||||
process->processor = strtol(location, &location, 10);
|
||||
|
||||
|
||||
process->time = lp->utime + lp->stime;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -421,7 +421,7 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
|
||||
process->io_rate_write_time = -1LL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
char buffer[1024];
|
||||
ssize_t buflen = xread(fd, buffer, 1023);
|
||||
close(fd);
|
||||
@ -438,7 +438,7 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
|
||||
process->io_rchar = strtoull(line+7, NULL, 10);
|
||||
else if (strncmp(line+1, "ead_bytes: ", 11) == 0) {
|
||||
process->io_read_bytes = strtoull(line+12, NULL, 10);
|
||||
process->io_rate_read_bps =
|
||||
process->io_rate_read_bps =
|
||||
((double)(process->io_read_bytes - last_read))/(((double)(now - process->io_rate_read_time))/1000);
|
||||
process->io_rate_read_time = now;
|
||||
}
|
||||
@ -448,7 +448,7 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
|
||||
process->io_wchar = strtoull(line+7, NULL, 10);
|
||||
else if (strncmp(line+1, "rite_bytes: ", 12) == 0) {
|
||||
process->io_write_bytes = strtoull(line+13, NULL, 10);
|
||||
process->io_rate_write_bps =
|
||||
process->io_rate_write_bps =
|
||||
((double)(process->io_write_bytes - last_write))/(((double)(now - process->io_rate_write_time))/1000);
|
||||
process->io_rate_write_time = now;
|
||||
}
|
||||
@ -726,7 +726,7 @@ static void LinuxProcessList_readDelayAcctData(LinuxProcessList* this, LinuxProc
|
||||
process->cpu_delay_percent = -1LL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (nl_recvmsgs_default(this->netlink_socket) < 0) {
|
||||
return;
|
||||
}
|
||||
@ -750,11 +750,11 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, const char* dirna
|
||||
int fd = open(filename, O_RDONLY);
|
||||
if (fd == -1)
|
||||
return false;
|
||||
|
||||
|
||||
char command[4096+1]; // max cmdline length on Linux
|
||||
int amtRead = xread(fd, command, sizeof(command) - 1);
|
||||
close(fd);
|
||||
int tokenEnd = 0;
|
||||
int tokenEnd = 0;
|
||||
int lastChar = 0;
|
||||
if (amtRead == 0) {
|
||||
((LinuxProcess*)process)->isKernelThread = true;
|
||||
@ -791,13 +791,13 @@ static char* LinuxProcessList_updateTtyDevice(TtyDriver* ttyDrivers, unsigned in
|
||||
i++;
|
||||
if ((!ttyDrivers[i].path) || maj < ttyDrivers[i].major) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (maj > ttyDrivers[i].major) {
|
||||
continue;
|
||||
}
|
||||
if (min < ttyDrivers[i].minorFrom) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (min > ttyDrivers[i].minorTo) {
|
||||
continue;
|
||||
}
|
||||
@ -855,17 +855,17 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
|
||||
|
||||
// filename is a number: process directory
|
||||
int pid = atoi(name);
|
||||
|
||||
|
||||
if (parent && pid == parent->pid)
|
||||
continue;
|
||||
|
||||
if (pid <= 0)
|
||||
if (pid <= 0)
|
||||
continue;
|
||||
|
||||
bool preExisting = false;
|
||||
Process* proc = ProcessList_getProcess(pl, pid, &preExisting, (Process_New) LinuxProcess_new);
|
||||
proc->tgid = parent ? parent->pid : pid;
|
||||
|
||||
|
||||
LinuxProcess* lp = (LinuxProcess*) proc;
|
||||
|
||||
char subdirname[MAX_NAME+1];
|
||||
@ -926,7 +926,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
|
||||
LinuxProcessList_readOpenVZData(lp, dirname, name);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_VSERVER
|
||||
if (settings->flags & PROCESS_FLAG_LINUX_VSERVER) {
|
||||
LinuxProcessList_readVServerData(lp, dirname, name);
|
||||
@ -954,7 +954,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
|
||||
if (settings->flags & PROCESS_FLAG_LINUX_CGROUP)
|
||||
LinuxProcessList_readCGroupFile(lp, dirname, name);
|
||||
#endif
|
||||
|
||||
|
||||
if (settings->flags & PROCESS_FLAG_LINUX_OOM)
|
||||
LinuxProcessList_readOomData(lp, dirname, name);
|
||||
|
||||
|
Reference in New Issue
Block a user