mirror of https://github.com/xzeldon/htop.git
Merge branch 'master' of https://github.com/hishamhm/htop
This commit is contained in:
commit
d7e5020169
|
@ -56,15 +56,16 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
|
||||||
if (!batteryDir)
|
if (!batteryDir)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
char* batteries[64];
|
#define MAX_BATTERIES 64
|
||||||
|
char* batteries[MAX_BATTERIES];
|
||||||
unsigned int nBatteries = 0;
|
unsigned int nBatteries = 0;
|
||||||
memset(batteries, sizeof batteries, sizeof (char*));
|
memset(batteries, 0, MAX_BATTERIES * sizeof(char*));
|
||||||
|
|
||||||
struct dirent result;
|
struct dirent result;
|
||||||
struct dirent* dirEntry;
|
struct dirent* dirEntry;
|
||||||
while (nBatteries < sizeof batteries) {
|
while (nBatteries < MAX_BATTERIES) {
|
||||||
readdir_r(batteryDir, &result, &dirEntry);
|
int err = readdir_r(batteryDir, &result, &dirEntry);
|
||||||
if (!dirEntry)
|
if (err || !dirEntry)
|
||||||
break;
|
break;
|
||||||
char* entryName = dirEntry->d_name;
|
char* entryName = dirEntry->d_name;
|
||||||
if (strncmp(entryName, "BAT", 3))
|
if (strncmp(entryName, "BAT", 3))
|
||||||
|
@ -84,9 +85,10 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
char line[50];
|
char line[50] = "";
|
||||||
for (unsigned short int i = 0; i < lineNum; i++) {
|
for (unsigned short int i = 0; i < lineNum; i++) {
|
||||||
fgets(line, sizeof line, file);
|
char* ok = fgets(line, sizeof line, file);
|
||||||
|
if (!ok) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
@ -116,8 +118,8 @@ static ACPresence procAcpiCheck() {
|
||||||
struct dirent result;
|
struct dirent result;
|
||||||
struct dirent* dirEntry;
|
struct dirent* dirEntry;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
readdir_r((DIR *) power_supplyDir, &result, &dirEntry);
|
int err = readdir_r((DIR *) power_supplyDir, &result, &dirEntry);
|
||||||
if (!dirEntry)
|
if (err || !dirEntry)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
char* entryName = (char *) dirEntry->d_name;
|
char* entryName = (char *) dirEntry->d_name;
|
||||||
|
@ -169,8 +171,8 @@ static ACPresence sysCheck() {
|
||||||
struct dirent result;
|
struct dirent result;
|
||||||
struct dirent* dirEntry;
|
struct dirent* dirEntry;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
readdir_r((DIR *) power_supplyDir, &result, &dirEntry);
|
int err = readdir_r((DIR *) power_supplyDir, &result, &dirEntry);
|
||||||
if (!dirEntry)
|
if (err || !dirEntry)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
char* entryName = (char *) dirEntry->d_name;
|
char* entryName = (char *) dirEntry->d_name;
|
||||||
|
@ -232,8 +234,8 @@ static double getSysBatData() {
|
||||||
struct dirent result;
|
struct dirent result;
|
||||||
struct dirent* dirEntry;
|
struct dirent* dirEntry;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
readdir_r((DIR *) power_supplyDir, &result, &dirEntry);
|
int err = readdir_r((DIR *) power_supplyDir, &result, &dirEntry);
|
||||||
if (!dirEntry)
|
if (err || !dirEntry)
|
||||||
break;
|
break;
|
||||||
char* entryName = (char *) dirEntry->d_name;
|
char* entryName = (char *) dirEntry->d_name;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ What's new in version 1.0.3
|
||||||
of IO data depending on selected fields.
|
of IO data depending on selected fields.
|
||||||
* Better consistency in coloring.
|
* Better consistency in coloring.
|
||||||
* Increase limit of buffer when tracing a deep nested process tree.
|
* Increase limit of buffer when tracing a deep nested process tree.
|
||||||
|
* Display pagefault stats.
|
||||||
* BUGFIX: Fix crash when adding meters and toggling detailed CPU time.
|
* BUGFIX: Fix crash when adding meters and toggling detailed CPU time.
|
||||||
(thanks to Dawid Gajownik)
|
(thanks to Dawid Gajownik)
|
||||||
* Add column to track the OOM-killer score of processes
|
* Add column to track the OOM-killer score of processes
|
||||||
|
|
2
IncSet.c
2
IncSet.c
|
@ -29,7 +29,7 @@ typedef enum {
|
||||||
#define IncSet_filter(inc_) (inc_->filtering ? inc_->modes[INC_FILTER].buffer : NULL)
|
#define IncSet_filter(inc_) (inc_->filtering ? inc_->modes[INC_FILTER].buffer : NULL)
|
||||||
|
|
||||||
typedef struct IncMode_ {
|
typedef struct IncMode_ {
|
||||||
char buffer[INCMODE_MAX];
|
char buffer[INCMODE_MAX+1];
|
||||||
int index;
|
int index;
|
||||||
FunctionBar* bar;
|
FunctionBar* bar;
|
||||||
bool isFilter;
|
bool isFilter;
|
||||||
|
|
2
IncSet.h
2
IncSet.h
|
@ -24,7 +24,7 @@ typedef enum {
|
||||||
#define IncSet_filter(inc_) (inc_->filtering ? inc_->modes[INC_FILTER].buffer : NULL)
|
#define IncSet_filter(inc_) (inc_->filtering ? inc_->modes[INC_FILTER].buffer : NULL)
|
||||||
|
|
||||||
typedef struct IncMode_ {
|
typedef struct IncMode_ {
|
||||||
char buffer[INCMODE_MAX];
|
char buffer[INCMODE_MAX+1];
|
||||||
int index;
|
int index;
|
||||||
FunctionBar* bar;
|
FunctionBar* bar;
|
||||||
bool isFilter;
|
bool isFilter;
|
||||||
|
|
|
@ -168,11 +168,11 @@ typedef struct Process_ {
|
||||||
int basenameOffset;
|
int basenameOffset;
|
||||||
bool updated;
|
bool updated;
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
unsigned long int minflt;
|
unsigned long int minflt;
|
||||||
unsigned long int cminflt;
|
unsigned long int cminflt;
|
||||||
unsigned long int majflt;
|
unsigned long int majflt;
|
||||||
unsigned long int cmajflt;
|
unsigned long int cmajflt;
|
||||||
|
#ifdef DEBUG
|
||||||
long int itrealvalue;
|
long int itrealvalue;
|
||||||
unsigned long int vsize;
|
unsigned long int vsize;
|
||||||
long int rss;
|
long int rss;
|
||||||
|
@ -254,7 +254,7 @@ const int Process_fieldFlags[] = {
|
||||||
|
|
||||||
const char *Process_fieldTitles[] = {
|
const char *Process_fieldTitles[] = {
|
||||||
"", " PID ", "Command ", "S ", " PPID ", " PGRP ", " SESN ",
|
"", " PID ", "Command ", "S ", " PPID ", " PGRP ", " SESN ",
|
||||||
" TTY ", " TPGID ", "- ", "- ", "- ", "- ", "- ",
|
" TTY ", " TPGID ", "- ", " MINFLT ", " CMINFLT ", " MAJFLT ", " CMAJFLT ",
|
||||||
" UTIME+ ", " STIME+ ", " CUTIME+ ", " CSTIME+ ", "PRI ", " NI ", "- ",
|
" UTIME+ ", " STIME+ ", " CUTIME+ ", " CSTIME+ ", "PRI ", " NI ", "- ",
|
||||||
"START ", "- ", "- ", "- ", "- ", "- ", "- ",
|
"START ", "- ", "- ", "- ", "- ", "- ", "- ",
|
||||||
"- ", "- ", "- ", "- ", "- ", "- ", "- ",
|
"- ", "- ", "- ", "- ", "- ", "- ", "- ",
|
||||||
|
@ -483,6 +483,10 @@ static void Process_writeField(Process* this, RichString* str, ProcessField fiel
|
||||||
case TTY_NR: snprintf(buffer, n, "%5u ", this->tty_nr); break;
|
case TTY_NR: snprintf(buffer, n, "%5u ", this->tty_nr); break;
|
||||||
case TGID: snprintf(buffer, n, Process_pidFormat, this->tgid); break;
|
case TGID: snprintf(buffer, n, Process_pidFormat, this->tgid); break;
|
||||||
case TPGID: snprintf(buffer, n, Process_tpgidFormat, this->tpgid); break;
|
case TPGID: snprintf(buffer, n, Process_tpgidFormat, this->tpgid); break;
|
||||||
|
case MINFLT: Process_colorNumber(str, this->minflt, coloring); return;
|
||||||
|
case CMINFLT: Process_colorNumber(str, this->cminflt, coloring); return;
|
||||||
|
case MAJFLT: Process_colorNumber(str, this->majflt, coloring); return;
|
||||||
|
case CMAJFLT: Process_colorNumber(str, this->cmajflt, coloring); return;
|
||||||
case PROCESSOR: snprintf(buffer, n, "%3d ", ProcessList_cpuId(this->pl, this->processor)); break;
|
case PROCESSOR: snprintf(buffer, n, "%3d ", ProcessList_cpuId(this->pl, this->processor)); break;
|
||||||
case NLWP: snprintf(buffer, n, "%4ld ", this->nlwp); break;
|
case NLWP: snprintf(buffer, n, "%4ld ", this->nlwp); break;
|
||||||
case COMM: {
|
case COMM: {
|
||||||
|
|
|
@ -147,11 +147,11 @@ typedef struct Process_ {
|
||||||
int basenameOffset;
|
int basenameOffset;
|
||||||
bool updated;
|
bool updated;
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
unsigned long int minflt;
|
unsigned long int minflt;
|
||||||
unsigned long int cminflt;
|
unsigned long int cminflt;
|
||||||
unsigned long int majflt;
|
unsigned long int majflt;
|
||||||
unsigned long int cmajflt;
|
unsigned long int cmajflt;
|
||||||
|
#ifdef DEBUG
|
||||||
long int itrealvalue;
|
long int itrealvalue;
|
||||||
unsigned long int vsize;
|
unsigned long int vsize;
|
||||||
long int rss;
|
long int rss;
|
||||||
|
|
|
@ -444,10 +444,14 @@ static bool ProcessList_readStatFile(Process *process, const char* dirname, cons
|
||||||
location += 1;
|
location += 1;
|
||||||
process->flags = strtoul(location, &location, 10);
|
process->flags = strtoul(location, &location, 10);
|
||||||
location += 1;
|
location += 1;
|
||||||
location = strchr(location, ' ')+1;
|
process->minflt = strtoull(location, &location, 10);
|
||||||
location = strchr(location, ' ')+1;
|
location += 1;
|
||||||
location = strchr(location, ' ')+1;
|
process->cminflt = strtoull(location, &location, 10);
|
||||||
location = strchr(location, ' ')+1;
|
location += 1;
|
||||||
|
process->majflt = strtoull(location, &location, 10);
|
||||||
|
location += 1;
|
||||||
|
process->cmajflt = strtoull(location, &location, 10);
|
||||||
|
location += 1;
|
||||||
process->utime = strtoull(location, &location, 10);
|
process->utime = strtoull(location, &location, 10);
|
||||||
location += 1;
|
location += 1;
|
||||||
process->stime = strtoull(location, &location, 10);
|
process->stime = strtoull(location, &location, 10);
|
||||||
|
|
|
@ -61,7 +61,7 @@ static void Settings_readMeterModes(Settings* this, char* line, HeaderSide side)
|
||||||
String_freeArray(ids);
|
String_freeArray(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Settings_read(Settings* this, char* fileName, int cpuCount) {
|
static bool Settings_read(Settings* this, const char* fileName, int cpuCount) {
|
||||||
FILE* fd = fopen(fileName, "r");
|
FILE* fd = fopen(fileName, "r");
|
||||||
if (!fd)
|
if (!fd)
|
||||||
return false;
|
return false;
|
||||||
|
@ -265,7 +265,6 @@ Settings* Settings_new(ProcessList* pl, Header* header, int cpuCount) {
|
||||||
// Transition to new location and delete old configuration file
|
// Transition to new location and delete old configuration file
|
||||||
if (Settings_write(this))
|
if (Settings_write(this))
|
||||||
unlink(legacyDotfile);
|
unlink(legacyDotfile);
|
||||||
free(legacyDotfile);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this->changed = true;
|
this->changed = true;
|
||||||
|
@ -280,5 +279,6 @@ Settings* Settings_new(ProcessList* pl, Header* header, int cpuCount) {
|
||||||
pl->highlightThreads = false;
|
pl->highlightThreads = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free(legacyDotfile);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_PREREQ(2.65)
|
AC_PREREQ(2.65)
|
||||||
AC_INIT([htop],[1.0.2],[hisham@gobolinux.org])
|
AC_INIT([htop],[1.0.3],[hisham@gobolinux.org])
|
||||||
|
|
||||||
# The following two lines are required by hwloc scripts
|
# The following two lines are required by hwloc scripts
|
||||||
AC_USE_SYSTEM_EXTENSIONS
|
AC_USE_SYSTEM_EXTENSIONS
|
||||||
|
|
3
htop.c
3
htop.c
|
@ -623,6 +623,9 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
if (inc->active) {
|
if (inc->active) {
|
||||||
doRefresh = IncSet_handleKey(inc, ch, panel, getMainPanelValue, NULL);
|
doRefresh = IncSet_handleKey(inc, ch, panel, getMainPanelValue, NULL);
|
||||||
|
if (!inc->active) {
|
||||||
|
follow = true;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue