Skip to content

Commit dde7720

Browse files
committed
Squashed 'vendor/github.com/htop-dev/htop/' changes from 76989e4c75..a90081c195
a90081c195 Merge branch 'main' of github.com:htop-dev/htop 8620f7051f Merge branch 'skip-md-and-loop-block-devices' 6142cbbb17 Merge pull request #1802 from Explorer09/gpu-meter-text 71ff8604ab Skip loopback and MD (multi-device) driver entries in /proc/diskstats ffc1093aea Cross-platform fixes to use units-based scaling in pcp-htop 74d7d52cf8 Type related fixes for a clean pcp-htop build on macOS 5b1c353492 Adjust GPUMeter text display 3df29214a3 Avoid double assignment in code style 8fb1d51699 Merge pull request #1799 from Explorer09/configure-compat 26a41987ef build: Fix Autoconf 2.69 compatibility regressions c85222d438 Merge pull request #1754 from unrealapex/foot 1afb26b765 Merge pull request #1795 from Explorer09/configure-curses-header 3063ccc050 build: Simplify curses header checking code d698e87b99 Merge pull request #1791 from Explorer09/configure-libunwind d5228083b6 build: Also check libunwind through pkg-config db199ce45c build: Use HTOP_PKG_CHECK_MODULES in hwloc and libnl checking cf2479df93 build: Introduce HTOP_PKG_CHECK_MODULES wrapper macro 183db6c2fd build: Check unw_init_local() with custom test. bf17a7e993 Merge pull request #1790 from Explorer09/ax-check-compile-flag 1fbbb2daf5 build: Update ax_check_compile_flag module 09ba4c19b9 Reapply "build: Improve '-Wextra-semi-stmt' warning option check" c73f89464a Merge pull request #1779 from Explorer09/configure-libunwind e136be5368 Merge pull request #1789 from n0099/main 63d02fa2ed Shadow path prefixes that used by NixOS 95a1ebe300 build: configure code indent tweaks 924aa4d279 build: Add configure check on whether local unwinding works 2a2709602e build: Rearrange libunwind.h detection code in configure de6de258a6 build: Link with unw_init_local() when checking libunwind 18b46ead1b Merge pull request #1787 from Explorer09/configure-extra-semi-stmt 97073ba86e build: Improve '-Wextra-semi-stmt' warning option check 79785e88c6 Merge pull request #1598 from Explorer09/init-degree-sign a52b43bbab Correct CRT_degreeSign buffer size & reduce code size e896ab4ff1 docs: fix COLORS bullet list formatting and capitalization in man page 57b34bf5d7 Update CI to use OpenBSD 7.7 (i.e. fix builds) ee1d1a840d Avoid pivotIndex overflow in (Vector) quickSort 31eaa551f1 Merge pull request #1786 from htop-dev/dependabot/github_actions/github/codeql-action-4 a5e5d088f9 Merge pull request #1782 from Explorer09/vector-dirty f019ba9086 Bump github/codeql-action from 3 to 4 9367364d88 Rework Vector_softRemove() and compact() operations 44e3cddb18 Table_cleanupRow() logic tweak ad475ec16c Hard-code Vector default size; avoid using -1 flag 818d01be44 Merge pull request #1721 from Explorer09/graph-dynamic-scale 496b3fb7fd NetworkIOMeter: remove code for auto-updating "total" 8b4b19552d TasksMeter: remove code for auto-updating "total" 5f9af8dd24 Adjust LoadAverageMeter "total" assignment 314a57ac34 Graph meter dynamic scaling and percent graph drawing 1dbae33d15 Update "total" value for non-percent bar meters 7a9ecebf22 Introduce isPercentChart member in MeterClass 5b2f4d5cef Merge branch 'BenBE-asprintf-fixes' ecfc2517b6 Merge branch 'asprintf-fixes' of github.com:BenBE/htop into BenBE-asprintf-fixes f4d04750d7 Merge branch 'Explorer09-xsnprintf-len' 7c6c9d3705 Merge branch 'xsnprintf-len' of github.com:Explorer09/htop-1 into Explorer09-xsnprintf-len 0e2eed0562 Merge branch 'natoscott-darwin-ci-fixes' 7e6e363f2b Merge branch 'darwin-ci-fixes' of github.com:natoscott/htop into natoscott-darwin-ci-fixes 0919bdd301 Transition several more byte length or offsets to size_t for macOS CI 7cb56cd317 Resolve implicit 64 to 32 bit int downgrade warning on nice level 21a0329d26 Explicitly cast to system types where needed (dev_t, uid_t, pid_t) c148e4fd4b Clamp buffer length at INT_MAX in xSnprintf 635527a93e Ensure defined state of strp in xAsprintf 0d7f9d5f36 Reuse string buffer for second TTY driver path 823d23b0ed Ensure properly initialized memory passed into xAsprintf 4c99f0ec61 Add foot terminal to terminalSupportsDefinedKeys git-subtree-dir: vendor/github.com/htop-dev/htop git-subtree-split: a90081c19574eea7eacb7f29e9293d4cbde48aa4
1 parent 6a63dbc commit dde7720

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1212
-668
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ jobs:
294294
- name: Compile
295295
uses: vmactions/openbsd-vm@v1
296296
with:
297-
release: '7.6'
297+
release: '7.7'
298298
usesh: true
299299
prepare: |
300300
pkg_add gmake git

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
uses: actions/checkout@v5
3030

3131
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@v3
32+
uses: github/codeql-action/init@v4
3333
with:
3434
languages: cpp
3535

@@ -46,4 +46,4 @@ jobs:
4646
run: make
4747

4848
- name: Perform CodeQL Analysis
49-
uses: github/codeql-action/analyze@v3
49+
uses: github/codeql-action/analyze@v4

AffinityPanel.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static MaskItem* MaskItem_newMask(const char* text, const char* indent, hwloc_bi
9696
this->ownCpuset = owner;
9797
this->cpuset = cpuset;
9898
this->sub_tree = hwloc_bitmap_weight(cpuset) > 1 ? 1 : 0;
99-
this->children = Vector_new(Class(MaskItem), true, DEFAULT_SIZE);
99+
this->children = Vector_new(Class(MaskItem), true, VECTOR_DEFAULT_SIZE);
100100
return this;
101101
}
102102

@@ -107,7 +107,7 @@ static MaskItem* MaskItem_newSingleton(const char* text, int cpu, bool isSet) {
107107
this->text = xStrdup(text);
108108
this->indent = NULL; /* not a tree node */
109109
this->sub_tree = 0;
110-
this->children = Vector_new(Class(MaskItem), true, DEFAULT_SIZE);
110+
this->children = Vector_new(Class(MaskItem), true, VECTOR_DEFAULT_SIZE);
111111

112112
#ifdef HAVE_LIBHWLOC
113113
this->ownCpuset = true;
@@ -381,7 +381,7 @@ Panel* AffinityPanel_new(Machine* host, const Affinity* affinity, int* width) {
381381
* but this will be added by the caller */
382382
this->width = 14;
383383

384-
this->cpuids = Vector_new(Class(MaskItem), true, DEFAULT_SIZE);
384+
this->cpuids = Vector_new(Class(MaskItem), true, VECTOR_DEFAULT_SIZE);
385385

386386
#ifdef HAVE_LIBHWLOC
387387
this->topoView = host->settings->topologyAffinity;

BatteryMeter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const MeterClass BatteryMeter_class = {
6464
.defaultMode = TEXT_METERMODE,
6565
.supportedModes = METERMODE_DEFAULT_SUPPORTED,
6666
.maxItems = 1,
67+
.isPercentChart = true,
6768
.total = 100.0,
6869
.attributes = BatteryMeter_attributes,
6970
.name = "Battery",

CPUMeter.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,10 @@ static void CPUMeterCommonInit(Meter* this) {
241241

242242
CPUMeterData* data = this->meterData;
243243
if (!data) {
244-
data = this->meterData = xMalloc(sizeof(CPUMeterData));
244+
data = xCalloc(1, sizeof(CPUMeterData));
245245
data->cpus = this->host->existingCPUs;
246246
data->meters = count ? xCalloc(count, sizeof(Meter*)) : NULL;
247+
this->meterData = data;
247248
}
248249

249250
Meter** meters = data->meters;
@@ -352,6 +353,7 @@ const MeterClass CPUMeter_class = {
352353
.defaultMode = BAR_METERMODE,
353354
.supportedModes = METERMODE_DEFAULT_SUPPORTED,
354355
.maxItems = CPU_METER_ITEMCOUNT,
356+
.isPercentChart = true,
355357
.total = 100.0,
356358
.attributes = CPUMeter_attributes,
357359
.name = "CPU",

CRT.c

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ in the source distribution for its full text.
1212
#include <errno.h>
1313
#include <fcntl.h>
1414
#include <langinfo.h>
15+
#include <limits.h>
1516
#include <signal.h>
1617
#include <stdarg.h>
1718
#include <stdio.h>
@@ -28,7 +29,7 @@ in the source distribution for its full text.
2829
#include <sys/mman.h>
2930
#endif
3031

31-
#if defined(HAVE_LIBUNWIND_H) && defined(HAVE_LIBUNWIND)
32+
#if defined(HAVE_LIBUNWIND_H) && defined(HAVE_LOCAL_UNWIND)
3233
# define PRINT_BACKTRACE
3334
# define UNW_LOCAL_ONLY
3435
# include <libunwind.h>
@@ -94,21 +95,31 @@ const char* const* CRT_treeStr = CRT_treeStrAscii;
9495

9596
static const Settings* CRT_settings;
9697

97-
const char* CRT_degreeSign;
98+
#ifdef HAVE_LIBNCURSESW
99+
# if MB_LEN_MAX >= 3 // Minimum required to support UTF-8 BMP subset
100+
char CRT_degreeSign[MB_LEN_MAX * 2] = "\xc2\xb0";
101+
# else
102+
char CRT_degreeSign[MB_LEN_MAX * 2] = "";
103+
# endif
104+
#else
105+
char CRT_degreeSign[] = "";
106+
#endif
98107

99-
static const char* initDegreeSign(void) {
108+
static void initDegreeSign(void) {
100109
#ifdef HAVE_LIBNCURSESW
110+
# if MB_LEN_MAX >= 3
101111
if (CRT_utf8)
102-
return "\xc2\xb0";
112+
return;
113+
# endif
103114

104-
static char buffer[4];
105115
// this might fail if the current locale does not support wide characters
106-
int r = snprintf(buffer, sizeof(buffer), "%lc", 176);
107-
if (r > 0)
108-
return buffer;
116+
int r = snprintf(CRT_degreeSign, sizeof(CRT_degreeSign), "%lc", 176);
117+
if (r <= 0 || (size_t)r >= sizeof(CRT_degreeSign))
118+
CRT_degreeSign[0] = '\0';
109119
#endif
110120

111-
return "";
121+
// No-op
122+
return;
112123
}
113124

114125
const int* CRT_colors;
@@ -1131,6 +1142,11 @@ static bool terminalSupportsDefinedKeys(const char* termType) {
11311142
return true;
11321143
}
11331144
break;
1145+
case 'f':
1146+
if (String_eq(termType, "foot")) {
1147+
return true;
1148+
}
1149+
break;
11341150
case 's':
11351151
if (termType[1] == 't' && IS_END_OR_DASH(termType[2])) {
11361152
return true;
@@ -1265,7 +1281,7 @@ IGNORE_WCASTQUAL_END
12651281

12661282
CRT_setMouse(settings->enableMouse);
12671283

1268-
CRT_degreeSign = initDegreeSign();
1284+
initDegreeSign();
12691285
}
12701286

12711287
void CRT_done(void) {
@@ -1335,7 +1351,7 @@ void CRT_setColors(int colorScheme) {
13351351

13361352
#ifdef PRINT_BACKTRACE
13371353
static void print_backtrace(void) {
1338-
#if defined(HAVE_LIBUNWIND_H) && defined(HAVE_LIBUNWIND)
1354+
#if defined(HAVE_LIBUNWIND_H) && defined(HAVE_LOCAL_UNWIND)
13391355
unw_context_t context;
13401356
unw_getcontext(&context);
13411357

CRT.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void CRT_handleSIGSEGV(int signal) ATTR_NORETURN;
182182
#define KEY_FOCUS_OUT (KEY_MAX + 'O')
183183
#define KEY_DEL_MAC 127
184184

185-
extern const char* CRT_degreeSign;
185+
extern char CRT_degreeSign[];
186186

187187
#ifdef HAVE_LIBNCURSESW
188188

CommandLine.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static CommandLineStatus parseArguments(int argc, char** argv, CommandLineSettin
209209
fprintf(stderr, "Error: invalid user \"%s\".\n", username);
210210
return STATUS_ERROR_EXIT;
211211
}
212-
flags->userId = atol(username);
212+
flags->userId = (uid_t)atol(username);
213213
}
214214
break;
215215
}

DiskIOMeter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ const MeterClass DiskIOMeter_class = {
158158
.defaultMode = TEXT_METERMODE,
159159
.supportedModes = METERMODE_DEFAULT_SUPPORTED,
160160
.maxItems = 1,
161+
.isPercentChart = true,
161162
.total = 1.0,
162163
.attributes = DiskIOMeter_attributes,
163164
.name = "DiskIO",

FileDescriptorMeter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const MeterClass FileDescriptorMeter_class = {
110110
.defaultMode = TEXT_METERMODE,
111111
.supportedModes = METERMODE_DEFAULT_SUPPORTED,
112112
.maxItems = 2,
113+
.isPercentChart = false,
113114
.total = 65536.0,
114115
.attributes = FileDescriptorMeter_attributes,
115116
.name = "FileDescriptors",

0 commit comments

Comments
 (0)