2006-03-04 18:16:49 +00:00
|
|
|
/*
|
|
|
|
htop - CRT.c
|
2011-05-26 16:35:07 +00:00
|
|
|
(C) 2004-2011 Hisham H. Muhammad
|
2021-09-22 09:33:00 +00:00
|
|
|
Released under the GNU GPLv2+, see the COPYING file
|
2006-03-04 18:16:49 +00:00
|
|
|
in the source distribution for its full text.
|
|
|
|
*/
|
|
|
|
|
2020-09-19 11:55:23 +00:00
|
|
|
#include "config.h" // IWYU pragma: keep
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-09-19 11:55:23 +00:00
|
|
|
#include "CRT.h"
|
2011-12-26 21:35:57 +00:00
|
|
|
|
2012-10-19 18:59:48 +00:00
|
|
|
#include <errno.h>
|
2021-08-24 15:27:43 +00:00
|
|
|
#include <fcntl.h>
|
2020-09-19 11:55:23 +00:00
|
|
|
#include <langinfo.h>
|
2006-03-04 18:16:49 +00:00
|
|
|
#include <signal.h>
|
2021-12-08 12:01:40 +00:00
|
|
|
#include <stdarg.h>
|
2020-09-19 11:55:23 +00:00
|
|
|
#include <stdio.h>
|
2006-03-04 18:16:49 +00:00
|
|
|
#include <stdlib.h>
|
2012-10-19 18:59:48 +00:00
|
|
|
#include <string.h>
|
2017-07-26 18:40:55 +00:00
|
|
|
#include <unistd.h>
|
2020-10-03 15:53:15 +00:00
|
|
|
|
2020-09-19 11:55:23 +00:00
|
|
|
#include "ProvideCurses.h"
|
|
|
|
#include "XUtils.h"
|
|
|
|
|
2020-12-25 10:03:15 +00:00
|
|
|
#if !defined(NDEBUG) && defined(HAVE_MEMFD_CREATE)
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#endif
|
|
|
|
|
2021-05-16 18:45:09 +00:00
|
|
|
#if defined(HAVE_LIBUNWIND_H) && defined(HAVE_LIBUNWIND)
|
|
|
|
# define PRINT_BACKTRACE
|
|
|
|
# define UNW_LOCAL_ONLY
|
|
|
|
# include <libunwind.h>
|
|
|
|
# if defined(HAVE_DLADDR)
|
|
|
|
# include <dlfcn.h>
|
|
|
|
# endif
|
|
|
|
#elif defined(HAVE_EXECINFO_H)
|
|
|
|
# define PRINT_BACKTRACE
|
|
|
|
# include <execinfo.h>
|
|
|
|
#endif
|
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-10-05 15:24:59 +00:00
|
|
|
#define ColorIndex(i,j) ((7-(i))*8+(j))
|
2017-05-23 17:02:34 +00:00
|
|
|
|
|
|
|
#define ColorPair(i,j) COLOR_PAIR(ColorIndex(i,j))
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-10-05 15:24:59 +00:00
|
|
|
#define Black COLOR_BLACK
|
|
|
|
#define Red COLOR_RED
|
|
|
|
#define Green COLOR_GREEN
|
|
|
|
#define Yellow COLOR_YELLOW
|
|
|
|
#define Blue COLOR_BLUE
|
2006-03-04 18:16:49 +00:00
|
|
|
#define Magenta COLOR_MAGENTA
|
2020-10-05 15:24:59 +00:00
|
|
|
#define Cyan COLOR_CYAN
|
|
|
|
#define White COLOR_WHITE
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-10-05 15:24:59 +00:00
|
|
|
#define ColorPairGrayBlack ColorPair(Magenta,Magenta)
|
2018-02-05 06:01:12 +00:00
|
|
|
#define ColorIndexGrayBlack ColorIndex(Magenta,Magenta)
|
2017-05-23 17:02:34 +00:00
|
|
|
|
2021-01-11 11:54:19 +00:00
|
|
|
#define ColorPairWhiteDefault ColorPair(Red, Red)
|
|
|
|
#define ColorIndexWhiteDefault ColorIndex(Red, Red)
|
|
|
|
|
2020-12-14 14:45:48 +00:00
|
|
|
static const char* const CRT_treeStrAscii[LAST_TREE_STR] = {
|
|
|
|
[TREE_STR_VERT] = "|",
|
|
|
|
[TREE_STR_RTEE] = "`",
|
|
|
|
[TREE_STR_BEND] = "`",
|
|
|
|
[TREE_STR_TEND] = ",",
|
|
|
|
[TREE_STR_OPEN] = "+",
|
|
|
|
[TREE_STR_SHUT] = "-",
|
2020-12-28 19:41:33 +00:00
|
|
|
[TREE_STR_ASC] = "+",
|
|
|
|
[TREE_STR_DESC] = "-",
|
2015-01-22 01:27:31 +00:00
|
|
|
};
|
|
|
|
|
2015-07-17 12:33:34 +00:00
|
|
|
#ifdef HAVE_LIBNCURSESW
|
|
|
|
|
2020-12-14 14:45:48 +00:00
|
|
|
static const char* const CRT_treeStrUtf8[LAST_TREE_STR] = {
|
|
|
|
[TREE_STR_VERT] = "\xe2\x94\x82", // │
|
|
|
|
[TREE_STR_RTEE] = "\xe2\x94\x9c", // ├
|
|
|
|
[TREE_STR_BEND] = "\xe2\x94\x94", // └
|
|
|
|
[TREE_STR_TEND] = "\xe2\x94\x8c", // ┌
|
|
|
|
[TREE_STR_OPEN] = "+", // +, TODO use 🮯 'BOX DRAWINGS LIGHT HORIZONTAL
|
|
|
|
// WITH VERTICAL STROKE' (U+1FBAF, "\xf0\x9f\xae\xaf") when
|
|
|
|
// Unicode 13 is common
|
|
|
|
[TREE_STR_SHUT] = "\xe2\x94\x80", // ─
|
2020-12-28 19:41:33 +00:00
|
|
|
[TREE_STR_ASC] = "\xe2\x96\xb3", // △
|
|
|
|
[TREE_STR_DESC] = "\xe2\x96\xbd", // ▽
|
2015-01-22 01:27:31 +00:00
|
|
|
};
|
|
|
|
|
2020-08-31 20:08:35 +00:00
|
|
|
bool CRT_utf8 = false;
|
2015-07-17 12:33:34 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2020-10-31 22:28:02 +00:00
|
|
|
const char* const* CRT_treeStr = CRT_treeStrAscii;
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2021-05-16 17:55:31 +00:00
|
|
|
static const Settings* CRT_crashSettings;
|
2020-11-21 20:40:08 +00:00
|
|
|
static const int* CRT_delay;
|
2011-12-26 21:35:57 +00:00
|
|
|
|
2020-09-10 17:56:33 +00:00
|
|
|
const char* CRT_degreeSign;
|
|
|
|
|
|
|
|
static const char* initDegreeSign(void) {
|
|
|
|
#ifdef HAVE_LIBNCURSESW
|
|
|
|
if (CRT_utf8)
|
|
|
|
return "\xc2\xb0";
|
|
|
|
|
|
|
|
static char buffer[4];
|
|
|
|
// this might fail if the current locale does not support wide characters
|
|
|
|
int r = snprintf(buffer, sizeof(buffer), "%lc", 176);
|
|
|
|
if (r > 0)
|
|
|
|
return buffer;
|
2020-12-04 15:09:44 +00:00
|
|
|
#endif
|
2020-09-10 17:56:33 +00:00
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2020-10-05 15:24:59 +00:00
|
|
|
const int* CRT_colors;
|
2015-02-03 21:30:05 +00:00
|
|
|
|
2020-12-14 14:45:48 +00:00
|
|
|
static int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
|
2015-02-03 21:30:05 +00:00
|
|
|
[COLORSCHEME_DEFAULT] = {
|
2020-10-31 22:28:02 +00:00
|
|
|
[RESET_COLOR] = ColorPair(White, Black),
|
|
|
|
[DEFAULT_COLOR] = ColorPair(White, Black),
|
|
|
|
[FUNCTION_BAR] = ColorPair(Black, Cyan),
|
|
|
|
[FUNCTION_KEY] = ColorPair(White, Black),
|
|
|
|
[PANEL_HEADER_FOCUS] = ColorPair(Black, Green),
|
|
|
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black, Green),
|
|
|
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black, Cyan),
|
|
|
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black, Yellow),
|
|
|
|
[PANEL_SELECTION_UNFOCUS] = ColorPair(Black, White),
|
|
|
|
[FAILED_SEARCH] = ColorPair(Red, Cyan),
|
2020-10-17 10:54:45 +00:00
|
|
|
[FAILED_READ] = A_BOLD | ColorPair(Red, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PAUSED] = A_BOLD | ColorPair(Yellow, Cyan),
|
|
|
|
[UPTIME] = A_BOLD | ColorPair(Cyan, Black),
|
|
|
|
[BATTERY] = A_BOLD | ColorPair(Cyan, Black),
|
|
|
|
[LARGE_NUMBER] = A_BOLD | ColorPair(Red, Black),
|
2021-03-28 16:18:56 +00:00
|
|
|
[METER_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2020-10-31 22:28:02 +00:00
|
|
|
[METER_TEXT] = ColorPair(Cyan, Black),
|
|
|
|
[METER_VALUE] = A_BOLD | ColorPair(Cyan, Black),
|
|
|
|
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red, Black),
|
|
|
|
[METER_VALUE_IOREAD] = ColorPair(Green, Black),
|
|
|
|
[METER_VALUE_IOWRITE] = ColorPair(Blue, Black),
|
2020-11-15 16:42:16 +00:00
|
|
|
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(White, Black),
|
|
|
|
[METER_VALUE_OK] = ColorPair(Green, Black),
|
2020-12-23 19:54:03 +00:00
|
|
|
[METER_VALUE_WARN] = A_BOLD | ColorPair(Yellow, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[LED_COLOR] = ColorPair(Green, Black),
|
|
|
|
[TASKS_RUNNING] = A_BOLD | ColorPair(Green, Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
[PROCESS] = A_NORMAL,
|
2017-05-23 17:02:34 +00:00
|
|
|
[PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2020-10-31 22:28:02 +00:00
|
|
|
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow, Black),
|
|
|
|
[PROCESS_MEGABYTES] = ColorPair(Cyan, Black),
|
|
|
|
[PROCESS_GIGABYTES] = ColorPair(Green, Black),
|
|
|
|
[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan, Black),
|
|
|
|
[PROCESS_TREE] = ColorPair(Cyan, Black),
|
2021-08-30 17:20:42 +00:00
|
|
|
[PROCESS_RUN_STATE] = ColorPair(Green, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red, Black),
|
|
|
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red, Black),
|
|
|
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green, Black),
|
2020-11-16 12:18:29 +00:00
|
|
|
[PROCESS_NEW] = ColorPair(Black, Green),
|
|
|
|
[PROCESS_TOMB] = ColorPair(Black, Red),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PROCESS_THREAD] = ColorPair(Green, Black),
|
|
|
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Green, Black),
|
2020-10-17 10:54:45 +00:00
|
|
|
[PROCESS_COMM] = ColorPair(Magenta, Black),
|
|
|
|
[PROCESS_THREAD_COMM] = ColorPair(Blue, Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
[BAR_BORDER] = A_BOLD,
|
2017-05-23 17:02:34 +00:00
|
|
|
[BAR_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2020-10-31 22:28:02 +00:00
|
|
|
[SWAP] = ColorPair(Red, Black),
|
2021-01-07 13:38:18 +00:00
|
|
|
[SWAP_CACHE] = ColorPair(Yellow, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[GRAPH_1] = A_BOLD | ColorPair(Cyan, Black),
|
|
|
|
[GRAPH_2] = ColorPair(Cyan, Black),
|
|
|
|
[MEMORY_USED] = ColorPair(Green, Black),
|
|
|
|
[MEMORY_BUFFERS] = ColorPair(Blue, Black),
|
|
|
|
[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue, Black),
|
|
|
|
[MEMORY_CACHE] = ColorPair(Yellow, Black),
|
2021-03-03 18:48:30 +00:00
|
|
|
[MEMORY_SHARED] = ColorPair(Magenta, Black),
|
2021-01-14 14:46:37 +00:00
|
|
|
[HUGEPAGE_1] = ColorPair(Green, Black),
|
|
|
|
[HUGEPAGE_2] = ColorPair(Yellow, Black),
|
|
|
|
[HUGEPAGE_3] = ColorPair(Red, Black),
|
|
|
|
[HUGEPAGE_4] = ColorPair(Blue, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Cyan, Black),
|
|
|
|
[LOAD_AVERAGE_FIVE] = A_BOLD | ColorPair(Cyan, Black),
|
|
|
|
[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(White, Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
[LOAD] = A_BOLD,
|
2020-10-31 22:28:02 +00:00
|
|
|
[HELP_BOLD] = A_BOLD | ColorPair(Cyan, Black),
|
2021-01-21 19:27:37 +00:00
|
|
|
[HELP_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2015-02-03 21:30:05 +00:00
|
|
|
[CLOCK] = A_BOLD,
|
2020-10-05 11:52:58 +00:00
|
|
|
[DATE] = A_BOLD,
|
|
|
|
[DATETIME] = A_BOLD,
|
2020-10-31 22:28:02 +00:00
|
|
|
[CHECK_BOX] = ColorPair(Cyan, Black),
|
2020-08-31 20:08:35 +00:00
|
|
|
[CHECK_MARK] = A_BOLD,
|
2015-02-03 21:30:05 +00:00
|
|
|
[CHECK_TEXT] = A_NORMAL,
|
|
|
|
[HOSTNAME] = A_BOLD,
|
2020-10-31 22:28:02 +00:00
|
|
|
[CPU_NICE] = ColorPair(Blue, Black),
|
|
|
|
[CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue, Black),
|
|
|
|
[CPU_NORMAL] = ColorPair(Green, Black),
|
|
|
|
[CPU_SYSTEM] = ColorPair(Red, Black),
|
2020-04-27 04:31:17 +00:00
|
|
|
[CPU_IOWAIT] = A_BOLD | ColorPairGrayBlack,
|
2020-10-31 22:28:02 +00:00
|
|
|
[CPU_IRQ] = ColorPair(Yellow, Black),
|
|
|
|
[CPU_SOFTIRQ] = ColorPair(Magenta, Black),
|
|
|
|
[CPU_STEAL] = ColorPair(Cyan, Black),
|
|
|
|
[CPU_GUEST] = ColorPair(Cyan, Black),
|
2021-08-31 05:38:52 +00:00
|
|
|
[PANEL_EDIT] = ColorPair(White, Blue),
|
|
|
|
[SCREENS_OTH_BORDER] = ColorPair(Blue, Blue),
|
|
|
|
[SCREENS_OTH_TEXT] = ColorPair(Black, Blue),
|
|
|
|
[SCREENS_CUR_BORDER] = ColorPair(Green, Green),
|
|
|
|
[SCREENS_CUR_TEXT] = ColorPair(Black, Green),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Cyan, Black),
|
|
|
|
[PRESSURE_STALL_SIXTY] = A_BOLD | ColorPair(Cyan, Black),
|
|
|
|
[PRESSURE_STALL_TEN] = A_BOLD | ColorPair(White, Black),
|
|
|
|
[ZFS_MFU] = ColorPair(Blue, Black),
|
|
|
|
[ZFS_MRU] = ColorPair(Yellow, Black),
|
|
|
|
[ZFS_ANON] = ColorPair(Magenta, Black),
|
|
|
|
[ZFS_HEADER] = ColorPair(Cyan, Black),
|
|
|
|
[ZFS_OTHER] = ColorPair(Magenta, Black),
|
|
|
|
[ZFS_COMPRESSED] = ColorPair(Blue, Black),
|
|
|
|
[ZFS_RATIO] = ColorPair(Magenta, Black),
|
|
|
|
[ZRAM] = ColorPair(Yellow, Black),
|
2021-06-23 07:44:56 +00:00
|
|
|
[DYNAMIC_GRAY] = ColorPairGrayBlack,
|
|
|
|
[DYNAMIC_DARKGRAY] = A_BOLD | ColorPairGrayBlack,
|
|
|
|
[DYNAMIC_RED] = ColorPair(Red, Black),
|
|
|
|
[DYNAMIC_GREEN] = ColorPair(Green, Black),
|
|
|
|
[DYNAMIC_BLUE] = ColorPair(Blue, Black),
|
|
|
|
[DYNAMIC_CYAN] = ColorPair(Cyan, Black),
|
|
|
|
[DYNAMIC_MAGENTA] = ColorPair(Magenta, Black),
|
|
|
|
[DYNAMIC_YELLOW] = ColorPair(Yellow, Black),
|
|
|
|
[DYNAMIC_WHITE] = ColorPair(White, Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
},
|
|
|
|
[COLORSCHEME_MONOCHROME] = {
|
|
|
|
[RESET_COLOR] = A_NORMAL,
|
|
|
|
[DEFAULT_COLOR] = A_NORMAL,
|
|
|
|
[FUNCTION_BAR] = A_REVERSE,
|
|
|
|
[FUNCTION_KEY] = A_NORMAL,
|
|
|
|
[PANEL_HEADER_FOCUS] = A_REVERSE,
|
|
|
|
[PANEL_HEADER_UNFOCUS] = A_REVERSE,
|
2015-04-09 18:17:20 +00:00
|
|
|
[PANEL_SELECTION_FOCUS] = A_REVERSE,
|
|
|
|
[PANEL_SELECTION_FOLLOW] = A_REVERSE,
|
|
|
|
[PANEL_SELECTION_UNFOCUS] = A_BOLD,
|
2015-02-03 21:30:05 +00:00
|
|
|
[FAILED_SEARCH] = A_REVERSE | A_BOLD,
|
2020-10-17 10:54:45 +00:00
|
|
|
[FAILED_READ] = A_BOLD,
|
2020-10-05 13:14:54 +00:00
|
|
|
[PAUSED] = A_BOLD | A_REVERSE,
|
2015-02-03 21:30:05 +00:00
|
|
|
[UPTIME] = A_BOLD,
|
|
|
|
[BATTERY] = A_BOLD,
|
|
|
|
[LARGE_NUMBER] = A_BOLD,
|
2021-03-28 16:18:56 +00:00
|
|
|
[METER_SHADOW] = A_DIM,
|
2015-02-03 21:30:05 +00:00
|
|
|
[METER_TEXT] = A_NORMAL,
|
|
|
|
[METER_VALUE] = A_BOLD,
|
2020-10-20 19:40:51 +00:00
|
|
|
[METER_VALUE_ERROR] = A_BOLD,
|
2020-10-16 17:44:53 +00:00
|
|
|
[METER_VALUE_IOREAD] = A_NORMAL,
|
|
|
|
[METER_VALUE_IOWRITE] = A_NORMAL,
|
2020-10-07 13:42:13 +00:00
|
|
|
[METER_VALUE_NOTICE] = A_BOLD,
|
|
|
|
[METER_VALUE_OK] = A_NORMAL,
|
2020-12-23 19:54:03 +00:00
|
|
|
[METER_VALUE_WARN] = A_BOLD,
|
2015-02-03 21:30:05 +00:00
|
|
|
[LED_COLOR] = A_NORMAL,
|
|
|
|
[TASKS_RUNNING] = A_BOLD,
|
|
|
|
[PROCESS] = A_NORMAL,
|
|
|
|
[PROCESS_SHADOW] = A_DIM,
|
|
|
|
[PROCESS_TAG] = A_BOLD,
|
|
|
|
[PROCESS_MEGABYTES] = A_BOLD,
|
2020-09-13 21:50:24 +00:00
|
|
|
[PROCESS_GIGABYTES] = A_BOLD,
|
2015-02-03 21:30:05 +00:00
|
|
|
[PROCESS_BASENAME] = A_BOLD,
|
|
|
|
[PROCESS_TREE] = A_BOLD,
|
2021-08-30 17:20:42 +00:00
|
|
|
[PROCESS_RUN_STATE] = A_BOLD,
|
2015-02-03 21:30:05 +00:00
|
|
|
[PROCESS_D_STATE] = A_BOLD,
|
|
|
|
[PROCESS_HIGH_PRIORITY] = A_BOLD,
|
|
|
|
[PROCESS_LOW_PRIORITY] = A_DIM,
|
2020-10-31 01:56:16 +00:00
|
|
|
[PROCESS_NEW] = A_BOLD,
|
|
|
|
[PROCESS_TOMB] = A_DIM,
|
2015-02-03 21:30:05 +00:00
|
|
|
[PROCESS_THREAD] = A_BOLD,
|
|
|
|
[PROCESS_THREAD_BASENAME] = A_REVERSE,
|
2020-10-17 10:54:45 +00:00
|
|
|
[PROCESS_COMM] = A_BOLD,
|
|
|
|
[PROCESS_THREAD_COMM] = A_REVERSE,
|
2015-02-03 21:30:05 +00:00
|
|
|
[BAR_BORDER] = A_BOLD,
|
|
|
|
[BAR_SHADOW] = A_DIM,
|
|
|
|
[SWAP] = A_BOLD,
|
2021-01-07 13:38:18 +00:00
|
|
|
[SWAP_CACHE] = A_NORMAL,
|
2015-02-03 21:30:05 +00:00
|
|
|
[GRAPH_1] = A_BOLD,
|
|
|
|
[GRAPH_2] = A_NORMAL,
|
|
|
|
[MEMORY_USED] = A_BOLD,
|
|
|
|
[MEMORY_BUFFERS] = A_NORMAL,
|
|
|
|
[MEMORY_BUFFERS_TEXT] = A_NORMAL,
|
|
|
|
[MEMORY_CACHE] = A_NORMAL,
|
2021-03-03 18:48:30 +00:00
|
|
|
[MEMORY_SHARED] = A_NORMAL,
|
2021-01-14 14:46:37 +00:00
|
|
|
[HUGEPAGE_1] = A_BOLD,
|
|
|
|
[HUGEPAGE_2] = A_NORMAL,
|
|
|
|
[HUGEPAGE_3] = A_REVERSE | A_BOLD,
|
|
|
|
[HUGEPAGE_4] = A_REVERSE,
|
2015-02-03 21:30:05 +00:00
|
|
|
[LOAD_AVERAGE_FIFTEEN] = A_DIM,
|
|
|
|
[LOAD_AVERAGE_FIVE] = A_NORMAL,
|
|
|
|
[LOAD_AVERAGE_ONE] = A_BOLD,
|
|
|
|
[LOAD] = A_BOLD,
|
|
|
|
[HELP_BOLD] = A_BOLD,
|
2021-01-21 19:27:37 +00:00
|
|
|
[HELP_SHADOW] = A_DIM,
|
2015-02-03 21:30:05 +00:00
|
|
|
[CLOCK] = A_BOLD,
|
2020-10-05 11:52:58 +00:00
|
|
|
[DATE] = A_BOLD,
|
|
|
|
[DATETIME] = A_BOLD,
|
2020-08-31 20:08:35 +00:00
|
|
|
[CHECK_BOX] = A_BOLD,
|
|
|
|
[CHECK_MARK] = A_NORMAL,
|
2015-02-03 21:30:05 +00:00
|
|
|
[CHECK_TEXT] = A_NORMAL,
|
|
|
|
[HOSTNAME] = A_BOLD,
|
|
|
|
[CPU_NICE] = A_NORMAL,
|
|
|
|
[CPU_NICE_TEXT] = A_NORMAL,
|
|
|
|
[CPU_NORMAL] = A_BOLD,
|
2020-08-20 04:09:27 +00:00
|
|
|
[CPU_SYSTEM] = A_BOLD,
|
2015-02-03 21:30:05 +00:00
|
|
|
[CPU_IOWAIT] = A_NORMAL,
|
|
|
|
[CPU_IRQ] = A_BOLD,
|
|
|
|
[CPU_SOFTIRQ] = A_BOLD,
|
2020-09-28 12:55:38 +00:00
|
|
|
[CPU_STEAL] = A_DIM,
|
|
|
|
[CPU_GUEST] = A_DIM,
|
2021-08-31 05:38:52 +00:00
|
|
|
[PANEL_EDIT] = A_BOLD,
|
|
|
|
[SCREENS_OTH_BORDER] = A_DIM,
|
|
|
|
[SCREENS_OTH_TEXT] = A_DIM,
|
|
|
|
[SCREENS_CUR_BORDER] = A_REVERSE,
|
|
|
|
[SCREENS_CUR_TEXT] = A_REVERSE,
|
2020-08-20 03:59:41 +00:00
|
|
|
[PRESSURE_STALL_THREEHUNDRED] = A_DIM,
|
|
|
|
[PRESSURE_STALL_SIXTY] = A_NORMAL,
|
|
|
|
[PRESSURE_STALL_TEN] = A_BOLD,
|
2019-07-06 04:27:49 +00:00
|
|
|
[ZFS_MFU] = A_NORMAL,
|
|
|
|
[ZFS_MRU] = A_NORMAL,
|
|
|
|
[ZFS_ANON] = A_DIM,
|
|
|
|
[ZFS_HEADER] = A_BOLD,
|
|
|
|
[ZFS_OTHER] = A_DIM,
|
2019-09-03 18:26:02 +00:00
|
|
|
[ZFS_COMPRESSED] = A_BOLD,
|
|
|
|
[ZFS_RATIO] = A_BOLD,
|
2020-09-22 11:54:15 +00:00
|
|
|
[ZRAM] = A_NORMAL,
|
2021-06-23 07:44:56 +00:00
|
|
|
[DYNAMIC_GRAY] = A_DIM,
|
|
|
|
[DYNAMIC_DARKGRAY] = A_DIM,
|
|
|
|
[DYNAMIC_RED] = A_BOLD,
|
|
|
|
[DYNAMIC_GREEN] = A_NORMAL,
|
|
|
|
[DYNAMIC_BLUE] = A_NORMAL,
|
|
|
|
[DYNAMIC_CYAN] = A_BOLD,
|
|
|
|
[DYNAMIC_MAGENTA] = A_NORMAL,
|
|
|
|
[DYNAMIC_YELLOW] = A_NORMAL,
|
|
|
|
[DYNAMIC_WHITE] = A_BOLD,
|
2015-02-03 21:30:05 +00:00
|
|
|
},
|
|
|
|
[COLORSCHEME_BLACKONWHITE] = {
|
2020-10-31 22:28:02 +00:00
|
|
|
[RESET_COLOR] = ColorPair(Black, White),
|
|
|
|
[DEFAULT_COLOR] = ColorPair(Black, White),
|
|
|
|
[FUNCTION_BAR] = ColorPair(Black, Cyan),
|
|
|
|
[FUNCTION_KEY] = ColorPair(Black, White),
|
|
|
|
[PANEL_HEADER_FOCUS] = ColorPair(Black, Green),
|
|
|
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black, Green),
|
|
|
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black, Cyan),
|
|
|
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black, Yellow),
|
|
|
|
[PANEL_SELECTION_UNFOCUS] = ColorPair(Blue, White),
|
|
|
|
[FAILED_SEARCH] = ColorPair(Red, Cyan),
|
2020-10-17 10:54:45 +00:00
|
|
|
[FAILED_READ] = ColorPair(Red, White),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PAUSED] = A_BOLD | ColorPair(Yellow, Cyan),
|
|
|
|
[UPTIME] = ColorPair(Yellow, White),
|
|
|
|
[BATTERY] = ColorPair(Yellow, White),
|
|
|
|
[LARGE_NUMBER] = ColorPair(Red, White),
|
2021-03-28 16:18:56 +00:00
|
|
|
[METER_SHADOW] = ColorPair(Blue, White),
|
2020-10-31 22:28:02 +00:00
|
|
|
[METER_TEXT] = ColorPair(Blue, White),
|
|
|
|
[METER_VALUE] = ColorPair(Black, White),
|
|
|
|
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red, White),
|
|
|
|
[METER_VALUE_IOREAD] = ColorPair(Green, White),
|
|
|
|
[METER_VALUE_IOWRITE] = ColorPair(Yellow, White),
|
2020-11-15 16:42:16 +00:00
|
|
|
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow, White),
|
|
|
|
[METER_VALUE_OK] = ColorPair(Green, White),
|
2020-12-23 19:54:03 +00:00
|
|
|
[METER_VALUE_WARN] = A_BOLD | ColorPair(Yellow, White),
|
2020-10-31 22:28:02 +00:00
|
|
|
[LED_COLOR] = ColorPair(Green, White),
|
|
|
|
[TASKS_RUNNING] = ColorPair(Green, White),
|
|
|
|
[PROCESS] = ColorPair(Black, White),
|
|
|
|
[PROCESS_SHADOW] = A_BOLD | ColorPair(Black, White),
|
|
|
|
[PROCESS_TAG] = ColorPair(White, Blue),
|
|
|
|
[PROCESS_MEGABYTES] = ColorPair(Blue, White),
|
|
|
|
[PROCESS_GIGABYTES] = ColorPair(Green, White),
|
|
|
|
[PROCESS_BASENAME] = ColorPair(Blue, White),
|
|
|
|
[PROCESS_TREE] = ColorPair(Green, White),
|
2021-08-30 17:20:42 +00:00
|
|
|
[PROCESS_RUN_STATE] = ColorPair(Green, White),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red, White),
|
|
|
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red, White),
|
|
|
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green, White),
|
2020-11-16 12:18:29 +00:00
|
|
|
[PROCESS_NEW] = ColorPair(White, Green),
|
|
|
|
[PROCESS_TOMB] = ColorPair(White, Red),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PROCESS_THREAD] = ColorPair(Blue, White),
|
|
|
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue, White),
|
2020-10-17 10:54:45 +00:00
|
|
|
[PROCESS_COMM] = ColorPair(Magenta, White),
|
|
|
|
[PROCESS_THREAD_COMM] = ColorPair(Green, White),
|
2020-10-31 22:28:02 +00:00
|
|
|
[BAR_BORDER] = ColorPair(Blue, White),
|
|
|
|
[BAR_SHADOW] = ColorPair(Black, White),
|
|
|
|
[SWAP] = ColorPair(Red, White),
|
2021-01-07 13:38:18 +00:00
|
|
|
[SWAP_CACHE] = ColorPair(Yellow, White),
|
2020-10-31 22:28:02 +00:00
|
|
|
[GRAPH_1] = A_BOLD | ColorPair(Blue, White),
|
|
|
|
[GRAPH_2] = ColorPair(Blue, White),
|
|
|
|
[MEMORY_USED] = ColorPair(Green, White),
|
|
|
|
[MEMORY_BUFFERS] = ColorPair(Cyan, White),
|
|
|
|
[MEMORY_BUFFERS_TEXT] = ColorPair(Cyan, White),
|
|
|
|
[MEMORY_CACHE] = ColorPair(Yellow, White),
|
2021-03-03 18:48:30 +00:00
|
|
|
[MEMORY_SHARED] = ColorPair(Magenta, White),
|
2021-01-14 14:46:37 +00:00
|
|
|
[HUGEPAGE_1] = ColorPair(Green, White),
|
|
|
|
[HUGEPAGE_2] = ColorPair(Yellow, White),
|
|
|
|
[HUGEPAGE_3] = ColorPair(Red, White),
|
|
|
|
[HUGEPAGE_4] = ColorPair(Blue, White),
|
2020-10-31 22:28:02 +00:00
|
|
|
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Black, White),
|
|
|
|
[LOAD_AVERAGE_FIVE] = ColorPair(Black, White),
|
|
|
|
[LOAD_AVERAGE_ONE] = ColorPair(Black, White),
|
|
|
|
[LOAD] = ColorPair(Black, White),
|
|
|
|
[HELP_BOLD] = ColorPair(Blue, White),
|
2021-01-21 19:27:37 +00:00
|
|
|
[HELP_SHADOW] = A_BOLD | ColorPair(Black, White),
|
2020-10-31 22:28:02 +00:00
|
|
|
[CLOCK] = ColorPair(Black, White),
|
|
|
|
[DATE] = ColorPair(Black, White),
|
|
|
|
[DATETIME] = ColorPair(Black, White),
|
|
|
|
[CHECK_BOX] = ColorPair(Blue, White),
|
|
|
|
[CHECK_MARK] = ColorPair(Black, White),
|
|
|
|
[CHECK_TEXT] = ColorPair(Black, White),
|
|
|
|
[HOSTNAME] = ColorPair(Black, White),
|
|
|
|
[CPU_NICE] = ColorPair(Cyan, White),
|
|
|
|
[CPU_NICE_TEXT] = ColorPair(Cyan, White),
|
|
|
|
[CPU_NORMAL] = ColorPair(Green, White),
|
|
|
|
[CPU_SYSTEM] = ColorPair(Red, White),
|
|
|
|
[CPU_IOWAIT] = A_BOLD | ColorPair(Black, White),
|
|
|
|
[CPU_IRQ] = ColorPair(Blue, White),
|
|
|
|
[CPU_SOFTIRQ] = ColorPair(Blue, White),
|
|
|
|
[CPU_STEAL] = ColorPair(Cyan, White),
|
|
|
|
[CPU_GUEST] = ColorPair(Cyan, White),
|
2021-08-31 05:38:52 +00:00
|
|
|
[PANEL_EDIT] = ColorPair(White,Blue),
|
|
|
|
[SCREENS_OTH_BORDER] = A_BOLD | ColorPair(Black,White),
|
|
|
|
[SCREENS_OTH_TEXT] = A_BOLD | ColorPair(Black,White),
|
|
|
|
[SCREENS_CUR_BORDER] = ColorPair(Green,Green),
|
|
|
|
[SCREENS_CUR_TEXT] = ColorPair(Black,Green),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Black, White),
|
|
|
|
[PRESSURE_STALL_SIXTY] = ColorPair(Black, White),
|
|
|
|
[PRESSURE_STALL_TEN] = ColorPair(Black, White),
|
|
|
|
[ZFS_MFU] = ColorPair(Cyan, White),
|
|
|
|
[ZFS_MRU] = ColorPair(Yellow, White),
|
|
|
|
[ZFS_ANON] = ColorPair(Magenta, White),
|
|
|
|
[ZFS_HEADER] = ColorPair(Yellow, White),
|
|
|
|
[ZFS_OTHER] = ColorPair(Magenta, White),
|
|
|
|
[ZFS_COMPRESSED] = ColorPair(Cyan, White),
|
|
|
|
[ZFS_RATIO] = ColorPair(Magenta, White),
|
2021-06-23 07:44:56 +00:00
|
|
|
[ZRAM] = ColorPair(Yellow, White),
|
|
|
|
[DYNAMIC_GRAY] = ColorPair(Black, White),
|
|
|
|
[DYNAMIC_DARKGRAY] = A_BOLD | ColorPair(Black, White),
|
|
|
|
[DYNAMIC_RED] = ColorPair(Red, White),
|
|
|
|
[DYNAMIC_GREEN] = ColorPair(Green, White),
|
|
|
|
[DYNAMIC_BLUE] = ColorPair(Blue, White),
|
|
|
|
[DYNAMIC_CYAN] = ColorPair(Yellow, White),
|
|
|
|
[DYNAMIC_MAGENTA] = ColorPair(Magenta, White),
|
|
|
|
[DYNAMIC_YELLOW] = ColorPair(Yellow, White),
|
|
|
|
[DYNAMIC_WHITE] = A_BOLD | ColorPair(Black, White),
|
2015-02-03 21:30:05 +00:00
|
|
|
},
|
|
|
|
[COLORSCHEME_LIGHTTERMINAL] = {
|
2021-01-08 10:25:25 +00:00
|
|
|
[RESET_COLOR] = ColorPair(Black, Black),
|
|
|
|
[DEFAULT_COLOR] = ColorPair(Black, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[FUNCTION_BAR] = ColorPair(Black, Cyan),
|
2021-01-08 10:25:25 +00:00
|
|
|
[FUNCTION_KEY] = ColorPair(Black, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PANEL_HEADER_FOCUS] = ColorPair(Black, Green),
|
|
|
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black, Green),
|
|
|
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black, Cyan),
|
|
|
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black, Yellow),
|
|
|
|
[PANEL_SELECTION_UNFOCUS] = ColorPair(Blue, Black),
|
|
|
|
[FAILED_SEARCH] = ColorPair(Red, Cyan),
|
2020-10-17 10:54:45 +00:00
|
|
|
[FAILED_READ] = ColorPair(Red, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PAUSED] = A_BOLD | ColorPair(Yellow, Cyan),
|
|
|
|
[UPTIME] = ColorPair(Yellow, Black),
|
|
|
|
[BATTERY] = ColorPair(Yellow, Black),
|
|
|
|
[LARGE_NUMBER] = ColorPair(Red, Black),
|
2021-03-28 16:18:56 +00:00
|
|
|
[METER_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2020-10-31 22:28:02 +00:00
|
|
|
[METER_TEXT] = ColorPair(Blue, Black),
|
2021-01-08 10:25:25 +00:00
|
|
|
[METER_VALUE] = ColorPair(Black, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red, Black),
|
|
|
|
[METER_VALUE_IOREAD] = ColorPair(Green, Black),
|
|
|
|
[METER_VALUE_IOWRITE] = ColorPair(Yellow, Black),
|
2021-01-11 11:54:19 +00:00
|
|
|
[METER_VALUE_NOTICE] = A_BOLD | ColorPairWhiteDefault,
|
2020-11-15 16:42:16 +00:00
|
|
|
[METER_VALUE_OK] = ColorPair(Green, Black),
|
2020-12-23 19:54:03 +00:00
|
|
|
[METER_VALUE_WARN] = A_BOLD | ColorPair(Yellow, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[LED_COLOR] = ColorPair(Green, Black),
|
|
|
|
[TASKS_RUNNING] = ColorPair(Green, Black),
|
2021-01-08 10:25:25 +00:00
|
|
|
[PROCESS] = ColorPair(Black, Black),
|
2017-05-23 17:02:34 +00:00
|
|
|
[PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2021-01-08 10:25:25 +00:00
|
|
|
[PROCESS_TAG] = ColorPair(White, Blue),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PROCESS_MEGABYTES] = ColorPair(Blue, Black),
|
|
|
|
[PROCESS_GIGABYTES] = ColorPair(Green, Black),
|
|
|
|
[PROCESS_BASENAME] = ColorPair(Green, Black),
|
|
|
|
[PROCESS_TREE] = ColorPair(Blue, Black),
|
2021-08-30 17:20:42 +00:00
|
|
|
[PROCESS_RUN_STATE] = ColorPair(Green, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red, Black),
|
|
|
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red, Black),
|
|
|
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green, Black),
|
2020-11-16 12:18:29 +00:00
|
|
|
[PROCESS_NEW] = ColorPair(Black, Green),
|
|
|
|
[PROCESS_TOMB] = ColorPair(Black, Red),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PROCESS_THREAD] = ColorPair(Blue, Black),
|
|
|
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue, Black),
|
2020-10-17 10:54:45 +00:00
|
|
|
[PROCESS_COMM] = ColorPair(Magenta, Black),
|
|
|
|
[PROCESS_THREAD_COMM] = ColorPair(Yellow, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[BAR_BORDER] = ColorPair(Blue, Black),
|
2017-05-23 17:02:34 +00:00
|
|
|
[BAR_SHADOW] = ColorPairGrayBlack,
|
2020-10-31 22:28:02 +00:00
|
|
|
[SWAP] = ColorPair(Red, Black),
|
2021-01-07 13:38:18 +00:00
|
|
|
[SWAP_CACHE] = ColorPair(Yellow, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[GRAPH_1] = A_BOLD | ColorPair(Cyan, Black),
|
|
|
|
[GRAPH_2] = ColorPair(Cyan, Black),
|
|
|
|
[MEMORY_USED] = ColorPair(Green, Black),
|
|
|
|
[MEMORY_BUFFERS] = ColorPair(Cyan, Black),
|
|
|
|
[MEMORY_BUFFERS_TEXT] = ColorPair(Cyan, Black),
|
|
|
|
[MEMORY_CACHE] = ColorPair(Yellow, Black),
|
2021-03-03 18:48:30 +00:00
|
|
|
[MEMORY_SHARED] = ColorPair(Magenta, Black),
|
2021-01-14 14:46:37 +00:00
|
|
|
[HUGEPAGE_1] = ColorPair(Green, Black),
|
|
|
|
[HUGEPAGE_2] = ColorPair(Yellow, Black),
|
|
|
|
[HUGEPAGE_3] = ColorPair(Red, Black),
|
|
|
|
[HUGEPAGE_4] = ColorPair(Blue, Black),
|
2021-01-08 10:25:25 +00:00
|
|
|
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Black, Black),
|
|
|
|
[LOAD_AVERAGE_FIVE] = ColorPair(Black, Black),
|
|
|
|
[LOAD_AVERAGE_ONE] = ColorPair(Black, Black),
|
2021-01-11 11:54:19 +00:00
|
|
|
[LOAD] = ColorPairWhiteDefault,
|
2020-10-31 22:28:02 +00:00
|
|
|
[HELP_BOLD] = ColorPair(Blue, Black),
|
2021-01-21 19:27:37 +00:00
|
|
|
[HELP_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2021-01-11 11:54:19 +00:00
|
|
|
[CLOCK] = ColorPairWhiteDefault,
|
|
|
|
[DATE] = ColorPairWhiteDefault,
|
|
|
|
[DATETIME] = ColorPairWhiteDefault,
|
2020-10-31 22:28:02 +00:00
|
|
|
[CHECK_BOX] = ColorPair(Blue, Black),
|
2021-01-08 10:25:25 +00:00
|
|
|
[CHECK_MARK] = ColorPair(Black, Black),
|
|
|
|
[CHECK_TEXT] = ColorPair(Black, Black),
|
2021-01-11 11:54:19 +00:00
|
|
|
[HOSTNAME] = ColorPairWhiteDefault,
|
2020-10-31 22:28:02 +00:00
|
|
|
[CPU_NICE] = ColorPair(Cyan, Black),
|
|
|
|
[CPU_NICE_TEXT] = ColorPair(Cyan, Black),
|
|
|
|
[CPU_NORMAL] = ColorPair(Green, Black),
|
|
|
|
[CPU_SYSTEM] = ColorPair(Red, Black),
|
2021-01-08 10:25:25 +00:00
|
|
|
[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[CPU_IRQ] = A_BOLD | ColorPair(Blue, Black),
|
|
|
|
[CPU_SOFTIRQ] = ColorPair(Blue, Black),
|
2021-01-08 10:25:25 +00:00
|
|
|
[CPU_STEAL] = ColorPair(Black, Black),
|
|
|
|
[CPU_GUEST] = ColorPair(Black, Black),
|
2021-08-31 05:38:52 +00:00
|
|
|
[PANEL_EDIT] = ColorPair(White,Blue),
|
|
|
|
[SCREENS_OTH_BORDER] = ColorPair(Blue,Black),
|
|
|
|
[SCREENS_OTH_TEXT] = ColorPair(Blue,Black),
|
|
|
|
[SCREENS_CUR_BORDER] = ColorPair(Green,Green),
|
|
|
|
[SCREENS_CUR_TEXT] = ColorPair(Black,Green),
|
2021-01-08 10:25:25 +00:00
|
|
|
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Black, Black),
|
|
|
|
[PRESSURE_STALL_SIXTY] = ColorPair(Black, Black),
|
|
|
|
[PRESSURE_STALL_TEN] = ColorPair(Black, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[ZFS_MFU] = ColorPair(Cyan, Black),
|
|
|
|
[ZFS_MRU] = ColorPair(Yellow, Black),
|
|
|
|
[ZFS_ANON] = A_BOLD | ColorPair(Magenta, Black),
|
2021-01-08 10:25:25 +00:00
|
|
|
[ZFS_HEADER] = ColorPair(Black, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[ZFS_OTHER] = A_BOLD | ColorPair(Magenta, Black),
|
|
|
|
[ZFS_COMPRESSED] = ColorPair(Cyan, Black),
|
|
|
|
[ZFS_RATIO] = A_BOLD | ColorPair(Magenta, Black),
|
|
|
|
[ZRAM] = ColorPair(Yellow, Black),
|
2021-06-23 07:44:56 +00:00
|
|
|
[DYNAMIC_GRAY] = ColorPairGrayBlack,
|
|
|
|
[DYNAMIC_DARKGRAY] = A_BOLD | ColorPairGrayBlack,
|
|
|
|
[DYNAMIC_RED] = ColorPair(Red, Black),
|
|
|
|
[DYNAMIC_GREEN] = ColorPair(Green, Black),
|
|
|
|
[DYNAMIC_BLUE] = ColorPair(Blue, Black),
|
|
|
|
[DYNAMIC_CYAN] = ColorPair(Cyan, Black),
|
|
|
|
[DYNAMIC_MAGENTA] = ColorPair(Magenta, Black),
|
|
|
|
[DYNAMIC_YELLOW] = ColorPair(Yellow, Black),
|
|
|
|
[DYNAMIC_WHITE] = ColorPairWhiteDefault,
|
2015-02-03 21:30:05 +00:00
|
|
|
},
|
|
|
|
[COLORSCHEME_MIDNIGHT] = {
|
2020-10-31 22:28:02 +00:00
|
|
|
[RESET_COLOR] = ColorPair(White, Blue),
|
|
|
|
[DEFAULT_COLOR] = ColorPair(White, Blue),
|
|
|
|
[FUNCTION_BAR] = ColorPair(Black, Cyan),
|
2015-02-03 21:30:05 +00:00
|
|
|
[FUNCTION_KEY] = A_NORMAL,
|
2020-10-31 22:28:02 +00:00
|
|
|
[PANEL_HEADER_FOCUS] = ColorPair(Black, Cyan),
|
|
|
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black, Cyan),
|
|
|
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black, White),
|
|
|
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black, Yellow),
|
|
|
|
[PANEL_SELECTION_UNFOCUS] = A_BOLD | ColorPair(Yellow, Blue),
|
|
|
|
[FAILED_SEARCH] = ColorPair(Red, Cyan),
|
2020-10-17 10:54:45 +00:00
|
|
|
[FAILED_READ] = A_BOLD | ColorPair(Red, Blue),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PAUSED] = A_BOLD | ColorPair(Yellow, Cyan),
|
|
|
|
[UPTIME] = A_BOLD | ColorPair(Yellow, Blue),
|
|
|
|
[BATTERY] = A_BOLD | ColorPair(Yellow, Blue),
|
|
|
|
[LARGE_NUMBER] = A_BOLD | ColorPair(Red, Blue),
|
2021-03-28 16:18:56 +00:00
|
|
|
[METER_SHADOW] = ColorPair(Cyan, Blue),
|
2020-10-31 22:28:02 +00:00
|
|
|
[METER_TEXT] = ColorPair(Cyan, Blue),
|
|
|
|
[METER_VALUE] = A_BOLD | ColorPair(Cyan, Blue),
|
|
|
|
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red, Blue),
|
|
|
|
[METER_VALUE_IOREAD] = ColorPair(Green, Blue),
|
|
|
|
[METER_VALUE_IOWRITE] = ColorPair(Black, Blue),
|
2020-11-15 16:42:16 +00:00
|
|
|
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(White, Blue),
|
|
|
|
[METER_VALUE_OK] = ColorPair(Green, Blue),
|
2020-12-23 19:54:03 +00:00
|
|
|
[METER_VALUE_WARN] = A_BOLD | ColorPair(Yellow, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[LED_COLOR] = ColorPair(Green, Blue),
|
|
|
|
[TASKS_RUNNING] = A_BOLD | ColorPair(Green, Blue),
|
|
|
|
[PROCESS] = ColorPair(White, Blue),
|
|
|
|
[PROCESS_SHADOW] = A_BOLD | ColorPair(Black, Blue),
|
|
|
|
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow, Blue),
|
|
|
|
[PROCESS_MEGABYTES] = ColorPair(Cyan, Blue),
|
|
|
|
[PROCESS_GIGABYTES] = ColorPair(Green, Blue),
|
|
|
|
[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan, Blue),
|
|
|
|
[PROCESS_TREE] = ColorPair(Cyan, Blue),
|
2021-08-30 17:20:42 +00:00
|
|
|
[PROCESS_RUN_STATE] = ColorPair(Green, Blue),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red, Blue),
|
|
|
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red, Blue),
|
|
|
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green, Blue),
|
2020-11-16 12:18:29 +00:00
|
|
|
[PROCESS_NEW] = ColorPair(Blue, Green),
|
|
|
|
[PROCESS_TOMB] = ColorPair(Blue, Red),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PROCESS_THREAD] = ColorPair(Green, Blue),
|
|
|
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Green, Blue),
|
2020-10-17 10:54:45 +00:00
|
|
|
[PROCESS_COMM] = ColorPair(Magenta, Blue),
|
|
|
|
[PROCESS_THREAD_COMM] = ColorPair(Black, Blue),
|
2020-10-31 22:28:02 +00:00
|
|
|
[BAR_BORDER] = A_BOLD | ColorPair(Yellow, Blue),
|
|
|
|
[BAR_SHADOW] = ColorPair(Cyan, Blue),
|
|
|
|
[SWAP] = ColorPair(Red, Blue),
|
2021-01-07 13:38:18 +00:00
|
|
|
[SWAP_CACHE] = A_BOLD | ColorPair(Yellow, Blue),
|
2020-10-31 22:28:02 +00:00
|
|
|
[GRAPH_1] = A_BOLD | ColorPair(Cyan, Blue),
|
|
|
|
[GRAPH_2] = ColorPair(Cyan, Blue),
|
|
|
|
[MEMORY_USED] = A_BOLD | ColorPair(Green, Blue),
|
|
|
|
[MEMORY_BUFFERS] = A_BOLD | ColorPair(Cyan, Blue),
|
|
|
|
[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Cyan, Blue),
|
|
|
|
[MEMORY_CACHE] = A_BOLD | ColorPair(Yellow, Blue),
|
2021-03-03 18:48:30 +00:00
|
|
|
[MEMORY_SHARED] = A_BOLD | ColorPair(Magenta, Blue),
|
2021-01-14 14:46:37 +00:00
|
|
|
[HUGEPAGE_1] = A_BOLD | ColorPair(Green, Blue),
|
|
|
|
[HUGEPAGE_2] = A_BOLD | ColorPair(Yellow, Blue),
|
|
|
|
[HUGEPAGE_3] = A_BOLD | ColorPair(Red, Blue),
|
|
|
|
[HUGEPAGE_4] = A_BOLD | ColorPair(White, Blue),
|
2020-10-31 22:28:02 +00:00
|
|
|
[LOAD_AVERAGE_FIFTEEN] = A_BOLD | ColorPair(Black, Blue),
|
|
|
|
[LOAD_AVERAGE_FIVE] = A_NORMAL | ColorPair(White, Blue),
|
|
|
|
[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(White, Blue),
|
|
|
|
[LOAD] = A_BOLD | ColorPair(White, Blue),
|
|
|
|
[HELP_BOLD] = A_BOLD | ColorPair(Cyan, Blue),
|
2021-01-21 19:27:37 +00:00
|
|
|
[HELP_SHADOW] = A_BOLD | ColorPair(Black, Blue),
|
2020-10-31 22:28:02 +00:00
|
|
|
[CLOCK] = ColorPair(White, Blue),
|
|
|
|
[DATE] = ColorPair(White, Blue),
|
|
|
|
[DATETIME] = ColorPair(White, Blue),
|
|
|
|
[CHECK_BOX] = ColorPair(Cyan, Blue),
|
|
|
|
[CHECK_MARK] = A_BOLD | ColorPair(White, Blue),
|
|
|
|
[CHECK_TEXT] = A_NORMAL | ColorPair(White, Blue),
|
|
|
|
[HOSTNAME] = ColorPair(White, Blue),
|
|
|
|
[CPU_NICE] = A_BOLD | ColorPair(Cyan, Blue),
|
|
|
|
[CPU_NICE_TEXT] = A_BOLD | ColorPair(Cyan, Blue),
|
|
|
|
[CPU_NORMAL] = A_BOLD | ColorPair(Green, Blue),
|
|
|
|
[CPU_SYSTEM] = A_BOLD | ColorPair(Red, Blue),
|
|
|
|
[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Blue),
|
|
|
|
[CPU_IRQ] = A_BOLD | ColorPair(Black, Blue),
|
|
|
|
[CPU_SOFTIRQ] = ColorPair(Black, Blue),
|
|
|
|
[CPU_STEAL] = ColorPair(White, Blue),
|
|
|
|
[CPU_GUEST] = ColorPair(White, Blue),
|
2021-08-31 05:38:52 +00:00
|
|
|
[PANEL_EDIT] = ColorPair(White,Blue),
|
|
|
|
[SCREENS_OTH_BORDER] = A_BOLD | ColorPair(Yellow,Blue),
|
|
|
|
[SCREENS_OTH_TEXT] = ColorPair(Cyan,Blue),
|
|
|
|
[SCREENS_CUR_BORDER] = ColorPair(Cyan,Cyan),
|
|
|
|
[SCREENS_CUR_TEXT] = ColorPair(Black,Cyan),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PRESSURE_STALL_THREEHUNDRED] = A_BOLD | ColorPair(Black, Blue),
|
|
|
|
[PRESSURE_STALL_SIXTY] = A_NORMAL | ColorPair(White, Blue),
|
|
|
|
[PRESSURE_STALL_TEN] = A_BOLD | ColorPair(White, Blue),
|
|
|
|
[ZFS_MFU] = A_BOLD | ColorPair(White, Blue),
|
|
|
|
[ZFS_MRU] = A_BOLD | ColorPair(Yellow, Blue),
|
|
|
|
[ZFS_ANON] = A_BOLD | ColorPair(Magenta, Blue),
|
|
|
|
[ZFS_HEADER] = A_BOLD | ColorPair(Yellow, Blue),
|
|
|
|
[ZFS_OTHER] = A_BOLD | ColorPair(Magenta, Blue),
|
|
|
|
[ZFS_COMPRESSED] = A_BOLD | ColorPair(White, Blue),
|
|
|
|
[ZFS_RATIO] = A_BOLD | ColorPair(Magenta, Blue),
|
|
|
|
[ZRAM] = A_BOLD | ColorPair(Yellow, Blue),
|
2021-06-23 07:44:56 +00:00
|
|
|
[DYNAMIC_GRAY] = ColorPairGrayBlack,
|
|
|
|
[DYNAMIC_DARKGRAY] = A_BOLD | ColorPairGrayBlack,
|
|
|
|
[DYNAMIC_RED] = ColorPair(Red, Blue),
|
|
|
|
[DYNAMIC_GREEN] = ColorPair(Green, Blue),
|
|
|
|
[DYNAMIC_BLUE] = ColorPair(Black, Blue),
|
|
|
|
[DYNAMIC_CYAN] = ColorPair(Cyan, Blue),
|
|
|
|
[DYNAMIC_MAGENTA] = ColorPair(Magenta, Blue),
|
|
|
|
[DYNAMIC_YELLOW] = ColorPair(Yellow, Blue),
|
|
|
|
[DYNAMIC_WHITE] = ColorPair(White, Blue),
|
2015-02-03 21:30:05 +00:00
|
|
|
},
|
|
|
|
[COLORSCHEME_BLACKNIGHT] = {
|
2020-10-31 22:28:02 +00:00
|
|
|
[RESET_COLOR] = ColorPair(Cyan, Black),
|
|
|
|
[DEFAULT_COLOR] = ColorPair(Cyan, Black),
|
|
|
|
[FUNCTION_BAR] = ColorPair(Black, Green),
|
|
|
|
[FUNCTION_KEY] = ColorPair(Cyan, Black),
|
|
|
|
[PANEL_HEADER_FOCUS] = ColorPair(Black, Green),
|
|
|
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black, Green),
|
|
|
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black, Cyan),
|
|
|
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black, Yellow),
|
|
|
|
[PANEL_SELECTION_UNFOCUS] = ColorPair(Black, White),
|
|
|
|
[FAILED_SEARCH] = ColorPair(Red, Green),
|
2020-10-17 10:54:45 +00:00
|
|
|
[FAILED_READ] = A_BOLD | ColorPair(Red, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PAUSED] = A_BOLD | ColorPair(Yellow, Green),
|
|
|
|
[UPTIME] = ColorPair(Green, Black),
|
|
|
|
[BATTERY] = ColorPair(Green, Black),
|
|
|
|
[LARGE_NUMBER] = A_BOLD | ColorPair(Red, Black),
|
2021-03-28 16:18:56 +00:00
|
|
|
[METER_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2020-10-31 22:28:02 +00:00
|
|
|
[METER_TEXT] = ColorPair(Cyan, Black),
|
|
|
|
[METER_VALUE] = ColorPair(Green, Black),
|
|
|
|
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red, Black),
|
|
|
|
[METER_VALUE_IOREAD] = ColorPair(Green, Black),
|
|
|
|
[METER_VALUE_IOWRITE] = ColorPair(Blue, Black),
|
2020-12-23 19:54:03 +00:00
|
|
|
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(White, Black),
|
2020-11-15 16:42:16 +00:00
|
|
|
[METER_VALUE_OK] = ColorPair(Green, Black),
|
2020-12-23 19:54:03 +00:00
|
|
|
[METER_VALUE_WARN] = A_BOLD | ColorPair(Yellow, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[LED_COLOR] = ColorPair(Green, Black),
|
|
|
|
[TASKS_RUNNING] = A_BOLD | ColorPair(Green, Black),
|
|
|
|
[PROCESS] = ColorPair(Cyan, Black),
|
2017-05-23 17:02:34 +00:00
|
|
|
[PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2020-10-31 22:28:02 +00:00
|
|
|
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow, Black),
|
|
|
|
[PROCESS_MEGABYTES] = A_BOLD | ColorPair(Green, Black),
|
|
|
|
[PROCESS_GIGABYTES] = A_BOLD | ColorPair(Yellow, Black),
|
|
|
|
[PROCESS_BASENAME] = A_BOLD | ColorPair(Green, Black),
|
|
|
|
[PROCESS_TREE] = ColorPair(Cyan, Black),
|
|
|
|
[PROCESS_THREAD] = ColorPair(Green, Black),
|
|
|
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue, Black),
|
2020-10-17 10:54:45 +00:00
|
|
|
[PROCESS_COMM] = ColorPair(Magenta, Black),
|
|
|
|
[PROCESS_THREAD_COMM] = ColorPair(Yellow, Black),
|
2021-08-30 17:20:42 +00:00
|
|
|
[PROCESS_RUN_STATE] = ColorPair(Green, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red, Black),
|
|
|
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red, Black),
|
|
|
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green, Black),
|
2020-11-16 12:18:29 +00:00
|
|
|
[PROCESS_NEW] = ColorPair(Black, Green),
|
|
|
|
[PROCESS_TOMB] = ColorPair(Black, Red),
|
2020-10-31 22:28:02 +00:00
|
|
|
[BAR_BORDER] = A_BOLD | ColorPair(Green, Black),
|
|
|
|
[BAR_SHADOW] = ColorPair(Cyan, Black),
|
|
|
|
[SWAP] = ColorPair(Red, Black),
|
2021-01-07 13:38:18 +00:00
|
|
|
[SWAP_CACHE] = ColorPair(Yellow, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[GRAPH_1] = A_BOLD | ColorPair(Green, Black),
|
|
|
|
[GRAPH_2] = ColorPair(Green, Black),
|
|
|
|
[MEMORY_USED] = ColorPair(Green, Black),
|
|
|
|
[MEMORY_BUFFERS] = ColorPair(Blue, Black),
|
|
|
|
[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue, Black),
|
|
|
|
[MEMORY_CACHE] = ColorPair(Yellow, Black),
|
2021-03-03 18:48:30 +00:00
|
|
|
[MEMORY_SHARED] = ColorPair(Magenta, Black),
|
2021-01-14 14:46:37 +00:00
|
|
|
[HUGEPAGE_1] = ColorPair(Green, Black),
|
|
|
|
[HUGEPAGE_2] = ColorPair(Yellow, Black),
|
|
|
|
[HUGEPAGE_3] = ColorPair(Red, Black),
|
|
|
|
[HUGEPAGE_4] = ColorPair(Blue, Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Green, Black),
|
|
|
|
[LOAD_AVERAGE_FIVE] = ColorPair(Green, Black),
|
|
|
|
[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(Green, Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
[LOAD] = A_BOLD,
|
2020-10-31 22:28:02 +00:00
|
|
|
[HELP_BOLD] = A_BOLD | ColorPair(Cyan, Black),
|
2021-01-21 19:27:37 +00:00
|
|
|
[HELP_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2020-10-31 22:28:02 +00:00
|
|
|
[CLOCK] = ColorPair(Green, Black),
|
|
|
|
[CHECK_BOX] = ColorPair(Green, Black),
|
|
|
|
[CHECK_MARK] = A_BOLD | ColorPair(Green, Black),
|
|
|
|
[CHECK_TEXT] = ColorPair(Cyan, Black),
|
|
|
|
[HOSTNAME] = ColorPair(Green, Black),
|
|
|
|
[CPU_NICE] = ColorPair(Blue, Black),
|
|
|
|
[CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue, Black),
|
|
|
|
[CPU_NORMAL] = ColorPair(Green, Black),
|
|
|
|
[CPU_SYSTEM] = ColorPair(Red, Black),
|
|
|
|
[CPU_IOWAIT] = ColorPair(Yellow, Black),
|
|
|
|
[CPU_IRQ] = A_BOLD | ColorPair(Blue, Black),
|
|
|
|
[CPU_SOFTIRQ] = ColorPair(Blue, Black),
|
|
|
|
[CPU_STEAL] = ColorPair(Cyan, Black),
|
|
|
|
[CPU_GUEST] = ColorPair(Cyan, Black),
|
2021-08-31 05:38:52 +00:00
|
|
|
[PANEL_EDIT] = ColorPair(White,Cyan),
|
|
|
|
[SCREENS_OTH_BORDER] = ColorPair(White,Black),
|
|
|
|
[SCREENS_OTH_TEXT] = ColorPair(Cyan,Black),
|
|
|
|
[SCREENS_CUR_BORDER] = A_BOLD | ColorPair(White,Black),
|
|
|
|
[SCREENS_CUR_TEXT] = A_BOLD | ColorPair(Green,Black),
|
2020-10-31 22:28:02 +00:00
|
|
|
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Green, Black),
|
|
|
|
[PRESSURE_STALL_SIXTY] = ColorPair(Green, Black),
|
|
|
|
[PRESSURE_STALL_TEN] = A_BOLD | ColorPair(Green, Black),
|
|
|
|
[ZFS_MFU] = ColorPair(Blue, Black),
|
|
|
|
[ZFS_MRU] = ColorPair(Yellow, Black),
|
|
|
|
[ZFS_ANON] = ColorPair(Magenta, Black),
|
|
|
|
[ZFS_HEADER] = ColorPair(Yellow, Black),
|
|
|
|
[ZFS_OTHER] = ColorPair(Magenta, Black),
|
|
|
|
[ZFS_COMPRESSED] = ColorPair(Blue, Black),
|
|
|
|
[ZFS_RATIO] = ColorPair(Magenta, Black),
|
|
|
|
[ZRAM] = ColorPair(Yellow, Black),
|
2021-06-23 07:44:56 +00:00
|
|
|
[DYNAMIC_GRAY] = ColorPairGrayBlack,
|
|
|
|
[DYNAMIC_DARKGRAY] = A_BOLD | ColorPairGrayBlack,
|
|
|
|
[DYNAMIC_RED] = ColorPair(Red, Black),
|
|
|
|
[DYNAMIC_GREEN] = ColorPair(Green, Black),
|
|
|
|
[DYNAMIC_BLUE] = ColorPair(Blue, Black),
|
|
|
|
[DYNAMIC_CYAN] = ColorPair(Cyan, Black),
|
|
|
|
[DYNAMIC_MAGENTA] = ColorPair(Magenta, Black),
|
|
|
|
[DYNAMIC_YELLOW] = ColorPair(Yellow, Black),
|
|
|
|
[DYNAMIC_WHITE] = ColorPair(White, Black),
|
2015-04-09 18:17:20 +00:00
|
|
|
},
|
|
|
|
[COLORSCHEME_BROKENGRAY] = { 0 } // dynamically generated.
|
2015-02-03 21:30:05 +00:00
|
|
|
};
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2014-02-27 19:35:22 +00:00
|
|
|
int CRT_scrollHAmount = 5;
|
|
|
|
|
2015-08-19 21:55:24 +00:00
|
|
|
int CRT_scrollWheelVAmount = 10;
|
|
|
|
|
2020-12-14 14:45:48 +00:00
|
|
|
ColorScheme CRT_colorScheme = COLORSCHEME_DEFAULT;
|
2015-01-22 01:27:31 +00:00
|
|
|
|
2020-09-08 12:28:15 +00:00
|
|
|
ATTR_NORETURN
|
2020-12-20 00:25:09 +00:00
|
|
|
static void CRT_handleSIGTERM(ATTR_UNUSED int sgn) {
|
2008-03-09 08:58:38 +00:00
|
|
|
CRT_done();
|
2021-01-29 11:38:30 +00:00
|
|
|
_exit(0);
|
2008-03-09 08:58:38 +00:00
|
|
|
}
|
|
|
|
|
2020-12-25 10:03:15 +00:00
|
|
|
#ifndef NDEBUG
|
|
|
|
|
|
|
|
static int stderrRedirectNewFd = -1;
|
|
|
|
static int stderrRedirectBackupFd = -1;
|
|
|
|
|
|
|
|
static int createStderrCacheFile(void) {
|
2021-03-20 10:21:20 +00:00
|
|
|
#if defined(HAVE_MEMFD_CREATE)
|
2020-12-25 10:03:15 +00:00
|
|
|
return memfd_create("htop.stderr-redirect", 0);
|
|
|
|
#elif defined(O_TMPFILE)
|
|
|
|
return open("/tmp", O_TMPFILE | O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
|
|
|
|
#else
|
|
|
|
char tmpName[] = "htop.stderr-redirectXXXXXX";
|
|
|
|
mode_t curUmask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
|
|
|
|
int r = mkstemp(tmpName);
|
|
|
|
umask(curUmask);
|
|
|
|
if (r < 0)
|
|
|
|
return r;
|
|
|
|
|
|
|
|
(void) unlink(tmpName);
|
|
|
|
|
|
|
|
return r;
|
|
|
|
#endif /* HAVE_MEMFD_CREATE */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void redirectStderr(void) {
|
|
|
|
stderrRedirectNewFd = createStderrCacheFile();
|
|
|
|
if (stderrRedirectNewFd < 0) {
|
|
|
|
/* ignore failure */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
stderrRedirectBackupFd = dup(STDERR_FILENO);
|
|
|
|
dup2(stderrRedirectNewFd, STDERR_FILENO);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dumpStderr(void) {
|
|
|
|
if (stderrRedirectNewFd < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
fsync(STDERR_FILENO);
|
|
|
|
dup2(stderrRedirectBackupFd, STDERR_FILENO);
|
2021-09-10 09:26:51 +00:00
|
|
|
close(stderrRedirectBackupFd);
|
|
|
|
stderrRedirectBackupFd = -1;
|
2020-12-25 10:03:15 +00:00
|
|
|
lseek(stderrRedirectNewFd, 0, SEEK_SET);
|
|
|
|
|
|
|
|
bool header = false;
|
|
|
|
char buffer[8192];
|
|
|
|
for (;;) {
|
|
|
|
errno = 0;
|
|
|
|
ssize_t res = read(stderrRedirectNewFd, buffer, sizeof(buffer));
|
|
|
|
if (res < 0) {
|
|
|
|
if (errno == EINTR)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (res == 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (res > 0) {
|
|
|
|
if (!header) {
|
2021-08-08 17:47:17 +00:00
|
|
|
fprintf(stderr, ">>>>>>>>>> stderr output >>>>>>>>>>\n");
|
2020-12-25 10:03:15 +00:00
|
|
|
header = true;
|
|
|
|
}
|
|
|
|
(void)! write(STDERR_FILENO, buffer, res);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (header)
|
|
|
|
fprintf(stderr, "\n<<<<<<<<<< stderr output <<<<<<<<<<\n");
|
|
|
|
|
|
|
|
close(stderrRedirectNewFd);
|
|
|
|
stderrRedirectNewFd = -1;
|
|
|
|
}
|
|
|
|
|
2021-12-08 12:01:40 +00:00
|
|
|
void CRT_debug_impl(const char* file, size_t lineno, const char* func, const char* fmt, ...) {
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
fprintf(stderr, "[%s:%zu (%s)]: ", file, lineno, func);
|
|
|
|
va_start(args, fmt);
|
|
|
|
vfprintf(stderr, fmt, args);
|
|
|
|
va_end(args);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
}
|
|
|
|
|
2020-12-25 10:03:15 +00:00
|
|
|
#else /* !NDEBUG */
|
|
|
|
|
|
|
|
static void redirectStderr(void) {
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dumpStderr(void) {
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* !NDEBUG */
|
|
|
|
|
2020-10-03 15:53:15 +00:00
|
|
|
static struct sigaction old_sig_handler[32];
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2021-08-14 17:52:26 +00:00
|
|
|
static void CRT_installSignalHandlers(void) {
|
|
|
|
struct sigaction act;
|
|
|
|
sigemptyset (&act.sa_mask);
|
|
|
|
act.sa_flags = (int)SA_RESETHAND | SA_NODEFER;
|
|
|
|
act.sa_handler = CRT_handleSIGSEGV;
|
|
|
|
sigaction (SIGSEGV, &act, &old_sig_handler[SIGSEGV]);
|
|
|
|
sigaction (SIGFPE, &act, &old_sig_handler[SIGFPE]);
|
|
|
|
sigaction (SIGILL, &act, &old_sig_handler[SIGILL]);
|
|
|
|
sigaction (SIGBUS, &act, &old_sig_handler[SIGBUS]);
|
|
|
|
sigaction (SIGPIPE, &act, &old_sig_handler[SIGPIPE]);
|
|
|
|
sigaction (SIGSYS, &act, &old_sig_handler[SIGSYS]);
|
|
|
|
sigaction (SIGABRT, &act, &old_sig_handler[SIGABRT]);
|
|
|
|
|
2022-01-11 21:24:11 +00:00
|
|
|
signal(SIGCHLD, SIG_DFL);
|
2021-08-14 17:52:26 +00:00
|
|
|
signal(SIGINT, CRT_handleSIGTERM);
|
|
|
|
signal(SIGTERM, CRT_handleSIGTERM);
|
|
|
|
signal(SIGQUIT, CRT_handleSIGTERM);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CRT_resetSignalHandlers(void) {
|
|
|
|
sigaction (SIGSEGV, &old_sig_handler[SIGSEGV], NULL);
|
|
|
|
sigaction (SIGFPE, &old_sig_handler[SIGFPE], NULL);
|
|
|
|
sigaction (SIGILL, &old_sig_handler[SIGILL], NULL);
|
|
|
|
sigaction (SIGBUS, &old_sig_handler[SIGBUS], NULL);
|
|
|
|
sigaction (SIGPIPE, &old_sig_handler[SIGPIPE], NULL);
|
|
|
|
sigaction (SIGSYS, &old_sig_handler[SIGSYS], NULL);
|
|
|
|
sigaction (SIGABRT, &old_sig_handler[SIGABRT], NULL);
|
|
|
|
|
|
|
|
signal(SIGINT, SIG_DFL);
|
|
|
|
signal(SIGTERM, SIG_DFL);
|
|
|
|
signal(SIGQUIT, SIG_DFL);
|
|
|
|
}
|
|
|
|
|
2022-05-17 04:53:15 +00:00
|
|
|
void CRT_setMouse(bool enabled) {
|
|
|
|
#ifdef HAVE_GETMOUSE
|
|
|
|
if (enabled) {
|
|
|
|
#if NCURSES_MOUSE_VERSION > 1
|
|
|
|
mousemask(BUTTON1_RELEASED | BUTTON4_PRESSED | BUTTON5_PRESSED, NULL);
|
|
|
|
#else
|
|
|
|
mousemask(BUTTON1_RELEASED, NULL);
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
mousemask(0, NULL);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-01-27 16:14:15 +00:00
|
|
|
void CRT_init(const Settings* settings, bool allowUnicode) {
|
2020-12-25 10:03:15 +00:00
|
|
|
redirectStderr();
|
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
initscr();
|
|
|
|
noecho();
|
2021-05-16 17:55:31 +00:00
|
|
|
CRT_crashSettings = settings;
|
2021-01-27 16:14:15 +00:00
|
|
|
CRT_delay = &(settings->delay);
|
|
|
|
CRT_colors = CRT_colorSchemes[settings->colorScheme];
|
|
|
|
CRT_colorScheme = settings->colorScheme;
|
2019-10-31 16:39:12 +00:00
|
|
|
|
2015-04-09 18:17:20 +00:00
|
|
|
for (int i = 0; i < LAST_COLORELEMENT; i++) {
|
2015-10-05 14:27:44 +00:00
|
|
|
unsigned int color = CRT_colorSchemes[COLORSCHEME_DEFAULT][i];
|
2020-10-31 22:28:02 +00:00
|
|
|
CRT_colorSchemes[COLORSCHEME_BROKENGRAY][i] = color == (A_BOLD | ColorPairGrayBlack) ? ColorPair(White, Black) : color;
|
2015-04-09 18:17:20 +00:00
|
|
|
}
|
2019-10-31 16:39:12 +00:00
|
|
|
|
2020-11-21 20:40:08 +00:00
|
|
|
halfdelay(*CRT_delay);
|
2006-03-04 18:16:49 +00:00
|
|
|
nonl();
|
|
|
|
intrflush(stdscr, false);
|
|
|
|
keypad(stdscr, true);
|
2021-07-14 18:17:13 +00:00
|
|
|
#ifdef HAVE_GETMOUSE
|
2015-08-19 21:55:24 +00:00
|
|
|
mouseinterval(0);
|
2021-07-14 18:17:13 +00:00
|
|
|
#endif
|
2006-03-04 18:16:49 +00:00
|
|
|
curs_set(0);
|
2020-11-01 00:09:51 +00:00
|
|
|
|
|
|
|
if (has_colors()) {
|
2006-03-04 18:16:49 +00:00
|
|
|
start_color();
|
2020-11-01 00:09:51 +00:00
|
|
|
}
|
|
|
|
|
2020-12-14 14:45:48 +00:00
|
|
|
const char* termType = getenv("TERM");
|
|
|
|
if (termType && String_eq(termType, "linux")) {
|
2014-02-27 19:35:22 +00:00
|
|
|
CRT_scrollHAmount = 20;
|
2020-11-01 00:09:51 +00:00
|
|
|
} else {
|
2014-02-27 19:35:22 +00:00
|
|
|
CRT_scrollHAmount = 5;
|
2020-11-01 00:09:51 +00:00
|
|
|
}
|
|
|
|
|
2020-12-14 14:45:48 +00:00
|
|
|
if (termType && (String_startsWith(termType, "xterm") || String_eq(termType, "vt220"))) {
|
2021-08-30 17:22:44 +00:00
|
|
|
#ifdef HTOP_NETBSD
|
|
|
|
#define define_key(s_, k_) define_key((char*)s_, k_)
|
|
|
|
IGNORE_WCASTQUAL_BEGIN
|
|
|
|
#endif
|
2006-03-04 18:16:49 +00:00
|
|
|
define_key("\033[H", KEY_HOME);
|
|
|
|
define_key("\033[F", KEY_END);
|
2014-04-09 20:47:22 +00:00
|
|
|
define_key("\033[7~", KEY_HOME);
|
|
|
|
define_key("\033[8~", KEY_END);
|
2006-03-04 18:16:49 +00:00
|
|
|
define_key("\033OP", KEY_F(1));
|
|
|
|
define_key("\033OQ", KEY_F(2));
|
|
|
|
define_key("\033OR", KEY_F(3));
|
|
|
|
define_key("\033OS", KEY_F(4));
|
2021-02-01 08:02:36 +00:00
|
|
|
define_key("\033O2R", KEY_F(15));
|
2006-03-04 18:16:49 +00:00
|
|
|
define_key("\033[11~", KEY_F(1));
|
|
|
|
define_key("\033[12~", KEY_F(2));
|
|
|
|
define_key("\033[13~", KEY_F(3));
|
|
|
|
define_key("\033[14~", KEY_F(4));
|
2020-12-23 17:59:51 +00:00
|
|
|
define_key("\033[14;2~", KEY_F(15));
|
2006-03-04 18:16:49 +00:00
|
|
|
define_key("\033[17;2~", KEY_F(18));
|
2021-08-31 05:38:52 +00:00
|
|
|
define_key("\033[Z", KEY_SHIFT_TAB);
|
2016-02-19 15:38:02 +00:00
|
|
|
char sequence[3] = "\033a";
|
|
|
|
for (char c = 'a'; c <= 'z'; c++) {
|
|
|
|
sequence[1] = c;
|
|
|
|
define_key(sequence, KEY_ALT('A' + (c - 'a')));
|
|
|
|
}
|
2021-08-30 17:22:44 +00:00
|
|
|
#ifdef HTOP_NETBSD
|
|
|
|
IGNORE_WCASTQUAL_END
|
|
|
|
#undef define_key
|
|
|
|
#endif
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
2021-08-31 05:38:52 +00:00
|
|
|
if (termType && (String_startsWith(termType, "rxvt"))) {
|
|
|
|
define_key("\033[Z", KEY_SHIFT_TAB);
|
|
|
|
}
|
2020-09-17 20:27:33 +00:00
|
|
|
|
2021-08-14 17:52:26 +00:00
|
|
|
CRT_installSignalHandlers();
|
2020-12-02 16:52:16 +00:00
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
use_default_colors();
|
|
|
|
if (!has_colors())
|
2020-12-02 16:52:16 +00:00
|
|
|
CRT_colorScheme = COLORSCHEME_MONOCHROME;
|
2006-03-04 18:16:49 +00:00
|
|
|
CRT_setColors(CRT_colorScheme);
|
|
|
|
|
2015-01-22 01:27:31 +00:00
|
|
|
#ifdef HAVE_LIBNCURSESW
|
2020-11-01 00:09:51 +00:00
|
|
|
if (allowUnicode && String_eq(nl_langinfo(CODESET), "UTF-8")) {
|
2015-01-22 01:27:31 +00:00
|
|
|
CRT_utf8 = true;
|
2020-11-01 00:09:51 +00:00
|
|
|
} else {
|
2020-08-31 20:08:35 +00:00
|
|
|
CRT_utf8 = false;
|
2020-11-01 00:09:51 +00:00
|
|
|
}
|
2020-09-01 08:09:00 +00:00
|
|
|
#else
|
|
|
|
(void) allowUnicode;
|
2020-08-31 20:08:35 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
CRT_treeStr =
|
|
|
|
#ifdef HAVE_LIBNCURSESW
|
|
|
|
CRT_utf8 ? CRT_treeStrUtf8 :
|
2015-07-17 12:33:34 +00:00
|
|
|
#endif
|
2020-08-31 20:08:35 +00:00
|
|
|
CRT_treeStrAscii;
|
2015-01-22 01:27:31 +00:00
|
|
|
|
2022-05-17 04:53:15 +00:00
|
|
|
CRT_setMouse(settings->enableMouse);
|
2016-02-19 15:38:02 +00:00
|
|
|
|
2020-09-10 17:56:33 +00:00
|
|
|
CRT_degreeSign = initDegreeSign();
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CRT_done() {
|
2021-12-01 03:47:12 +00:00
|
|
|
attron(CRT_colors[RESET_COLOR]);
|
|
|
|
mvhline(LINES - 1, 0, ' ', COLS);
|
|
|
|
attroff(CRT_colors[RESET_COLOR]);
|
|
|
|
refresh();
|
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
curs_set(1);
|
|
|
|
endwin();
|
2020-12-25 10:03:15 +00:00
|
|
|
|
|
|
|
dumpStderr();
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
|
|
|
|
2012-10-19 18:59:48 +00:00
|
|
|
void CRT_fatalError(const char* note) {
|
2020-12-14 14:45:48 +00:00
|
|
|
const char* sysMsg = strerror(errno);
|
2012-10-19 18:59:48 +00:00
|
|
|
CRT_done();
|
|
|
|
fprintf(stderr, "%s: %s\n", note, sysMsg);
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
int CRT_readKey() {
|
|
|
|
nocbreak();
|
|
|
|
cbreak();
|
2006-08-24 21:28:29 +00:00
|
|
|
nodelay(stdscr, FALSE);
|
2006-03-04 18:16:49 +00:00
|
|
|
int ret = getch();
|
2020-11-21 20:40:08 +00:00
|
|
|
halfdelay(*CRT_delay);
|
2006-03-04 18:16:49 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CRT_disableDelay() {
|
|
|
|
nocbreak();
|
|
|
|
cbreak();
|
|
|
|
nodelay(stdscr, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CRT_enableDelay() {
|
2020-11-21 20:40:08 +00:00
|
|
|
halfdelay(*CRT_delay);
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CRT_setColors(int colorScheme) {
|
|
|
|
CRT_colorScheme = colorScheme;
|
2018-02-05 06:01:12 +00:00
|
|
|
|
2020-11-24 16:42:52 +00:00
|
|
|
for (short int i = 0; i < 8; i++) {
|
|
|
|
for (short int j = 0; j < 8; j++) {
|
2021-01-11 11:54:19 +00:00
|
|
|
if (ColorIndex(i, j) != ColorIndexGrayBlack && ColorIndex(i, j) != ColorIndexWhiteDefault) {
|
2020-11-24 16:42:52 +00:00
|
|
|
short int bg = (colorScheme != COLORSCHEME_BLACKNIGHT)
|
2020-10-31 22:28:02 +00:00
|
|
|
? (j == 0 ? -1 : j)
|
2018-02-05 06:01:12 +00:00
|
|
|
: j;
|
2020-10-31 22:28:02 +00:00
|
|
|
init_pair(ColorIndex(i, j), i, bg);
|
2017-05-23 17:02:34 +00:00
|
|
|
}
|
2018-02-05 06:01:12 +00:00
|
|
|
}
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
2018-02-05 06:01:12 +00:00
|
|
|
|
2020-11-24 16:42:52 +00:00
|
|
|
short int grayBlackFg = COLORS > 8 ? 8 : 0;
|
|
|
|
short int grayBlackBg = (colorScheme != COLORSCHEME_BLACKNIGHT) ? -1 : 0;
|
2018-02-05 06:01:12 +00:00
|
|
|
init_pair(ColorIndexGrayBlack, grayBlackFg, grayBlackBg);
|
|
|
|
|
2021-01-11 11:54:19 +00:00
|
|
|
init_pair(ColorIndexWhiteDefault, White, -1);
|
|
|
|
|
2015-02-03 21:30:05 +00:00
|
|
|
CRT_colors = CRT_colorSchemes[colorScheme];
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
2020-10-03 15:53:15 +00:00
|
|
|
|
2021-05-16 18:45:09 +00:00
|
|
|
#ifdef PRINT_BACKTRACE
|
|
|
|
static void print_backtrace(void) {
|
|
|
|
#if defined(HAVE_LIBUNWIND_H) && defined(HAVE_LIBUNWIND)
|
|
|
|
unw_context_t context;
|
|
|
|
unw_getcontext(&context);
|
|
|
|
|
|
|
|
unw_cursor_t cursor;
|
|
|
|
unw_init_local(&cursor, &context);
|
|
|
|
|
|
|
|
unsigned int item = 0;
|
|
|
|
|
|
|
|
while (unw_step(&cursor) > 0) {
|
|
|
|
unw_word_t pc;
|
|
|
|
unw_get_reg(&cursor, UNW_REG_IP, &pc);
|
|
|
|
if (pc == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
char symbolName[256] = "?";
|
|
|
|
unw_word_t offset = 0;
|
|
|
|
unw_get_proc_name(&cursor, symbolName, sizeof(symbolName), &offset);
|
|
|
|
|
|
|
|
unw_proc_info_t pip;
|
|
|
|
pip.unwind_info = NULL;
|
|
|
|
|
|
|
|
const char* fname = "?";
|
|
|
|
const void* ptr = 0;
|
|
|
|
if (unw_get_proc_info(&cursor, &pip) == 0) {
|
|
|
|
ptr = (const void*)(pip.start_ip + offset);
|
|
|
|
|
|
|
|
#ifdef HAVE_DLADDR
|
|
|
|
Dl_info dlinfo;
|
|
|
|
if (dladdr(ptr, &dlinfo) && dlinfo.dli_fname && *dlinfo.dli_fname)
|
|
|
|
fname = dlinfo.dli_fname;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* frame = "";
|
|
|
|
if (unw_is_signal_frame(&cursor) > 0)
|
|
|
|
frame = "{signal frame}";
|
|
|
|
|
|
|
|
fprintf(stderr, "%2u: %#14lx %s (%s+%#lx) [%p]%s%s\n", item++, pc, fname, symbolName, offset, ptr, frame ? " " : "", frame);
|
|
|
|
}
|
|
|
|
#elif defined(HAVE_EXECINFO_H)
|
|
|
|
void* backtraceArray[256];
|
|
|
|
|
|
|
|
size_t size = backtrace(backtraceArray, ARRAYSIZE(backtraceArray));
|
|
|
|
backtrace_symbols_fd(backtraceArray, size, STDERR_FILENO);
|
|
|
|
#else
|
|
|
|
#error No implementation for print_backtrace()!
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-10-03 15:53:15 +00:00
|
|
|
void CRT_handleSIGSEGV(int signal) {
|
|
|
|
CRT_done();
|
|
|
|
|
|
|
|
fprintf(stderr, "\n\n"
|
|
|
|
"FATAL PROGRAM ERROR DETECTED\n"
|
|
|
|
"============================\n"
|
|
|
|
"Please check at https://htop.dev/issues whether this issue has already been reported.\n"
|
|
|
|
"If no similar issue has been reported before, please create a new issue with the following information:\n"
|
2021-08-08 17:47:17 +00:00
|
|
|
" - Your "PACKAGE" version: '"VERSION"'\n"
|
|
|
|
" - Your OS and kernel version (uname -a)\n"
|
|
|
|
" - Your distribution and release (lsb_release -a)\n"
|
|
|
|
" - Likely steps to reproduce (How did it happen?)\n"
|
2021-01-08 12:51:21 +00:00
|
|
|
);
|
|
|
|
|
2021-05-16 18:45:09 +00:00
|
|
|
#ifdef PRINT_BACKTRACE
|
2021-08-08 17:47:17 +00:00
|
|
|
fprintf(stderr, " - Backtrace of the issue (see below)\n");
|
2020-10-03 15:53:15 +00:00
|
|
|
#endif
|
2021-01-08 12:51:21 +00:00
|
|
|
|
|
|
|
fprintf(stderr,
|
2020-10-03 15:53:15 +00:00
|
|
|
"\n"
|
|
|
|
);
|
|
|
|
|
|
|
|
const char* signal_str = strsignal(signal);
|
2020-10-31 19:52:20 +00:00
|
|
|
if (!signal_str) {
|
2020-10-03 15:53:15 +00:00
|
|
|
signal_str = "unknown reason";
|
|
|
|
}
|
|
|
|
fprintf(stderr,
|
|
|
|
"Error information:\n"
|
|
|
|
"------------------\n"
|
|
|
|
"A signal %d (%s) was received.\n"
|
|
|
|
"\n",
|
|
|
|
signal, signal_str
|
|
|
|
);
|
|
|
|
|
2021-05-16 17:55:31 +00:00
|
|
|
fprintf(stderr,
|
|
|
|
"Setting information:\n"
|
|
|
|
"--------------------\n");
|
|
|
|
Settings_write(CRT_crashSettings, true);
|
2021-08-08 17:47:17 +00:00
|
|
|
fprintf(stderr, "\n\n");
|
2021-05-16 17:55:31 +00:00
|
|
|
|
2021-05-16 18:45:09 +00:00
|
|
|
#ifdef PRINT_BACKTRACE
|
2020-10-03 15:53:15 +00:00
|
|
|
fprintf(stderr,
|
|
|
|
"Backtrace information:\n"
|
|
|
|
"----------------------\n"
|
|
|
|
);
|
|
|
|
|
2021-05-16 18:45:09 +00:00
|
|
|
print_backtrace();
|
2020-10-03 15:53:15 +00:00
|
|
|
|
|
|
|
fprintf(stderr,
|
|
|
|
"\n"
|
2021-08-08 17:47:17 +00:00
|
|
|
"To make the above information more practical to work with, "
|
|
|
|
"please also provide a disassembly of your "PACKAGE" binary. "
|
2020-10-03 15:53:15 +00:00
|
|
|
"This can usually be done by running the following command:\n"
|
|
|
|
"\n"
|
2021-01-08 12:51:21 +00:00
|
|
|
);
|
|
|
|
|
2020-10-03 15:53:15 +00:00
|
|
|
#ifdef HTOP_DARWIN
|
2021-06-10 01:28:24 +00:00
|
|
|
fprintf(stderr, " otool -tvV `which "PACKAGE"` > ~/htop.otool\n");
|
2020-10-03 15:53:15 +00:00
|
|
|
#else
|
2021-06-10 01:28:24 +00:00
|
|
|
fprintf(stderr, " objdump -d -S -w `which "PACKAGE"` > ~/htop.objdump\n");
|
2020-10-03 15:53:15 +00:00
|
|
|
#endif
|
2021-01-08 12:51:21 +00:00
|
|
|
|
|
|
|
fprintf(stderr,
|
2020-10-03 15:53:15 +00:00
|
|
|
"\n"
|
|
|
|
"Please include the generated file in your report.\n"
|
|
|
|
);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
fprintf(stderr,
|
|
|
|
"Running this program with debug symbols or inside a debugger may provide further insights.\n"
|
|
|
|
"\n"
|
2021-06-10 01:28:24 +00:00
|
|
|
"Thank you for helping to improve "PACKAGE"!\n"
|
2020-10-03 15:53:15 +00:00
|
|
|
"\n"
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Call old sigsegv handler; may be default exit or third party one (e.g. ASAN) */
|
2020-10-31 19:52:20 +00:00
|
|
|
if (sigaction (signal, &old_sig_handler[signal], NULL) < 0) {
|
2020-10-03 15:53:15 +00:00
|
|
|
/* This avoids an infinite loop in case the handler could not be reset. */
|
|
|
|
fprintf(stderr,
|
|
|
|
"!!! Chained handler could not be restored. Forcing exit.\n"
|
|
|
|
);
|
|
|
|
_exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Trigger the previous signal handler. */
|
|
|
|
raise(signal);
|
|
|
|
|
|
|
|
// Always terminate, even if installed handler returns
|
|
|
|
fprintf(stderr,
|
|
|
|
"!!! Chained handler did not exit. Forcing exit.\n"
|
|
|
|
);
|
|
|
|
_exit(1);
|
|
|
|
}
|