Make all required includes explicit

Information as seen by IWYU 0.12 + clang 9 on Linux
This commit is contained in:
Benny Baumann 2020-09-19 13:55:23 +02:00
parent 29346d0561
commit 0f5262917f
97 changed files with 666 additions and 397 deletions

View File

@ -8,28 +8,32 @@ in the source distribution for its full text.
#include "config.h" #include "config.h"
#include "Action.h" #include "Action.h"
#include <pwd.h>
#include <stdbool.h>
#include <stdlib.h>
#include "Affinity.h" #include "Affinity.h"
#include "AffinityPanel.h" #include "AffinityPanel.h"
#include "CategoriesPanel.h" #include "CategoriesPanel.h"
#include "CommandScreen.h"
#include "CRT.h" #include "CRT.h"
#include "EnvScreen.h" #include "EnvScreen.h"
#include "CommandScreen.h" #include "FunctionBar.h"
#include "IncSet.h"
#include "InfoScreen.h"
#include "ListItem.h"
#include "Macros.h"
#include "MainPanel.h" #include "MainPanel.h"
#include "OpenFilesScreen.h" #include "OpenFilesScreen.h"
#include "Process.h" #include "Process.h"
#include "ProvideCurses.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "SignalsPanel.h" #include "SignalsPanel.h"
#include "TraceScreen.h" #include "TraceScreen.h"
#include "Platform.h" #include "Vector.h"
#include "XUtils.h" #include "XUtils.h"
#include <ctype.h>
#include <math.h>
#include <pwd.h>
#include <stdlib.h>
#include <stdbool.h>
#include <sys/param.h>
#include <sys/time.h>
Object* Action_pickFromVector(State* st, Panel* list, int x, bool followProcess) { Object* Action_pickFromVector(State* st, Panel* list, int x, bool followProcess) {
Panel* panel = st->panel; Panel* panel = st->panel;

View File

@ -7,8 +7,13 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <stdbool.h>
#include <sys/types.h>
#include "Header.h" #include "Header.h"
#include "Object.h"
#include "Panel.h" #include "Panel.h"
#include "Process.h"
#include "ProcessList.h" #include "ProcessList.h"
#include "Settings.h" #include "Settings.h"
#include "UsersTable.h" #include "UsersTable.h"

View File

@ -12,8 +12,11 @@ in the source distribution for its full text.
#include <stdlib.h> #include <stdlib.h>
#include "XUtils.h"
#ifdef HAVE_LIBHWLOC #ifdef HAVE_LIBHWLOC
#include <hwloc.h> #include <hwloc.h>
#include <hwloc/bitmap.h>
#ifdef __linux__ #ifdef __linux__
#define HTOP_HWLOC_CPUBIND_FLAG HWLOC_CPUBIND_THREAD #define HTOP_HWLOC_CPUBIND_FLAG HWLOC_CPUBIND_THREAD
#else #else

View File

@ -8,6 +8,11 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h"
#include <stdbool.h>
#include "Object.h"
#include "Process.h" #include "Process.h"
#include "ProcessList.h" #include "ProcessList.h"

View File

@ -5,21 +5,30 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include "AffinityPanel.h" #include "AffinityPanel.h"
#include <assert.h> #include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "CRT.h" #include "CRT.h"
#include "FunctionBar.h"
#include "Object.h"
#include "ProvideCurses.h"
#include "RichString.h"
#include "Settings.h"
#include "Vector.h" #include "Vector.h"
#include "XUtils.h" #include "XUtils.h"
#ifdef HAVE_LIBHWLOC #ifdef HAVE_LIBHWLOC
#include <hwloc.h> #include <hwloc.h>
#include <hwloc/bitmap.h>
#endif #endif
typedef struct MaskItem_ { typedef struct MaskItem_ {
Object super; Object super;
char* text; char* text;

View File

@ -7,14 +7,17 @@ in the source distribution for its full text.
#include "AvailableColumnsPanel.h" #include "AvailableColumnsPanel.h"
#include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "ColumnsPanel.h" #include "ColumnsPanel.h"
#include "Header.h" #include "FunctionBar.h"
#include "ListItem.h"
#include "Object.h"
#include "Platform.h" #include "Platform.h"
#include "Process.h"
#include "ProvideCurses.h"
#include "XUtils.h" #include "XUtils.h"

View File

@ -6,17 +6,22 @@ in the source distribution for its full text.
*/ */
#include "AvailableMetersPanel.h" #include "AvailableMetersPanel.h"
#include "MetersPanel.h"
#include "CPUMeter.h"
#include "Header.h"
#include "ListItem.h"
#include "Platform.h"
#include "XUtils.h"
#include <assert.h> #include <assert.h>
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include "CPUMeter.h"
#include "FunctionBar.h"
#include "Header.h"
#include "ListItem.h"
#include "Meter.h"
#include "MetersPanel.h"
#include "Object.h"
#include "Platform.h"
#include "ProvideCurses.h"
#include "XUtils.h"
static void AvailableMetersPanel_delete(Object* object) { static void AvailableMetersPanel_delete(Object* object) {
Panel* super = (Panel*) object; Panel* super = (Panel*) object;

View File

@ -7,6 +7,7 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "Header.h"
#include "Panel.h" #include "Panel.h"
#include "ProcessList.h" #include "ProcessList.h"
#include "ScreenManager.h" #include "ScreenManager.h"

View File

@ -9,15 +9,12 @@ This meter written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com).
#include "BatteryMeter.h" #include "BatteryMeter.h"
#include "Battery.h"
#include "ProcessList.h"
#include "CRT.h"
#include "Platform.h"
#include "XUtils.h"
#include <math.h> #include <math.h>
#include <string.h>
#include <stdlib.h> #include "Battery.h"
#include "CRT.h"
#include "Object.h"
#include "XUtils.h"
static const int BatteryMeter_attributes[] = { static const int BatteryMeter_attributes[] = {

View File

@ -7,15 +7,18 @@ in the source distribution for its full text.
#include "CPUMeter.h" #include "CPUMeter.h"
#include "CRT.h" #include <math.h>
#include "Settings.h"
#include "Platform.h"
#include "XUtils.h"
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h>
#include "CRT.h"
#include "Object.h"
#include "Platform.h"
#include "ProcessList.h"
#include "RichString.h"
#include "Settings.h"
#include "XUtils.h"
static const int CPUMeter_attributes[] = { static const int CPUMeter_attributes[] = {
CPU_NICE, CPU_NICE,

18
CRT.c
View File

@ -5,28 +5,26 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include "CRT.h" #include "CRT.h"
#include "RichString.h"
#include "XUtils.h"
#include <stdio.h>
#include <errno.h> #include <errno.h>
#include <langinfo.h>
#include <locale.h>
#include <signal.h> #include <signal.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <locale.h>
#include <langinfo.h>
#include <unistd.h> #include <unistd.h>
#include "ProvideCurses.h"
#include "XUtils.h"
#ifdef HAVE_EXECINFO_H #ifdef HAVE_EXECINFO_H
#include <execinfo.h> #include <execinfo.h>
#endif #endif
#ifdef HAVE_SETUID_ENABLED
#include <sys/types.h>
#endif
#define ColorIndex(i,j) ((7-(i))*8+(j)) #define ColorIndex(i,j) ((7-(i))*8+(j))

6
CRT.h
View File

@ -7,10 +7,14 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "Macros.h" #include "config.h"
#include <stdbool.h> #include <stdbool.h>
#include "Macros.h"
#include "ProvideCurses.h"
typedef enum TreeStr_ { typedef enum TreeStr_ {
TREE_STR_HORZ, TREE_STR_HORZ,
TREE_STR_VERT, TREE_STR_VERT,

View File

@ -7,16 +7,22 @@ in the source distribution for its full text.
#include "CategoriesPanel.h" #include "CategoriesPanel.h"
#include "AvailableMetersPanel.h" #include <ctype.h>
#include "MetersPanel.h" #include <stdbool.h>
#include "DisplayOptionsPanel.h"
#include "ColumnsPanel.h"
#include "ColorsPanel.h"
#include "AvailableColumnsPanel.h"
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include "AvailableColumnsPanel.h"
#include "AvailableMetersPanel.h"
#include "ColorsPanel.h"
#include "ColumnsPanel.h"
#include "DisplayOptionsPanel.h"
#include "FunctionBar.h"
#include "ListItem.h"
#include "MetersPanel.h"
#include "Object.h"
#include "ProvideCurses.h"
#include "Vector.h"
static const char* const CategoriesFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL}; static const char* const CategoriesFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL};

View File

@ -7,6 +7,7 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "Header.h"
#include "Panel.h" #include "Panel.h"
#include "ProcessList.h" #include "ProcessList.h"
#include "ScreenManager.h" #include "ScreenManager.h"

View File

@ -7,11 +7,12 @@ in the source distribution for its full text.
#include "CheckItem.h" #include "CheckItem.h"
#include "CRT.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include "CRT.h"
#include "RichString.h"
static void CheckItem_delete(Object* cast) { static void CheckItem_delete(Object* cast) {
CheckItem* this = (CheckItem*)cast; CheckItem* this = (CheckItem*)cast;

View File

@ -7,6 +7,8 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <stdbool.h>
#include "Object.h" #include "Object.h"
typedef struct CheckItem_ { typedef struct CheckItem_ {

View File

@ -5,12 +5,15 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" // IWYU pragma: keep
#include "ClockMeter.h" #include "ClockMeter.h"
#include "CRT.h"
#include <time.h> #include <time.h>
#include "CRT.h"
#include "Object.h"
static const int ClockMeter_attributes[] = { static const int ClockMeter_attributes[] = {
CLOCK CLOCK

View File

@ -7,13 +7,19 @@ in the source distribution for its full text.
#include "ColorsPanel.h" #include "ColorsPanel.h"
#include "CRT.h" #include <stdbool.h>
#include <stdlib.h>
#include "CheckItem.h" #include "CheckItem.h"
#include "CRT.h"
#include "FunctionBar.h"
#include "Header.h"
#include "Object.h"
#include "ProvideCurses.h"
#include "RichString.h"
#include "Vector.h"
#include "XUtils.h" #include "XUtils.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
// TO ADD A NEW SCHEME: // TO ADD A NEW SCHEME:
// * Increment the size of bool check in ColorsPanel.h // * Increment the size of bool check in ColorsPanel.h

View File

@ -6,15 +6,18 @@ in the source distribution for its full text.
*/ */
#include "ColumnsPanel.h" #include "ColumnsPanel.h"
#include "Platform.h"
#include "XUtils.h"
#include "ListItem.h"
#include "CRT.h"
#include <assert.h>
#include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h>
#include "CRT.h"
#include "FunctionBar.h"
#include "ListItem.h"
#include "Object.h"
#include "Platform.h"
#include "Process.h"
#include "ProvideCurses.h"
#include "XUtils.h"
static const char* const ColumnsFunctions[] = {" ", " ", " ", " ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done ", NULL}; static const char* const ColumnsFunctions[] = {" ", " ", " ", " ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done ", NULL};

View File

@ -7,6 +7,8 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <stdbool.h>
#include "Panel.h" #include "Panel.h"
#include "Settings.h" #include "Settings.h"

View File

@ -1,15 +1,14 @@
#include "CommandScreen.h" #include "config.h" // IWYU pragma: keep
#include "config.h" #include "CommandScreen.h"
#include "CRT.h"
#include "IncSet.h"
#include "ListItem.h"
#include "Platform.h"
#include "XUtils.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "Macros.h"
#include "Panel.h"
#include "ProvideCurses.h"
#include "XUtils.h"
static void CommandScreen_scan(InfoScreen* this) { static void CommandScreen_scan(InfoScreen* this) {

View File

@ -2,6 +2,9 @@
#define HEADER_CommandScreen #define HEADER_CommandScreen
#include "InfoScreen.h" #include "InfoScreen.h"
#include "Object.h"
#include "Process.h"
typedef struct CommandScreen_ { typedef struct CommandScreen_ {
InfoScreen super; InfoScreen super;

View File

@ -5,12 +5,15 @@ 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.
*/ */
#include "config.h" // IWYU pragma: keep
#include "DateMeter.h" #include "DateMeter.h"
#include "CRT.h"
#include <time.h> #include <time.h>
#include "CRT.h"
#include "Object.h"
static const int DateMeter_attributes[] = { static const int DateMeter_attributes[] = {
DATE DATE

View File

@ -5,12 +5,15 @@ 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.
*/ */
#include "config.h" // IWYU pragma: keep
#include "DateTimeMeter.h" #include "DateTimeMeter.h"
#include "CRT.h"
#include <time.h> #include <time.h>
#include "CRT.h"
#include "Object.h"
static const int DateTimeMeter_attributes[] = { static const int DateTimeMeter_attributes[] = {
DATETIME DATETIME

View File

@ -7,10 +7,14 @@ in the source distribution for its full text.
#include "DiskIOMeter.h" #include "DiskIOMeter.h"
#include <math.h> #include <stdio.h>
#include <sys/time.h>
#include "CRT.h" #include "CRT.h"
#include "Macros.h"
#include "Object.h"
#include "Platform.h" #include "Platform.h"
#include "RichString.h"
#include "XUtils.h" #include "XUtils.h"

View File

@ -5,14 +5,19 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" // IWYU pragma: keep
#include "DisplayOptionsPanel.h" #include "DisplayOptionsPanel.h"
#include <assert.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "CheckItem.h" #include "CheckItem.h"
#include "CRT.h" #include "CRT.h"
#include "FunctionBar.h"
#include "Header.h"
#include "Object.h"
#include "ProvideCurses.h"
#include "XUtils.h" #include "XUtils.h"

View File

@ -1,15 +1,17 @@
#include "EnvScreen.h" #include "config.h" // IWYU pragma: keep
#include "config.h" #include "EnvScreen.h"
#include "CRT.h"
#include "IncSet.h"
#include "ListItem.h"
#include "Platform.h"
#include "XUtils.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "CRT.h"
#include "Macros.h"
#include "Panel.h"
#include "Platform.h"
#include "ProvideCurses.h"
#include "Vector.h"
#include "XUtils.h"
const InfoScreenClass EnvScreen_class = { const InfoScreenClass EnvScreen_class = {

View File

@ -2,6 +2,8 @@
#define HEADER_EnvScreen #define HEADER_EnvScreen
#include "InfoScreen.h" #include "InfoScreen.h"
#include "Object.h"
#include "Process.h"
typedef struct EnvScreen_ { typedef struct EnvScreen_ {
InfoScreen super; InfoScreen super;

View File

@ -6,13 +6,14 @@ in the source distribution for its full text.
*/ */
#include "FunctionBar.h" #include "FunctionBar.h"
#include "CRT.h"
#include "RichString.h"
#include "XUtils.h"
#include <assert.h>
#include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "CRT.h"
#include "Macros.h"
#include "ProvideCurses.h"
#include "XUtils.h"
static const char* const FunctionBar_FKeys[] = {"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", NULL}; static const char* const FunctionBar_FKeys[] = {"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", NULL};

View File

@ -9,7 +9,6 @@ in the source distribution for its full text.
#include <stdbool.h> #include <stdbool.h>
typedef struct Hashtable_ Hashtable;
typedef void(*Hashtable_PairFunction)(int, void*, void*); typedef void(*Hashtable_PairFunction)(int, void*, void*);
@ -19,12 +18,12 @@ typedef struct HashtableItem {
struct HashtableItem* next; struct HashtableItem* next;
} HashtableItem; } HashtableItem;
struct Hashtable_ { typedef struct Hashtable_ {
int size; int size;
HashtableItem** buckets; HashtableItem** buckets;
int items; int items;
bool owner; bool owner;
}; } Hashtable;
#ifndef NDEBUG #ifndef NDEBUG

View File

@ -7,14 +7,18 @@ in the source distribution for its full text.
#include "Header.h" #include "Header.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "CRT.h" #include "CRT.h"
#include "Macros.h"
#include "Object.h"
#include "Platform.h" #include "Platform.h"
#include "ProvideCurses.h"
#include "XUtils.h" #include "XUtils.h"
#include <assert.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
Header* Header_new(struct ProcessList_* pl, Settings* settings, int nrColumns) { Header* Header_new(struct ProcessList_* pl, Settings* settings, int nrColumns) {
Header* this = xCalloc(1, sizeof(Header)); Header* this = xCalloc(1, sizeof(Header));

View File

@ -8,6 +8,7 @@ in the source distribution for its full text.
*/ */
#include "Meter.h" #include "Meter.h"
#include "ProcessList.h"
#include "Settings.h" #include "Settings.h"
#include "Vector.h" #include "Vector.h"

View File

@ -5,12 +5,15 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" // IWYU pragma: keep
#include "HostnameMeter.h" #include "HostnameMeter.h"
#include "CRT.h"
#include <unistd.h> #include <unistd.h>
#include "CRT.h"
#include "Object.h"
static const int HostnameMeter_attributes[] = { static const int HostnameMeter_attributes[] = {
HOSTNAME HOSTNAME

View File

@ -5,14 +5,20 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "IncSet.h" #include "config.h" // IWYU pragma: keep
#include "ListItem.h"
#include "CRT.h"
#include "XUtils.h"
#include "IncSet.h"
#include <ctype.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "CRT.h"
#include "ListItem.h"
#include "Object.h"
#include "ProvideCurses.h"
#include "XUtils.h"
static void IncMode_reset(IncMode* mode) { static void IncMode_reset(IncMode* mode) {
mode->index = 0; mode->index = 0;

View File

@ -8,9 +8,11 @@ in the source distribution for its full text.
*/ */
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include "FunctionBar.h" #include "FunctionBar.h"
#include "Panel.h" #include "Panel.h"
#include "Vector.h"
#define INCMODE_MAX 40 #define INCMODE_MAX 40

View File

@ -1,18 +1,19 @@
#include "config.h" // IWYU pragma: keep
#include "InfoScreen.h" #include "InfoScreen.h"
#include "config.h" #include <stdarg.h>
#include "Object.h" #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "CRT.h" #include "CRT.h"
#include "IncSet.h" #include "IncSet.h"
#include "ListItem.h" #include "ListItem.h"
#include "Platform.h" #include "Object.h"
#include "ProvideCurses.h"
#include "XUtils.h" #include "XUtils.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdarg.h>
static const char* const InfoScreenFunctions[] = {"Search ", "Filter ", "Refresh", "Done ", NULL}; static const char* const InfoScreenFunctions[] = {"Search ", "Filter ", "Refresh", "Done ", NULL};

View File

@ -1,12 +1,25 @@
#ifndef HEADER_InfoScreen #ifndef HEADER_InfoScreen
#define HEADER_InfoScreen #define HEADER_InfoScreen
#include <stdbool.h>
#include "FunctionBar.h" #include "FunctionBar.h"
#include "IncSet.h" #include "IncSet.h"
#include "Macros.h"
#include "Object.h"
#include "Panel.h" #include "Panel.h"
#include "Process.h" #include "Process.h"
#include "Vector.h"
typedef struct InfoScreen_ InfoScreen;
typedef struct InfoScreen_ {
Object super;
const Process* process;
Panel* display;
FunctionBar* bar;
IncSet* inc;
Vector* lines;
} InfoScreen;
typedef void(*InfoScreen_Scan)(InfoScreen*); typedef void(*InfoScreen_Scan)(InfoScreen*);
typedef void(*InfoScreen_Draw)(InfoScreen*); typedef void(*InfoScreen_Draw)(InfoScreen*);
@ -27,15 +40,6 @@ typedef struct InfoScreenClass_ {
#define InfoScreen_onErr(this_) As_InfoScreen(this_)->onErr((InfoScreen*)(this_)) #define InfoScreen_onErr(this_) As_InfoScreen(this_)->onErr((InfoScreen*)(this_))
#define InfoScreen_onKey(this_, ch_) As_InfoScreen(this_)->onKey((InfoScreen*)(this_), ch_) #define InfoScreen_onKey(this_, ch_) As_InfoScreen(this_)->onKey((InfoScreen*)(this_), ch_)
struct InfoScreen_ {
Object super;
const Process* process;
Panel* display;
FunctionBar* bar;
IncSet* inc;
Vector* lines;
};
InfoScreen* InfoScreen_init(InfoScreen* this, const Process* process, FunctionBar* bar, int height, const char* panelHeader); InfoScreen* InfoScreen_init(InfoScreen* this, const Process* process, FunctionBar* bar, int height, const char* panelHeader);
InfoScreen* InfoScreen_done(InfoScreen* this); InfoScreen* InfoScreen_done(InfoScreen* this);

View File

@ -5,16 +5,18 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" // IWYU pragma: keep
#include "ListItem.h" #include "ListItem.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "CRT.h" #include "CRT.h"
#include "RichString.h" #include "RichString.h"
#include "XUtils.h" #include "XUtils.h"
#include <string.h>
#include <assert.h>
#include <stdlib.h>
static void ListItem_delete(Object* cast) { static void ListItem_delete(Object* cast) {
ListItem* this = (ListItem*)cast; ListItem* this = (ListItem*)cast;

View File

@ -7,6 +7,8 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <stdbool.h>
#include "Object.h" #include "Object.h"
typedef struct ListItem_ { typedef struct ListItem_ {

View File

@ -8,7 +8,9 @@ in the source distribution for its full text.
#include "LoadAverageMeter.h" #include "LoadAverageMeter.h"
#include "CRT.h" #include "CRT.h"
#include "Object.h"
#include "Platform.h" #include "Platform.h"
#include "RichString.h"
#include "XUtils.h" #include "XUtils.h"

View File

@ -1,6 +1,8 @@
#ifndef HEADER_Macros #ifndef HEADER_Macros
#define HEADER_Macros #define HEADER_Macros
#include <assert.h> // IWYU pragma: keep
#ifndef MINIMUM #ifndef MINIMUM
#define MINIMUM(a, b) ((a) < (b) ? (a) : (b)) #define MINIMUM(a, b) ((a) < (b) ? (a) : (b))
#endif #endif

View File

@ -7,12 +7,20 @@ in the source distribution for its full text.
*/ */
#include "MainPanel.h" #include "MainPanel.h"
#include "Process.h"
#include "Platform.h"
#include "CRT.h"
#include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include "CRT.h"
#include "FunctionBar.h"
#include "Platform.h"
#include "Process.h"
#include "ProcessList.h"
#include "ProvideCurses.h"
#include "Settings.h"
#include "XUtils.h"
static const char* const MainFunctions[] = {"Help ", "Setup ", "Search", "Filter", "Tree ", "SortBy", "Nice -", "Nice +", "Kill ", "Quit ", NULL}; static const char* const MainFunctions[] = {"Help ", "Setup ", "Search", "Filter", "Tree ", "SortBy", "Nice -", "Nice +", "Kill ", "Quit ", NULL};
void MainPanel_updateTreeFunctions(MainPanel* this, bool mode) { void MainPanel_updateTreeFunctions(MainPanel* this, bool mode) {

View File

@ -8,9 +8,15 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <stdbool.h>
#include <sys/types.h>
#include "Action.h" #include "Action.h"
#include "IncSet.h" #include "IncSet.h"
#include "Object.h"
#include "Panel.h" #include "Panel.h"
#include "Process.h"
typedef struct MainPanel_ { typedef struct MainPanel_ {
Panel super; Panel super;

View File

@ -103,6 +103,7 @@ myhtopheaders = \
Panel.h \ Panel.h \
Process.h \ Process.h \
ProcessList.h \ ProcessList.h \
ProvideCurses.h \
RichString.h \ RichString.h \
ScreenManager.h \ ScreenManager.h \
Settings.h \ Settings.h \

View File

@ -8,13 +8,9 @@ in the source distribution for its full text.
#include "MemoryMeter.h" #include "MemoryMeter.h"
#include "CRT.h" #include "CRT.h"
#include "Object.h"
#include "Platform.h" #include "Platform.h"
#include "RichString.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys/param.h>
#include <assert.h>
static const int MemoryMeter_attributes[] = { static const int MemoryMeter_attributes[] = {

20
Meter.c
View File

@ -5,19 +5,23 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" // IWYU pragma: keep
#include "Meter.h" #include "Meter.h"
#include "RichString.h" #include <assert.h>
#include "Object.h" #include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "CRT.h" #include "CRT.h"
#include "Settings.h" #include "Macros.h"
#include "Object.h"
#include "ProvideCurses.h"
#include "RichString.h"
#include "XUtils.h" #include "XUtils.h"
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
#define GRAPH_HEIGHT 4 /* Unit: rows (lines) */ #define GRAPH_HEIGHT 4 /* Unit: rows (lines) */

View File

@ -7,12 +7,17 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <stdbool.h>
#include <sys/time.h> #include <sys/time.h>
#include "ListItem.h" #include "ListItem.h"
#include "Object.h"
#include "ProcessList.h"
#define METER_BUFFER_LEN 256 #define METER_BUFFER_LEN 256
struct Meter_;
typedef struct Meter_ Meter; typedef struct Meter_ Meter;
typedef void(*Meter_Init)(Meter*); typedef void(*Meter_Init)(Meter*);
@ -67,7 +72,7 @@ struct Meter_ {
int param; int param;
GraphData* drawData; GraphData* drawData;
int h; int h;
struct ProcessList_* pl; ProcessList* pl;
char curItems; char curItems;
double* values; double* values;
double total; double total;
@ -91,7 +96,7 @@ typedef enum {
extern const MeterClass Meter_class; extern const MeterClass Meter_class;
Meter* Meter_new(struct ProcessList_* pl, int param, const MeterClass* type); Meter* Meter_new(ProcessList* pl, int param, const MeterClass* type);
int Meter_humanUnit(char* buffer, unsigned long int value, int size); int Meter_humanUnit(char* buffer, unsigned long int value, int size);

View File

@ -8,8 +8,14 @@ in the source distribution for its full text.
#include "MetersPanel.h" #include "MetersPanel.h"
#include <stdlib.h> #include <stdlib.h>
#include <assert.h>
#include "CRT.h" #include "CRT.h"
#include "FunctionBar.h"
#include "Header.h"
#include "ListItem.h"
#include "Meter.h"
#include "Object.h"
#include "ProvideCurses.h"
// Note: In code the meters are known to have bar/text/graph "Modes", but in UI // Note: In code the meters are known to have bar/text/graph "Modes", but in UI

View File

@ -7,10 +7,15 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <stdbool.h>
#include "Panel.h" #include "Panel.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "Settings.h" #include "Settings.h"
#include "Vector.h"
struct MetersPanel_;
typedef struct MetersPanel_ MetersPanel; typedef struct MetersPanel_ MetersPanel;
struct MetersPanel_ { struct MetersPanel_ {

View File

@ -1,7 +1,14 @@
#include "NetworkIOMeter.h" #include "NetworkIOMeter.h"
#include <stddef.h>
#include <sys/time.h>
#include "CRT.h" #include "CRT.h"
#include "Macros.h"
#include "Object.h"
#include "Platform.h" #include "Platform.h"
#include "RichString.h"
#include "XUtils.h"
static const int NetworkIOMeter_attributes[] = { static const int NetworkIOMeter_attributes[] = {

View File

@ -8,6 +8,9 @@ in the source distribution for its full text.
#include "Object.h" #include "Object.h"
#include <stddef.h>
const ObjectClass Object_class = { const ObjectClass Object_class = {
.extends = NULL .extends = NULL
}; };

View File

@ -9,10 +9,10 @@ in the source distribution for its full text.
*/ */
#include "RichString.h" #include "RichString.h"
#include "Macros.h" #include "XUtils.h" // IWYU pragma: keep
#include "XUtils.h"
struct Object_;
typedef struct Object_ Object; typedef struct Object_ Object;
typedef void(*Object_Display)(const Object*, RichString*); typedef void(*Object_Display)(const Object*, RichString*);
@ -29,7 +29,7 @@ typedef void(*Object_Delete)(Object*);
#define Class(class_) ((const ObjectClass*)(&(class_ ## _class))) #define Class(class_) ((const ObjectClass*)(&(class_ ## _class)))
#define AllocThis(class_) (class_*) xMalloc(sizeof(class_)); Object_setClass(this, Class(class_)); #define AllocThis(class_) (class_*) xMalloc(sizeof(class_)); Object_setClass(this, Class(class_));
typedef struct ObjectClass_ { typedef struct ObjectClass_ {
const void* const extends; const void* const extends;

View File

@ -5,24 +5,24 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" // IWYU pragma: keep
#include "OpenFilesScreen.h" #include "OpenFilesScreen.h"
#include "CRT.h"
#include "ProcessList.h"
#include "IncSet.h"
#include "FunctionBar.h"
#include "XUtils.h"
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <stdbool.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include "Macros.h"
#include "Panel.h"
#include "ProvideCurses.h"
#include "Vector.h"
#include "XUtils.h"
typedef struct OpenFiles_Data_ { typedef struct OpenFiles_Data_ {
char* data[7]; char* data[7];

View File

@ -7,7 +7,11 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <sys/types.h>
#include "InfoScreen.h" #include "InfoScreen.h"
#include "Object.h"
#include "Process.h"
typedef struct OpenFilesScreen_ { typedef struct OpenFilesScreen_ {
InfoScreen super; InfoScreen super;

19
Panel.c
View File

@ -7,17 +7,20 @@ in the source distribution for its full text.
#include "Panel.h" #include "Panel.h"
#include "CRT.h" #include <assert.h>
#include "RichString.h" #include <ctype.h>
#include "ListItem.h"
#include "XUtils.h"
#include <math.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <strings.h>
#include "CRT.h"
#include "ListItem.h"
#include "Macros.h"
#include "ProvideCurses.h"
#include "RichString.h"
#include "XUtils.h"
const PanelClass Panel_class = { const PanelClass Panel_class = {
.super = { .super = {

View File

@ -7,10 +7,15 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <stdbool.h>
#include "FunctionBar.h" #include "FunctionBar.h"
#include "Object.h" #include "Object.h"
#include "RichString.h"
#include "Vector.h" #include "Vector.h"
struct Panel_;
typedef struct Panel_ Panel; typedef struct Panel_ Panel;
typedef enum HandlerResult_ { typedef enum HandlerResult_ {

View File

@ -6,36 +6,35 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "Process.h" #include "config.h" // IWYU pragma: keep
#include "Settings.h"
#include "config.h" #include "Process.h"
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/resource.h>
#include "CRT.h" #include "CRT.h"
#include "RichString.h"
#include "Platform.h" #include "Platform.h"
#include "RichString.h"
#include "Settings.h"
#include "XUtils.h" #include "XUtils.h"
#include <stdio.h> #if defined(MAJOR_IN_MKDEV)
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <stdbool.h>
#include <pwd.h>
#include <time.h>
#include <assert.h>
#include <math.h>
#ifdef MAJOR_IN_MKDEV
#include <sys/mkdev.h> #include <sys/mkdev.h>
#elif defined(MAJOR_IN_SYSMACROS) #elif defined(MAJOR_IN_SYSMACROS)
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#endif #endif
static int Process_getuid = -1; static int Process_getuid = -1;
char Process_pidFormat[20] = "%7d "; char Process_pidFormat[20] = "%7d ";

View File

@ -8,6 +8,14 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <stdbool.h>
#include <unistd.h>
#include <sys/types.h>
#include "Object.h"
#include "RichString.h"
#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
@ -20,10 +28,6 @@ in the source distribution for its full text.
#endif #endif
#define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K ) #define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K )
#include <sys/types.h>
#include "Object.h"
#define PROCESS_FLAG_IO 0x0001 #define PROCESS_FLAG_IO 0x0001
typedef enum ProcessFields { typedef enum ProcessFields {

View File

@ -7,13 +7,12 @@ in the source distribution for its full text.
#include "ProcessList.h" #include "ProcessList.h"
#include "CRT.h" #include <assert.h>
#include "Platform.h"
#include "XUtils.h"
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "CRT.h"
#include "XUtils.h"
ProcessList* ProcessList_init(ProcessList* this, const ObjectClass* klass, UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) { ProcessList* ProcessList_init(ProcessList* this, const ObjectClass* klass, UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
this->processes = Vector_new(klass, true, DEFAULT_SIZE); this->processes = Vector_new(klass, true, DEFAULT_SIZE);

View File

@ -7,9 +7,16 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" // IWYU pragma: keep
#include <stdbool.h>
#include <sys/types.h>
#include "Hashtable.h" #include "Hashtable.h"
#include "Object.h"
#include "Panel.h" #include "Panel.h"
#include "Process.h" #include "Process.h"
#include "RichString.h"
#include "Settings.h" #include "Settings.h"
#include "UsersTable.h" #include "UsersTable.h"
#include "Vector.h" #include "Vector.h"
@ -18,6 +25,7 @@ in the source distribution for its full text.
#include <hwloc.h> #include <hwloc.h>
#endif #endif
#ifndef MAX_NAME #ifndef MAX_NAME
#define MAX_NAME 128 #define MAX_NAME 128
#endif #endif

34
ProvideCurses.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef HEADER_ProvideCurses
#define HEADER_ProvideCurses
/*
htop - RichString.h
(C) 2004,2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "config.h"
// IWYU pragma: begin_exports
#ifdef HAVE_NCURSESW_CURSES_H
#include <ncursesw/curses.h>
#elif defined(HAVE_NCURSES_NCURSES_H)
#include <ncurses/ncurses.h>
#elif defined(HAVE_NCURSES_CURSES_H)
#include <ncurses/curses.h>
#elif defined(HAVE_NCURSES_H)
#include <ncurses.h>
#elif defined(HAVE_CURSES_H)
#include <curses.h>
#endif
#ifdef HAVE_LIBNCURSESW
#include <wchar.h>
#include <wctype.h>
#endif
// IWYU pragma: end_exports
#endif // HEADER_ProvideCurses

View File

@ -6,12 +6,14 @@ in the source distribution for its full text.
*/ */
#include "RichString.h" #include "RichString.h"
#include "Macros.h"
#include "XUtils.h"
#include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "Macros.h"
#include "XUtils.h"
#define charBytes(n) (sizeof(CharType) * (n)) #define charBytes(n) (sizeof(CharType) * (n))

View File

@ -7,26 +7,10 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" #include "config.h"
#include <ctype.h>
#include <assert.h> #include "ProvideCurses.h"
#ifdef HAVE_NCURSESW_CURSES_H
#include <ncursesw/curses.h>
#elif defined(HAVE_NCURSES_NCURSES_H)
#include <ncurses/ncurses.h>
#elif defined(HAVE_NCURSES_CURSES_H)
#include <ncurses/curses.h>
#elif defined(HAVE_NCURSES_H)
#include <ncurses.h>
#elif defined(HAVE_CURSES_H)
#include <curses.h>
#endif
#ifdef HAVE_LIBNCURSESW
#include <wctype.h>
#endif
#define RichString_size(this) ((this)->chlen) #define RichString_size(this) ((this)->chlen)
#define RichString_sizeVal(this) ((this).chlen) #define RichString_sizeVal(this) ((this).chlen)

View File

@ -7,16 +7,17 @@ in the source distribution for its full text.
#include "ScreenManager.h" #include "ScreenManager.h"
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/time.h>
#include "CRT.h" #include "CRT.h"
#include "MainPanel.h" #include "FunctionBar.h"
#include "Object.h" #include "Object.h"
#include "ProcessList.h" #include "ProcessList.h"
#include "ProvideCurses.h"
#include "XUtils.h"
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <stdbool.h>
ScreenManager* ScreenManager_new(int x1, int y1, int x2, int y2, Orientation orientation, Header* header, const Settings* settings, const State* state, bool owner) { ScreenManager* ScreenManager_new(int x1, int y1, int x2, int y2, Orientation orientation, Header* header, const Settings* settings, const State* state, bool owner) {

View File

@ -7,12 +7,15 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <stdbool.h>
#include "Action.h" #include "Action.h"
#include "Header.h" #include "Header.h"
#include "Panel.h" #include "Panel.h"
#include "Settings.h" #include "Settings.h"
#include "Vector.h" #include "Vector.h"
typedef enum Orientation_ { typedef enum Orientation_ {
VERTICAL, VERTICAL,
HORIZONTAL HORIZONTAL

View File

@ -7,15 +7,17 @@ in the source distribution for its full text.
#include "Settings.h" #include "Settings.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include "CRT.h" #include "CRT.h"
#include "Macros.h"
#include "Meter.h"
#include "Platform.h" #include "Platform.h"
#include "Vector.h"
#include "XUtils.h" #include "XUtils.h"
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
void Settings_delete(Settings* this) { void Settings_delete(Settings* this) {
free(this->filename); free(this->filename);

View File

@ -7,12 +7,15 @@ Released under the GNU GPLv2, 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 "config.h" // IWYU pragma: keep
#include <stdbool.h> #include <stdbool.h>
#include "Process.h" #include "Process.h"
#define DEFAULT_DELAY 15
typedef struct { typedef struct {
int len; int len;
char** names; char** names;

View File

@ -5,17 +5,16 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "Panel.h"
#include "SignalsPanel.h" #include "SignalsPanel.h"
#include <assert.h>
#include <ctype.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdbool.h>
#include "FunctionBar.h"
#include "ListItem.h" #include "ListItem.h"
#include "Object.h"
#include "Panel.h"
#include "Platform.h" #include "Platform.h"
#include "RichString.h"
#include "XUtils.h" #include "XUtils.h"

View File

@ -7,6 +7,8 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "Panel.h"
typedef struct SignalItem_ { typedef struct SignalItem_ {
const char* name; const char* name;
int number; int number;

View File

@ -8,13 +8,9 @@ in the source distribution for its full text.
#include "SwapMeter.h" #include "SwapMeter.h"
#include "CRT.h" #include "CRT.h"
#include "Object.h"
#include "Platform.h" #include "Platform.h"
#include "RichString.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys/param.h>
#include <assert.h>
static const int SwapMeter_attributes[] = { static const int SwapMeter_attributes[] = {

View File

@ -8,7 +8,11 @@ in the source distribution for its full text.
#include "TasksMeter.h" #include "TasksMeter.h"
#include "CRT.h" #include "CRT.h"
#include "Platform.h" #include "Macros.h"
#include "Object.h"
#include "ProcessList.h"
#include "RichString.h"
#include "Settings.h"
#include "XUtils.h" #include "XUtils.h"

View File

@ -5,26 +5,28 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" // IWYU pragma: keep
#include "TraceScreen.h" #include "TraceScreen.h"
#include "CRT.h" #include <assert.h>
#include "ProcessList.h"
#include "ListItem.h"
#include "IncSet.h"
#include "FunctionBar.h"
#include "XUtils.h"
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h> #include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/wait.h>
#include "CRT.h"
#include "FunctionBar.h"
#include "IncSet.h"
#include "Panel.h"
#include "ProvideCurses.h"
#include "XUtils.h"
static const char* const TraceScreenFunctions[] = {"Search ", "Filter ", "AutoScroll ", "Stop Tracing ", "Done ", NULL}; static const char* const TraceScreenFunctions[] = {"Search ", "Filter ", "AutoScroll ", "Stop Tracing ", "Done ", NULL};

View File

@ -12,6 +12,8 @@ in the source distribution for its full text.
#include <sys/types.h> #include <sys/types.h>
#include "InfoScreen.h" #include "InfoScreen.h"
#include "Object.h"
#include "Process.h"
typedef struct TraceScreen_ { typedef struct TraceScreen_ {

View File

@ -8,6 +8,7 @@ in the source distribution for its full text.
#include "UptimeMeter.h" #include "UptimeMeter.h"
#include "CRT.h" #include "CRT.h"
#include "Object.h"
#include "Platform.h" #include "Platform.h"
#include "XUtils.h" #include "XUtils.h"

View File

@ -5,17 +5,12 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h"
#include "UsersTable.h" #include "UsersTable.h"
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <pwd.h> #include <pwd.h>
#include <sys/types.h> #include <stdbool.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h>
#include "XUtils.h" #include "XUtils.h"

View File

@ -10,7 +10,8 @@ in the source distribution for its full text.
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdbool.h>
#include "XUtils.h"
Vector* Vector_new(const ObjectClass* type, bool owner, int size) { Vector* Vector_new(const ObjectClass* type, bool owner, int size) {

View File

@ -9,6 +9,8 @@ in the source distribution for its full text.
#include "Object.h" #include "Object.h"
#include <stdbool.h>
#ifndef DEFAULT_SIZE #ifndef DEFAULT_SIZE
#define DEFAULT_SIZE (-1) #define DEFAULT_SIZE (-1)

View File

@ -5,14 +5,13 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include "XUtils.h" #include "XUtils.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include <unistd.h> #include <unistd.h>
#include "CRT.h" #include "CRT.h"

View File

@ -7,10 +7,11 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <assert.h> #include "config.h" // IWYU pragma: keep
#include <err.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h> // IWYU pragma: keep
#include <string.h> // IWYU pragma: keep
#include "Macros.h" #include "Macros.h"

View File

@ -7,6 +7,14 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <stdbool.h>
#include "Object.h"
#include "Process.h"
#include "RichString.h"
#include "Settings.h"
typedef enum FreeBSDProcessFields_ { typedef enum FreeBSDProcessFields_ {
// Add platform-specific fields here, with ids >= 100 // Add platform-specific fields here, with ids >= 100
JID = 100, JID = 100,

View File

@ -5,24 +5,27 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "Macros.h"
#include "ProcessList.h"
#include "FreeBSDProcessList.h" #include "FreeBSDProcessList.h"
#include "FreeBSDProcess.h"
#include "zfs/ZfsArcStats.h"
#include "zfs/openzfs_sysctl.h"
#include "Macros.h"
#include <unistd.h> #include <assert.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/user.h>
#include <err.h> #include <err.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/user.h>
#include "FreeBSDProcess.h"
#include "Macros.h"
#include "ProcessList.h"
#include "zfs/ZfsArcStats.h"
#include "zfs/openzfs_sysctl.h"
#include "XUtils.h"
char jail_errmsg[JAIL_ERRMSGLEN]; char jail_errmsg[JAIL_ERRMSGLEN];

View File

@ -7,14 +7,20 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "zfs/ZfsArcStats.h"
#include <kvm.h> #include <kvm.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/jail.h> #include <sys/jail.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <sys/resource.h> #include <sys/resource.h>
#include "FreeBSDProcess.h"
#include "Hashtable.h"
#include "Process.h"
#include "ProcessList.h"
#include "UsersTable.h"
#include "zfs/ZfsArcStats.h"
#define JAIL_ERRMSGLEN 1024 #define JAIL_ERRMSGLEN 1024
extern char jail_errmsg[JAIL_ERRMSGLEN]; extern char jail_errmsg[JAIL_ERRMSGLEN];

36
htop.c
View File

@ -5,29 +5,37 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" #include "config.h" // IWYU pragma: keep
#include "FunctionBar.h"
#include "Hashtable.h"
#include "ColumnsPanel.h"
#include "CRT.h"
#include "MainPanel.h"
#include "MetersPanel.h"
#include "ProcessList.h"
#include "ScreenManager.h"
#include "Settings.h"
#include "UsersTable.h"
#include "Platform.h"
#include "XUtils.h"
#include <assert.h>
#include <getopt.h> #include <getopt.h>
#include <locale.h> #include <locale.h>
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "Action.h"
#include "ColumnsPanel.h"
#include "CRT.h"
#include "Hashtable.h"
#include "Header.h"
#include "IncSet.h"
#include "MainPanel.h"
#include "MetersPanel.h"
#include "Panel.h"
#include "Platform.h"
#include "Process.h"
#include "ProcessList.h"
#include "ProvideCurses.h"
#include "ScreenManager.h"
#include "Settings.h"
#include "UsersTable.h"
#include "XUtils.h"
//#link m //#link m
static void printVersionFlag(void) { static void printVersionFlag(void) {

View File

@ -13,13 +13,17 @@ Linux battery readings written by Ian P. Hands (iphands@gmail.com, ihands@redhat
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <fcntl.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <fcntl.h>
#include <time.h> #include <time.h>
#include <math.h> #include <unistd.h>
#include "BatteryMeter.h"
#include "Macros.h"
#include "XUtils.h" #include "XUtils.h"

View File

@ -11,6 +11,7 @@ Linux battery readings written by Ian P. Hands (iphands@gmail.com, ihands@redhat
#include "BatteryMeter.h" #include "BatteryMeter.h"
void Battery_getData(double* level, ACPresence* isOnAC); void Battery_getData(double* level, ACPresence* isOnAC);
#endif #endif

View File

@ -7,6 +7,12 @@ in the source distribution for its full text.
#include "IOPriorityPanel.h" #include "IOPriorityPanel.h"
#include <stdbool.h>
#include <stddef.h>
#include "FunctionBar.h"
#include "ListItem.h"
#include "Object.h"
#include "XUtils.h" #include "XUtils.h"

View File

@ -9,7 +9,6 @@ in the source distribution for its full text.
#include "Panel.h" #include "Panel.h"
#include "IOPriority.h" #include "IOPriority.h"
#include "ListItem.h"
Panel* IOPriorityPanel_new(IOPriority currPrio); Panel* IOPriorityPanel_new(IOPriority currPrio);

View File

@ -6,19 +6,19 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "Process.h"
#include "ProcessList.h"
#include "LinuxProcess.h" #include "LinuxProcess.h"
#include "CRT.h"
#include "Platform.h"
#include "XUtils.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/syscall.h>
#include <time.h>
#include <math.h> #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syscall.h>
#include <unistd.h>
#include "CRT.h"
#include "Process.h"
#include "ProvideCurses.h"
#include "XUtils.h"
/* semi-global */ /* semi-global */

View File

@ -8,6 +8,17 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h"
#include <stdbool.h>
#include <sys/types.h>
#include "IOPriority.h"
#include "Object.h"
#include "Process.h"
#include "RichString.h"
#include "Settings.h"
#define PROCESS_FLAG_LINUX_IOPRIO 0x0100 #define PROCESS_FLAG_LINUX_IOPRIO 0x0100
#define PROCESS_FLAG_LINUX_OPENVZ 0x0200 #define PROCESS_FLAG_LINUX_OPENVZ 0x0200
#define PROCESS_FLAG_LINUX_VSERVER 0x0400 #define PROCESS_FLAG_LINUX_VSERVER 0x0400
@ -87,8 +98,6 @@ typedef enum LinuxProcessFields {
LAST_PROCESSFIELD = 124, LAST_PROCESSFIELD = 124,
} LinuxProcessField; } LinuxProcessField;
#include "IOPriority.h"
typedef struct LinuxProcess_ { typedef struct LinuxProcess_ {
Process super; Process super;
bool isKernelThread; bool isKernelThread;

View File

@ -5,43 +5,51 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" // IWYU pragma: keep
#include "LinuxProcessList.h" #include "LinuxProcessList.h"
#include "LinuxProcess.h"
#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#ifdef HAVE_DELAYACCT
#include <linux/netlink.h>
#include <linux/taskstats.h>
#include <netlink/attr.h>
#include <netlink/handlers.h>
#include <netlink/msg.h>
#include <netlink/netlink.h>
#include <netlink/socket.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/ctrl.h>
#endif
#include "CRT.h" #include "CRT.h"
#include "LinuxProcess.h"
#include "Macros.h"
#include "Object.h"
#include "Process.h"
#include "Settings.h"
#include "XUtils.h" #include "XUtils.h"
#include <errno.h>
#include <sys/time.h>
#include <sys/utsname.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <stdbool.h>
#include <stdarg.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <assert.h>
#include <sys/types.h>
#include <fcntl.h>
#ifdef MAJOR_IN_MKDEV #ifdef MAJOR_IN_MKDEV
#include <sys/mkdev.h> #include <sys/mkdev.h>
#elif defined(MAJOR_IN_SYSMACROS) #elif defined(MAJOR_IN_SYSMACROS)
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#endif #endif
#ifdef HAVE_DELAYACCT
#include <netlink/attr.h>
#include <netlink/netlink.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/ctrl.h>
#include <netlink/socket.h>
#include <netlink/msg.h>
#include <linux/taskstats.h>
#endif
static ssize_t xread(int fd, void *buf, size_t count) { static ssize_t xread(int fd, void *buf, size_t count) {
// Read some bytes. Retry on EINTR and when we don't get as many bytes as we requested. // Read some bytes. Retry on EINTR and when we don't get as many bytes as we requested.

View File

@ -7,7 +7,14 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h"
#include <stdbool.h>
#include <sys/types.h>
#include "Hashtable.h"
#include "ProcessList.h" #include "ProcessList.h"
#include "UsersTable.h"
#include "zfs/ZfsArcStats.h" #include "zfs/ZfsArcStats.h"
typedef struct CPUData_ { typedef struct CPUData_ {

View File

@ -5,39 +5,48 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h"
#include "Platform.h" #include "Platform.h"
#include <assert.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "BatteryMeter.h"
#include "ClockMeter.h"
#include "CPUMeter.h"
#include "DateMeter.h"
#include "DateTimeMeter.h"
#include "DiskIOMeter.h"
#include "HostnameMeter.h"
#include "IOPriority.h" #include "IOPriority.h"
#include "IOPriorityPanel.h" #include "IOPriorityPanel.h"
#include "LinuxProcess.h" #include "LinuxProcess.h"
#include "LinuxProcessList.h" #include "LinuxProcessList.h"
#include "Battery.h" #include "LoadAverageMeter.h"
#include "Macros.h"
#include "MainPanel.h"
#include "Meter.h" #include "Meter.h"
#include "CPUMeter.h"
#include "DiskIOMeter.h"
#include "MemoryMeter.h" #include "MemoryMeter.h"
#include "NetworkIOMeter.h"
#include "Object.h"
#include "Panel.h"
#include "PressureStallMeter.h"
#include "ProcessList.h"
#include "ProvideCurses.h"
#include "SELinuxMeter.h"
#include "Settings.h"
#include "SwapMeter.h" #include "SwapMeter.h"
#include "TasksMeter.h" #include "TasksMeter.h"
#include "LoadAverageMeter.h"
#include "UptimeMeter.h" #include "UptimeMeter.h"
#include "PressureStallMeter.h"
#include "ClockMeter.h"
#include "DateMeter.h"
#include "DateTimeMeter.h"
#include "HostnameMeter.h"
#include "NetworkIOMeter.h"
#include "zfs/ZfsArcMeter.h"
#include "zfs/ZfsCompressedArcMeter.h"
#include "LinuxProcess.h"
#include "SELinuxMeter.h"
#include "XUtils.h" #include "XUtils.h"
#include <math.h> #include "zfs/ZfsArcMeter.h"
#include <assert.h> #include "zfs/ZfsArcStats.h"
#include <limits.h> #include "zfs/ZfsCompressedArcMeter.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, (int)M_SHARE, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 }; ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, (int)M_SHARE, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };

View File

@ -7,10 +7,12 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include <stdbool.h>
#include <sys/types.h>
#include "Action.h" #include "Action.h"
#include "MainPanel.h" #include "Meter.h"
#include "BatteryMeter.h" #include "Process.h"
#include "LinuxProcess.h"
#include "SignalsPanel.h" #include "SignalsPanel.h"
extern ProcessField Platform_defaultFields[]; extern ProcessField Platform_defaultFields[];

View File

@ -8,10 +8,14 @@ in the source distribution for its full text.
#include "PressureStallMeter.h" #include "PressureStallMeter.h"
#include <stdbool.h>
#include <string.h> #include <string.h>
#include "CRT.h" #include "CRT.h"
#include "Meter.h"
#include "Object.h"
#include "Platform.h" #include "Platform.h"
#include "RichString.h"
#include "XUtils.h" #include "XUtils.h"

View File

@ -10,12 +10,16 @@ in the source distribution for its full text.
#include "CRT.h" #include "CRT.h"
#include <fcntl.h> #include <fcntl.h>
#include <linux/magic.h> #include <stdbool.h>
#include <sys/stat.h> #include <stdio.h>
#include <sys/statvfs.h>
#include <sys/types.h>
#include <sys/vfs.h>
#include <unistd.h> #include <unistd.h>
#include <linux/magic.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
#include "Macros.h"
#include "Object.h"
#include "XUtils.h"
static const int SELinuxMeter_attributes[] = { static const int SELinuxMeter_attributes[] = {

View File

@ -9,19 +9,10 @@ in the source distribution for its full text.
#include "ZfsArcStats.h" #include "ZfsArcStats.h"
#include "CRT.h" #include "CRT.h"
#include "Object.h"
#include "Platform.h" #include "Platform.h"
#include "RichString.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys/param.h>
#include <assert.h>
/*{
#include "ZfsArcStats.h"
#include "Meter.h"
}*/
static const int ZfsArcMeter_attributes[] = { static const int ZfsArcMeter_attributes[] = {
ZFS_MFU, ZFS_MRU, ZFS_ANON, ZFS_HEADER, ZFS_OTHER ZFS_MFU, ZFS_MRU, ZFS_ANON, ZFS_HEADER, ZFS_OTHER

View File

@ -6,23 +6,16 @@ in the source distribution for its full text.
*/ */
#include "ZfsCompressedArcMeter.h" #include "ZfsCompressedArcMeter.h"
#include "ZfsArcStats.h"
#include "CRT.h" #include "CRT.h"
#include "Meter.h"
#include "Object.h"
#include "Platform.h" #include "Platform.h"
#include "RichString.h"
#include "XUtils.h" #include "XUtils.h"
#include <stdlib.h> #include "zfs/ZfsArcStats.h"
#include <string.h>
#include <math.h>
#include <sys/param.h>
#include <assert.h>
/*{
#include "ZfsArcStats.h"
#include "Meter.h"
}*/
static const int ZfsCompressedArcMeter_attributes[] = { static const int ZfsCompressedArcMeter_attributes[] = {
ZFS_COMPRESSED ZFS_COMPRESSED