mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-15 21:44:36 +03:00
Compare commits
38 Commits
3.0.0beta2
...
3.0.0beta3
Author | SHA1 | Date | |
---|---|---|---|
6ee99566cd | |||
dc6bb069f0 | |||
0169577019 | |||
0e38be9ee7 | |||
8e6c1e1bac | |||
709619800f | |||
a72439c9b7 | |||
61e94c1b5b | |||
b9f5892593 | |||
267d03b6d8 | |||
3b819daf82 | |||
d9f8cdf0a6 | |||
59982a188c | |||
0800424fe6 | |||
b4a8f048d1 | |||
2df1f61d77 | |||
e6c98b6e8e | |||
b815e4c7a3 | |||
4791050cea | |||
1edcfad874 | |||
d4ea7cd65c | |||
9ca1c993ac | |||
ccd156f8ba | |||
858af2505f | |||
655c7293d2 | |||
bc5d46982f | |||
c01f40eb3e | |||
eed18dd107 | |||
f914617508 | |||
03b2581745 | |||
8c653212c0 | |||
b064d501ae | |||
ff78a1bfce | |||
f4f35da7e0 | |||
76366be3f1 | |||
6dda8d2586 | |||
5fca258f33 | |||
70ed51a303 |
7
Action.c
7
Action.c
@ -115,7 +115,7 @@ static void Action_runSetup(Settings* settings, const Header* header, ProcessLis
|
|||||||
|
|
||||||
static bool changePriority(MainPanel* panel, int delta) {
|
static bool changePriority(MainPanel* panel, int delta) {
|
||||||
bool anyTagged;
|
bool anyTagged;
|
||||||
bool ok = MainPanel_foreachProcess(panel, (MainPanel_ForeachProcessFn) Process_changePriorityBy, delta, &anyTagged);
|
bool ok = MainPanel_foreachProcess(panel, (MainPanel_ForeachProcessFn) Process_changePriorityBy, (Arg){ .i = delta }, &anyTagged);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
beep();
|
beep();
|
||||||
return anyTagged;
|
return anyTagged;
|
||||||
@ -187,6 +187,7 @@ static Htop_Reaction sortBy(State* st) {
|
|||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
||||||
static Htop_Reaction actionResize(State* st) {
|
static Htop_Reaction actionResize(State* st) {
|
||||||
|
clear();
|
||||||
Panel_resize(st->panel, COLS, LINES-(st->panel->y)-1);
|
Panel_resize(st->panel, COLS, LINES-(st->panel->y)-1);
|
||||||
return HTOP_REDRAW_BAR;
|
return HTOP_REDRAW_BAR;
|
||||||
}
|
}
|
||||||
@ -297,7 +298,7 @@ static Htop_Reaction actionSetAffinity(State* st) {
|
|||||||
void* set = Action_pickFromVector(st, affinityPanel, 15);
|
void* set = Action_pickFromVector(st, affinityPanel, 15);
|
||||||
if (set) {
|
if (set) {
|
||||||
Affinity* affinity = AffinityPanel_getAffinity(affinityPanel, st->pl);
|
Affinity* affinity = AffinityPanel_getAffinity(affinityPanel, st->pl);
|
||||||
bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) Affinity_set, (size_t) affinity, NULL);
|
bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) Affinity_set, (Arg){ .v = affinity }, NULL);
|
||||||
if (!ok) beep();
|
if (!ok) beep();
|
||||||
Affinity_delete(affinity);
|
Affinity_delete(affinity);
|
||||||
}
|
}
|
||||||
@ -314,7 +315,7 @@ static Htop_Reaction actionKill(State* st) {
|
|||||||
Panel_setHeader(st->panel, "Sending...");
|
Panel_setHeader(st->panel, "Sending...");
|
||||||
Panel_draw(st->panel, true);
|
Panel_draw(st->panel, true);
|
||||||
refresh();
|
refresh();
|
||||||
MainPanel_foreachProcess((MainPanel*)st->panel, (MainPanel_ForeachProcessFn) Process_sendSignal, (size_t) sgn->key, NULL);
|
MainPanel_foreachProcess((MainPanel*)st->panel, (MainPanel_ForeachProcessFn) Process_sendSignal, (Arg){ .i = sgn->key }, NULL);
|
||||||
napms(500);
|
napms(500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
56
CONTRIBUTING.md
Normal file
56
CONTRIBUTING.md
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
Contributing Guide
|
||||||
|
==================
|
||||||
|
|
||||||
|
Hello, and thank you so much for taking your time to contribute in any way to
|
||||||
|
htop! There are many ways to contribute, and I'll try to list them below. The
|
||||||
|
support from the free software community has been amazing over the years and
|
||||||
|
it is the number one thing that keeps me going, maintaining and improving
|
||||||
|
something that started as a tiny pet project back in 2004 and that nowadays is
|
||||||
|
a piece of software used all over the world, in both reality [and
|
||||||
|
fiction!](http://hisham.hm/htop/index.php?page=sightings). Cheers!
|
||||||
|
|
||||||
|
-- Hisham Muhammad
|
||||||
|
|
||||||
|
Bug Reports
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Bug reports should be posted in the [Github issue
|
||||||
|
tracker](http://github.com/hishamhm/htop/issues). (I reply to them all, but I
|
||||||
|
usually do it in batches! :) ) Bug reports are extremely important since it's
|
||||||
|
impossible for me to test htop in every possible system, distribution and
|
||||||
|
scenario. Your feedback is what keeps the tool stable and always improving!
|
||||||
|
Thank you!
|
||||||
|
|
||||||
|
Pull Requests
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Code contributions are most welcome! Just [fork the
|
||||||
|
repo](http://github.com/hishamhm/htop) and send a [pull
|
||||||
|
request](https://github.com/hishamhm/htop/pulls). Help is especially
|
||||||
|
appreciated for support of platforms other than Linux. If proposing new
|
||||||
|
features, please be mindful that htop is a system tool that needs to keep a
|
||||||
|
small footprint and perform well on systems under stress -- so unfortunately I
|
||||||
|
can't accept every new feature proposed, as I need to keep the tool slim and
|
||||||
|
maintainable. Great ideas backed by a PR are always carefully considered for
|
||||||
|
inclusion, though! Also, PRs containing bug fixes and portability tweaks are a
|
||||||
|
no-brainer, please send those in!
|
||||||
|
|
||||||
|
Feature Requests
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Back when htop was hosted in SourceForge, there used to be separate Bug
|
||||||
|
Tracker and Feature Request pages. These go all lumped together under "Issues"
|
||||||
|
in Github, which is a bit confusing. For this reason, I close Feature Requests
|
||||||
|
and file them with the [`feature
|
||||||
|
request`](https://github.com/hishamhm/htop/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22feature+request%22+)
|
||||||
|
label, where they remain accessible, but not mixed with actual bug reports.
|
||||||
|
This doesn't mean I'm dismissing or ignoring feature requests right away! It's
|
||||||
|
just an organizational issue (with Github, really!).
|
||||||
|
|
||||||
|
Donations
|
||||||
|
---------
|
||||||
|
|
||||||
|
If you like htop, feel free to [buy the author a
|
||||||
|
beer](http://hisham.hm/htop/index.php?page=donate). :-)
|
||||||
|
|
@ -2,6 +2,12 @@ What's new in version 2.1.1
|
|||||||
|
|
||||||
* Check for pkg-config when building with --enable-delayacct
|
* Check for pkg-config when building with --enable-delayacct
|
||||||
(thanks to @florian2833z for the report)
|
(thanks to @florian2833z for the report)
|
||||||
|
* Use CFLAGS from ncurses*-config if present
|
||||||
|
(thanks to Michael Klein)
|
||||||
|
* Fix build failure in Glibc 2.28
|
||||||
|
(thanks to Kang-Che Sung)
|
||||||
|
* BUGFIX: fix behavior of SYSCR column
|
||||||
|
(thanks to Marc Kleine-Budde)
|
||||||
* BUGFIX: preserve LDFLAGS when building
|
* BUGFIX: preserve LDFLAGS when building
|
||||||
(thanks to Lance Frederickson for the report)
|
(thanks to Lance Frederickson for the report)
|
||||||
* BUGFIX: fix issue with small terminals
|
* BUGFIX: fix issue with small terminals
|
||||||
|
@ -25,7 +25,12 @@ typedef struct MainPanel_ {
|
|||||||
pid_t pidSearch;
|
pid_t pidSearch;
|
||||||
} MainPanel;
|
} MainPanel;
|
||||||
|
|
||||||
typedef bool(*MainPanel_ForeachProcessFn)(Process*, size_t);
|
typedef union {
|
||||||
|
int i;
|
||||||
|
void* v;
|
||||||
|
} Arg;
|
||||||
|
|
||||||
|
typedef bool(*MainPanel_ForeachProcessFn)(Process*, Arg);
|
||||||
|
|
||||||
#define MainPanel_getFunctionBar(this_) (((Panel*)(this_))->defaultBar)
|
#define MainPanel_getFunctionBar(this_) (((Panel*)(this_))->defaultBar)
|
||||||
|
|
||||||
@ -150,7 +155,7 @@ const char* MainPanel_getValue(MainPanel* this, int i) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, size_t arg, bool* wasAnyTagged) {
|
bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Arg arg, bool* wasAnyTagged) {
|
||||||
Panel* super = (Panel*) this;
|
Panel* super = (Panel*) this;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
bool anyTagged = false;
|
bool anyTagged = false;
|
||||||
|
@ -21,7 +21,12 @@ typedef struct MainPanel_ {
|
|||||||
pid_t pidSearch;
|
pid_t pidSearch;
|
||||||
} MainPanel;
|
} MainPanel;
|
||||||
|
|
||||||
typedef bool(*MainPanel_ForeachProcessFn)(Process*, size_t);
|
typedef union {
|
||||||
|
int i;
|
||||||
|
void* v;
|
||||||
|
} Arg;
|
||||||
|
|
||||||
|
typedef bool(*MainPanel_ForeachProcessFn)(Process*, Arg);
|
||||||
|
|
||||||
#define MainPanel_getFunctionBar(this_) (((Panel*)(this_))->defaultBar)
|
#define MainPanel_getFunctionBar(this_) (((Panel*)(this_))->defaultBar)
|
||||||
|
|
||||||
@ -34,7 +39,7 @@ int MainPanel_selectedPid(MainPanel* this);
|
|||||||
|
|
||||||
const char* MainPanel_getValue(MainPanel* this, int i);
|
const char* MainPanel_getValue(MainPanel* this, int i);
|
||||||
|
|
||||||
bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, size_t arg, bool* wasAnyTagged);
|
bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Arg arg, bool* wasAnyTagged);
|
||||||
|
|
||||||
extern PanelClass MainPanel_class;
|
extern PanelClass MainPanel_class;
|
||||||
|
|
||||||
|
2
Meter.c
2
Meter.c
@ -404,7 +404,7 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
|
|||||||
k = -i/2;
|
k = -i/2;
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
for (; i < nValues; i+=2, k++) {
|
for (; i < nValues - 1; i+=2, k++) {
|
||||||
int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT;
|
int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT;
|
||||||
int v1 = CLAMP((int) lround(data->values[i] * pix), 1, pix);
|
int v1 = CLAMP((int) lround(data->values[i] * pix), 1, pix);
|
||||||
int v2 = CLAMP((int) lround(data->values[i+1] * pix), 1, pix);
|
int v2 = CLAMP((int) lround(data->values[i+1] * pix), 1, pix);
|
||||||
|
@ -130,7 +130,7 @@ void OpenFilesScreen_scan(InfoScreen* this) {
|
|||||||
char** data = fdata->data.data;
|
char** data = fdata->data.data;
|
||||||
int lenN = data['n'] ? strlen(data['n']) : 0;
|
int lenN = data['n'] ? strlen(data['n']) : 0;
|
||||||
int sizeEntry = 5 + 7 + 10 + 10 + 10 + lenN + 5 /*spaces*/ + 1 /*null*/;
|
int sizeEntry = 5 + 7 + 10 + 10 + 10 + lenN + 5 /*spaces*/ + 1 /*null*/;
|
||||||
char* entry = xMalloc(sizeEntry);
|
char entry[sizeEntry];
|
||||||
xSnprintf(entry, sizeEntry, "%5.5s %7.7s %10.10s %10.10s %10.10s %s",
|
xSnprintf(entry, sizeEntry, "%5.5s %7.7s %10.10s %10.10s %10.10s %s",
|
||||||
data['f'] ? data['f'] : "",
|
data['f'] ? data['f'] : "",
|
||||||
data['t'] ? data['t'] : "",
|
data['t'] ? data['t'] : "",
|
||||||
|
10
Process.c
10
Process.c
@ -28,6 +28,12 @@ in the source distribution for its full text.
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#ifdef MAJOR_IN_MKDEV
|
||||||
|
#include <sys/mkdev.h>
|
||||||
|
#elif defined(MAJOR_IN_SYSMACROS) || \
|
||||||
|
(defined(HAVE_SYS_SYSMACROS_H) && HAVE_SYS_SYSMACROS_H)
|
||||||
|
#include <sys/sysmacros.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
#define SYS_ioprio_get __NR_ioprio_get
|
#define SYS_ioprio_get __NR_ioprio_get
|
||||||
@ -537,11 +543,11 @@ bool Process_setPriority(Process* this, int priority) {
|
|||||||
return (err == 0);
|
return (err == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Process_changePriorityBy(Process* this, size_t delta) {
|
bool Process_changePriorityBy(Process* this, int delta) {
|
||||||
return Process_setPriority(this, this->nice + delta);
|
return Process_setPriority(this, this->nice + delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Process_sendSignal(Process* this, size_t sgn) {
|
void Process_sendSignal(Process* this, int sgn) {
|
||||||
CRT_dropPrivileges();
|
CRT_dropPrivileges();
|
||||||
kill(this->pid, (int) sgn);
|
kill(this->pid, (int) sgn);
|
||||||
CRT_restorePrivileges();
|
CRT_restorePrivileges();
|
||||||
|
@ -9,6 +9,11 @@ Released under the GNU GPL, see the COPYING file
|
|||||||
in the source distribution for its full text.
|
in the source distribution for its full text.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef MAJOR_IN_MKDEV
|
||||||
|
#elif defined(MAJOR_IN_SYSMACROS) || \
|
||||||
|
(defined(HAVE_SYS_SYSMACROS_H) && HAVE_SYS_SYSMACROS_H)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
#define SYS_ioprio_get __NR_ioprio_get
|
#define SYS_ioprio_get __NR_ioprio_get
|
||||||
#define SYS_ioprio_set __NR_ioprio_set
|
#define SYS_ioprio_set __NR_ioprio_set
|
||||||
@ -193,9 +198,9 @@ void Process_toggleTag(Process* this);
|
|||||||
|
|
||||||
bool Process_setPriority(Process* this, int priority);
|
bool Process_setPriority(Process* this, int priority);
|
||||||
|
|
||||||
bool Process_changePriorityBy(Process* this, size_t delta);
|
bool Process_changePriorityBy(Process* this, int delta);
|
||||||
|
|
||||||
void Process_sendSignal(Process* this, size_t sgn);
|
void Process_sendSignal(Process* this, int sgn);
|
||||||
|
|
||||||
long Process_pidCompare(const void* v1, const void* v2);
|
long Process_pidCompare(const void* v1, const void* v2);
|
||||||
|
|
||||||
|
@ -63,6 +63,10 @@ typedef struct RichString_ {
|
|||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
#ifndef CLAMP
|
||||||
|
#define CLAMP(x,low,high) (((x)>(high))?(high):(((x)<(low))?(low):(x)))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define charBytes(n) (sizeof(CharType) * (n))
|
#define charBytes(n) (sizeof(CharType) * (n))
|
||||||
|
|
||||||
static void RichString_extendLen(RichString* this, int len) {
|
static void RichString_extendLen(RichString* this, int len) {
|
||||||
@ -103,6 +107,7 @@ static inline void RichString_writeFrom(RichString* this, int attrs, const char*
|
|||||||
|
|
||||||
inline void RichString_setAttrn(RichString* this, int attrs, int start, int finish) {
|
inline void RichString_setAttrn(RichString* this, int attrs, int start, int finish) {
|
||||||
cchar_t* ch = this->chptr + start;
|
cchar_t* ch = this->chptr + start;
|
||||||
|
finish = CLAMP(finish, 0, this->chlen - 1);
|
||||||
for (int i = start; i <= finish; i++) {
|
for (int i = start; i <= finish; i++) {
|
||||||
ch->attr = attrs;
|
ch->attr = attrs;
|
||||||
ch++;
|
ch++;
|
||||||
@ -132,6 +137,7 @@ static inline void RichString_writeFrom(RichString* this, int attrs, const char*
|
|||||||
|
|
||||||
void RichString_setAttrn(RichString* this, int attrs, int start, int finish) {
|
void RichString_setAttrn(RichString* this, int attrs, int start, int finish) {
|
||||||
chtype* ch = this->chptr + start;
|
chtype* ch = this->chptr + start;
|
||||||
|
finish = CLAMP(finish, 0, this->chlen - 1);
|
||||||
for (int i = start; i <= finish; i++) {
|
for (int i = start; i <= finish; i++) {
|
||||||
*ch = (*ch & 0xff) | attrs;
|
*ch = (*ch & 0xff) | attrs;
|
||||||
ch++;
|
ch++;
|
||||||
|
@ -59,6 +59,10 @@ typedef struct RichString_ {
|
|||||||
} RichString;
|
} RichString;
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef CLAMP
|
||||||
|
#define CLAMP(x,low,high) (((x)>(high))?(high):(((x)<(low))?(low):(x)))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define charBytes(n) (sizeof(CharType) * (n))
|
#define charBytes(n) (sizeof(CharType) * (n))
|
||||||
|
|
||||||
#define RichString_setLen(this, len) do{ if(len < RICHSTRING_MAXLEN && this->chlen < RICHSTRING_MAXLEN) { RichString_setChar(this,len,0); this->chlen=len; } else RichString_extendLen(this,len); }while(0)
|
#define RichString_setLen(this, len) do{ if(len < RICHSTRING_MAXLEN && this->chlen < RICHSTRING_MAXLEN) { RichString_setChar(this,len,0); this->chlen=len; } else RichString_extendLen(this,len); }while(0)
|
||||||
|
36
Settings.c
36
Settings.c
@ -285,7 +285,8 @@ static bool Settings_read(Settings* this, const char* fileName) {
|
|||||||
if (!fd)
|
if (!fd)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool readMeters = false;
|
bool didReadMeters = false;
|
||||||
|
bool didReadFields = false;
|
||||||
ProcessField* legacyFields = xCalloc(Platform_numberOfFields+1, sizeof(ProcessField));
|
ProcessField* legacyFields = xCalloc(Platform_numberOfFields+1, sizeof(ProcessField));
|
||||||
int legacyFlags;
|
int legacyFlags;
|
||||||
bool legacyFieldsRead = false;
|
bool legacyFieldsRead = false;
|
||||||
@ -342,16 +343,16 @@ static bool Settings_read(Settings* this, const char* fileName) {
|
|||||||
if (this->colorScheme < 0 || this->colorScheme >= LAST_COLORSCHEME) this->colorScheme = 0;
|
if (this->colorScheme < 0 || this->colorScheme >= LAST_COLORSCHEME) this->colorScheme = 0;
|
||||||
} else if (String_eq(option[0], "left_meters")) {
|
} else if (String_eq(option[0], "left_meters")) {
|
||||||
Settings_readMeters(this, option[1], 0);
|
Settings_readMeters(this, option[1], 0);
|
||||||
readMeters = true;
|
didReadMeters = true;
|
||||||
} else if (String_eq(option[0], "right_meters")) {
|
} else if (String_eq(option[0], "right_meters")) {
|
||||||
Settings_readMeters(this, option[1], 1);
|
Settings_readMeters(this, option[1], 1);
|
||||||
readMeters = true;
|
didReadMeters = true;
|
||||||
} else if (String_eq(option[0], "left_meter_modes")) {
|
} else if (String_eq(option[0], "left_meter_modes")) {
|
||||||
Settings_readMeterModes(this, option[1], 0);
|
Settings_readMeterModes(this, option[1], 0);
|
||||||
readMeters = true;
|
didReadMeters = true;
|
||||||
} else if (String_eq(option[0], "right_meter_modes")) {
|
} else if (String_eq(option[0], "right_meter_modes")) {
|
||||||
Settings_readMeterModes(this, option[1], 1);
|
Settings_readMeterModes(this, option[1], 1);
|
||||||
readMeters = true;
|
didReadMeters = true;
|
||||||
} else if (strncmp(option[0], "screen:", 7) == 0) {
|
} else if (strncmp(option[0], "screen:", 7) == 0) {
|
||||||
Settings_newScreen(this, option[0] + 7, option[1]);
|
Settings_newScreen(this, option[0] + 7, option[1]);
|
||||||
} else if (String_eq(option[0], ".tree_view")) {
|
} else if (String_eq(option[0], ".tree_view")) {
|
||||||
@ -378,10 +379,10 @@ static bool Settings_read(Settings* this, const char* fileName) {
|
|||||||
this->screens[0]->flags = legacyFlags;
|
this->screens[0]->flags = legacyFlags;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!readMeters) {
|
if (!didReadMeters) {
|
||||||
Settings_defaultMeters(this);
|
Settings_defaultMeters(this);
|
||||||
}
|
}
|
||||||
return true;
|
return didReadFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void writeFields(FILE* fd, ProcessField* fields, bool byName) {
|
static void writeFields(FILE* fd, ProcessField* fields, bool byName) {
|
||||||
@ -513,10 +514,8 @@ Settings* Settings_new(int cpuCount) {
|
|||||||
free(htopDir);
|
free(htopDir);
|
||||||
free(configDir);
|
free(configDir);
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (lstat(legacyDotfile, &st) != 0) {
|
int err = lstat(legacyDotfile, &st);
|
||||||
st.st_mode = 0;
|
if (err || S_ISLNK(st.st_mode)) {
|
||||||
}
|
|
||||||
if (access(legacyDotfile, R_OK) != 0 || S_ISLNK(st.st_mode)) {
|
|
||||||
free(legacyDotfile);
|
free(legacyDotfile);
|
||||||
legacyDotfile = NULL;
|
legacyDotfile = NULL;
|
||||||
}
|
}
|
||||||
@ -525,19 +524,26 @@ Settings* Settings_new(int cpuCount) {
|
|||||||
this->colorScheme = 0;
|
this->colorScheme = 0;
|
||||||
this->changed = false;
|
this->changed = false;
|
||||||
this->delay = DEFAULT_DELAY;
|
this->delay = DEFAULT_DELAY;
|
||||||
bool ok = Settings_read(this, legacyDotfile ? legacyDotfile : this->filename);
|
bool ok = false;
|
||||||
if (ok) {
|
|
||||||
if (legacyDotfile) {
|
if (legacyDotfile) {
|
||||||
|
ok = Settings_read(this, legacyDotfile);
|
||||||
|
if (ok) {
|
||||||
// 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);
|
||||||
}
|
}
|
||||||
} else {
|
free(legacyDotfile);
|
||||||
|
}
|
||||||
|
if (!ok) {
|
||||||
|
ok = Settings_read(this, this->filename);
|
||||||
|
}
|
||||||
|
if (!ok) {
|
||||||
this->changed = true;
|
this->changed = true;
|
||||||
// TODO: how to get SYSCONFDIR correctly through Autoconf?
|
// TODO: how to get SYSCONFDIR correctly through Autoconf?
|
||||||
char* systemSettings = String_cat(SYSCONFDIR, "/htoprc");
|
char* systemSettings = String_cat(SYSCONFDIR, "/htoprc");
|
||||||
ok = Settings_read(this, systemSettings);
|
ok = Settings_read(this, systemSettings);
|
||||||
free(systemSettings);
|
free(systemSettings);
|
||||||
|
}
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
Settings_defaultMeters(this);
|
Settings_defaultMeters(this);
|
||||||
Settings_defaultScreens(this);
|
Settings_defaultScreens(this);
|
||||||
@ -546,12 +552,10 @@ Settings* Settings_new(int cpuCount) {
|
|||||||
this->highlightThreads = true;
|
this->highlightThreads = true;
|
||||||
this->headerMargin = true;
|
this->headerMargin = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
this->ssIndex = 0;
|
this->ssIndex = 0;
|
||||||
this->ss = this->screens[this->ssIndex];
|
this->ss = this->screens[this->ssIndex];
|
||||||
|
|
||||||
free(legacyDotfile);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ Released under the GNU GPL, see the COPYING file
|
|||||||
in the source distribution for its full text.
|
in the source distribution for its full text.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define DEFAULT_DELAY 15
|
||||||
|
|
||||||
#include "Process.h"
|
#include "Process.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
@ -108,7 +108,8 @@ bool TraceScreen_forkTracer(TraceScreen* this) {
|
|||||||
(void) written;
|
(void) written;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
fcntl(this->fdpair[0], F_SETFL, O_NONBLOCK);
|
int ok = fcntl(this->fdpair[0], F_SETFL, O_NONBLOCK);
|
||||||
|
if (ok == -1) return false;
|
||||||
this->strace = fdopen(this->fdpair[0], "r");
|
this->strace = fdopen(this->fdpair[0], "r");
|
||||||
this->fd_strace = fileno(this->strace);
|
this->fd_strace = fileno(this->strace);
|
||||||
return true;
|
return true;
|
||||||
|
34
configure.ac
34
configure.ac
@ -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],[3.0.0beta2],[hisham@gobolinux.org])
|
AC_INIT([htop],[3.0.0beta3],[hisham@gobolinux.org])
|
||||||
|
|
||||||
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}"
|
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}"
|
||||||
year=$(date -u -d "@$SOURCE_DATE_EPOCH" "+%Y" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+%Y" 2>/dev/null || date -u "+%Y")
|
year=$(date -u -d "@$SOURCE_DATE_EPOCH" "+%Y" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+%Y" 2>/dev/null || date -u "+%Y")
|
||||||
@ -61,6 +61,16 @@ AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h],[
|
|||||||
])
|
])
|
||||||
AC_CHECK_HEADERS([execinfo.h],[:],[:])
|
AC_CHECK_HEADERS([execinfo.h],[:],[:])
|
||||||
|
|
||||||
|
AC_HEADER_MAJOR
|
||||||
|
dnl glibc 2.25 deprecates 'major' and 'minor' in <sys/types.h> and requires to
|
||||||
|
dnl include <sys/sysmacros.h>. However the logic in AC_HEADER_MAJOR has not yet
|
||||||
|
dnl been updated in Autoconf 2.69, so use a workaround:
|
||||||
|
m4_version_prereq([2.70], [],
|
||||||
|
[if test "x$ac_cv_header_sys_mkdev_h" = xno; then
|
||||||
|
AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS, 1,
|
||||||
|
[Define to 1 if `major', `minor', and `makedev' are declared in <sys/sysmacros.h>.])])
|
||||||
|
fi])
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
AC_HEADER_STDBOOL
|
AC_HEADER_STDBOOL
|
||||||
@ -154,19 +164,25 @@ m4_define([HTOP_CHECK_SCRIPT],
|
|||||||
[
|
[
|
||||||
if test ! -z "m4_toupper($HTOP_[$1]_CONFIG_SCRIPT)"; then
|
if test ! -z "m4_toupper($HTOP_[$1]_CONFIG_SCRIPT)"; then
|
||||||
# to be used to set the path to ncurses*-config when cross-compiling
|
# to be used to set the path to ncurses*-config when cross-compiling
|
||||||
htop_config_script=$(m4_toupper($HTOP_[$1]_CONFIG_SCRIPT) --libs 2> /dev/null)
|
htop_config_script_libs=$(m4_toupper($HTOP_[$1]_CONFIG_SCRIPT) --libs 2> /dev/null)
|
||||||
|
htop_config_script_cflags=$(m4_toupper($HTOP_[$1]_CONFIG_SCRIPT) --cflags 2> /dev/null)
|
||||||
else
|
else
|
||||||
htop_config_script=$([$4] --libs 2> /dev/null)
|
htop_config_script_libs=$([$4] --libs 2> /dev/null)
|
||||||
|
htop_config_script_cflags=$([$4] --cflags 2> /dev/null)
|
||||||
fi
|
fi
|
||||||
htop_script_success=no
|
htop_script_success=no
|
||||||
htop_save_LDFLAGS="$LDFLAGS"
|
htop_save_LDFLAGS="$LDFLAGS"
|
||||||
if test ! "x$htop_config_script" = x; then
|
htop_save_CFLAGS="$CFLAGS"
|
||||||
LDFLAGS="$htop_config_script $LDFLAGS"
|
if test ! "x$htop_config_script_libs" = x; then
|
||||||
|
LDFLAGS="$htop_config_script_libs $LDFLAGS"
|
||||||
|
CFLAGS="$htop_config_script_cflags $CFLAGS"
|
||||||
AC_CHECK_LIB([$1], [$2], [
|
AC_CHECK_LIB([$1], [$2], [
|
||||||
AC_DEFINE([$3], 1, [The library is present.])
|
AC_DEFINE([$3], 1, [The library is present.])
|
||||||
LIBS="$htop_config_script $LIBS "
|
LIBS="$htop_config_script_libs $LIBS "
|
||||||
htop_script_success=yes
|
htop_script_success=yes
|
||||||
], [])
|
], [
|
||||||
|
CFLAGS="$htop_save_CFLAGS"
|
||||||
|
])
|
||||||
LDFLAGS="$htop_save_LDFLAGS"
|
LDFLAGS="$htop_save_LDFLAGS"
|
||||||
fi
|
fi
|
||||||
if test "x$htop_script_success" = xno; then
|
if test "x$htop_script_success" = xno; then
|
||||||
@ -308,8 +324,8 @@ then
|
|||||||
PKG_PROG_PKG_CONFIG()
|
PKG_PROG_PKG_CONFIG()
|
||||||
PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [], [missing_libraries="$missing_libraries libnl-3"])
|
PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [], [missing_libraries="$missing_libraries libnl-3"])
|
||||||
PKG_CHECK_MODULES(LIBNL3GENL, libnl-genl-3.0, [], [missing_libraries="$missing_libraries libnl-genl-3"])
|
PKG_CHECK_MODULES(LIBNL3GENL, libnl-genl-3.0, [], [missing_libraries="$missing_libraries libnl-genl-3"])
|
||||||
CFLAGS+=" $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS"
|
CFLAGS="$CFLAGS $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS"
|
||||||
LIBS+=" $LIBNL3_LIBS $LIBNL3GENL_LIBS"
|
LIBS="$LIBS $LIBNL3_LIBS $LIBNL3GENL_LIBS"
|
||||||
AC_DEFINE(HAVE_DELAYACCT, 1, [Define if delay accounting support should be enabled.])
|
AC_DEFINE(HAVE_DELAYACCT, 1, [Define if delay accounting support should be enabled.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -110,16 +110,13 @@ static ACPresence procAcpiCheck() {
|
|||||||
char statePath[50];
|
char statePath[50];
|
||||||
xSnprintf((char *) statePath, sizeof statePath, "%s/%s/state", power_supplyPath, entryName);
|
xSnprintf((char *) statePath, sizeof statePath, "%s/%s/state", power_supplyPath, entryName);
|
||||||
FILE* file = fopen(statePath, "r");
|
FILE* file = fopen(statePath, "r");
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
isOn = AC_ERROR;
|
isOn = AC_ERROR;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* line = String_readLine(file);
|
char* line = String_readLine(file);
|
||||||
if (!line) continue;
|
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
if (!line) continue;
|
||||||
|
|
||||||
const char *isOnline = String_getToken(line, 2);
|
const char *isOnline = String_getToken(line, 2);
|
||||||
free(line);
|
free(line);
|
||||||
|
@ -26,6 +26,12 @@ in the source distribution for its full text.
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#ifdef MAJOR_IN_MKDEV
|
||||||
|
#include <sys/mkdev.h>
|
||||||
|
#elif defined(MAJOR_IN_SYSMACROS) || \
|
||||||
|
(defined(HAVE_SYS_SYSMACROS_H) && HAVE_SYS_SYSMACROS_H)
|
||||||
|
#include <sys/sysmacros.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DELAYACCT
|
#ifdef HAVE_DELAYACCT
|
||||||
#include <netlink/attr.h>
|
#include <netlink/attr.h>
|
||||||
@ -436,7 +442,7 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
if (line[5] == 'r' && strncmp(line+1, "yscr: ", 6) == 0) {
|
if (line[4] == 'r' && strncmp(line+1, "yscr: ", 6) == 0) {
|
||||||
process->io_syscr = strtoull(line+7, NULL, 10);
|
process->io_syscr = strtoull(line+7, NULL, 10);
|
||||||
} else if (strncmp(line+1, "yscw: ", 6) == 0) {
|
} else if (strncmp(line+1, "yscw: ", 6) == 0) {
|
||||||
process->io_syscw = strtoull(line+7, NULL, 10);
|
process->io_syscw = strtoull(line+7, NULL, 10);
|
||||||
|
@ -9,6 +9,11 @@ Released under the GNU GPL, see the COPYING file
|
|||||||
in the source distribution for its full text.
|
in the source distribution for its full text.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef MAJOR_IN_MKDEV
|
||||||
|
#elif defined(MAJOR_IN_SYSMACROS) || \
|
||||||
|
(defined(HAVE_SYS_SYSMACROS_H) && HAVE_SYS_SYSMACROS_H)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DELAYACCT
|
#ifdef HAVE_DELAYACCT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ static Htop_Reaction Platform_actionSetIOPriority(State* st) {
|
|||||||
void* set = Action_pickFromVector(st, ioprioPanel, 21);
|
void* set = Action_pickFromVector(st, ioprioPanel, 21);
|
||||||
if (set) {
|
if (set) {
|
||||||
IOPriority ioprio = IOPriorityPanel_getIOPriority(ioprioPanel);
|
IOPriority ioprio = IOPriorityPanel_getIOPriority(ioprioPanel);
|
||||||
bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) LinuxProcess_setIOPriority, (size_t) ioprio, NULL);
|
bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) LinuxProcess_setIOPriority, (Arg){ .i = ioprio }, NULL);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
beep();
|
beep();
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,3 @@ void ProcessList_goThroughEntries(ProcessList* super) {
|
|||||||
proc->minflt = 20;
|
proc->minflt = 20;
|
||||||
proc->majflt = 20;
|
proc->majflt = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnsupportedProcessList_scan(ProcessList* this) {
|
|
||||||
(void) this;
|
|
||||||
// stub!
|
|
||||||
}
|
|
||||||
|
@ -17,6 +17,4 @@ void ProcessList_delete(ProcessList* this);
|
|||||||
|
|
||||||
void ProcessList_goThroughEntries(ProcessList* super);
|
void ProcessList_goThroughEntries(ProcessList* super);
|
||||||
|
|
||||||
void UnsupportedProcessList_scan(ProcessList* this);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user