summaryrefslogtreecommitdiffstats
path: root/Process.c
AgeCommit message (Collapse)Author
2020-08-25Avoid discarding const qualifiersChristian Göttsche
2020-08-20Merge branch 'hishamhm-pull-960'Nathan Scott
2020-08-20Merge branch 'hishamhm-pull-872'Nathan Scott
2020-08-20Merge branch 'hishamhm-pull-866'Nathan Scott
2020-08-20Resolve compiler warnings and errors relating to the Arg unionNathan Scott
Promote the Arg union to a core data type in Object.c such that it is visible everywhere (many source files need it), and correct declarations of several functions that use it. The Process_sendSignal function is also corrected to have the expected return type (bool, not void) - an error being masked by ignoring this not-quite-harmless warning. I've also added error checking to the kill(2) call here, which was previously overlooked / missing (?).
2020-08-19Merge branch 'hishamhm-pull-869'Nathan Scott
2020-08-18Merge branch 'hishamhm-pull-842'Nathan Scott
2019-10-31Clean up existing whitespaceDaniel Flanagan
2019-06-14Fix configure 'major' workaround causing <sys/sysmacros.h> to miss.Explorer09
A logic mistake in pull request #746 causes <sys/sysmacro.h> to be *not* included when AC_HEADER_MAJOR (before autoconf-2.70) finds 'major' in <sys/types.h>. Though this would still build htop, it would still bring deprecation warning in systems using glibc 2.25-2.27. Fix the logic and suppress the warning. Also, include config.h in Process.c for the sake of strengthening the code. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2019-02-10Return of snprintf is not the number of written bytesHisham Muhammad
2019-02-10Fix printf() unsigned placeholdersAlan Barr
Unsigned numbers should be using "%u". Raised by cppcheck
2018-12-30Deal with larger numbers in colorNumber and outputRateadrien1018
2018-12-18Fix numbers larger than 100 terabytesadrien1018
2018-12-15Remove unnecessary HAVE_SYS_SYSMACROS_H checkWataru Ashihara
HAVE_SYS_SYSMACROS_H is always true if MAJOR_IN_SYSMACROS. This way of checking is recommended in autoconf 2.70 documentation: https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blobdiff;f=doc/autoconf.texi;h=4f041bd4e;hp=9ad7dc1c5f02c8ba25b2fe1218bf931c7113a5d5;hb=e17a30e987d7ee695fb4294a82d987ec3dc9b974;hpb=565a6dc50cfa01cec2fb4db894026689cdf4970c NOTE: currently https://www.gnu.org/software/autoconf/manual/autoconf.html is the doc for autoconf 2.69.
2018-10-30Fix printf() unsigned placeholdersAlan Barr
Unsigned numbers should be using "%u". Raised by cppcheck
2018-10-07Widen ST_UID (UID) column to 5 chars to allow UIDs > 9999 without breaking ↵Daniel Lange
alignment Issue Github #841, Debian bug #910492
2018-04-05Collapse current subtree pressing BackspaceHisham Muhammad
2018-02-26Fix build failure ('major' undefined) in glibc 2.28. (#746)Kang-Che Sung (宋岡哲)
glibc 2.28 no longer defines 'major' and 'minor' in <sys/types.h> and requires us to include <sys/sysmacros.h>. (glibc 2.25 starts deprecating the macros in <sys/types.h>.) Now do include the latter if found on the system. At the moment, let's also utilize AC_HEADER_MAJOR in configure script. However as Autoconf 2.69 has not yet updated the AC_HEADER_MAJOR macro to reflect the glibc change [1], so add a workaround code. Fixes #663. Supersedes pull request #729. Reference: [1] https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commit;h=e17a30e987d7ee695fb4294a82d987ec3dc9b974 Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-02-18Replace size_t with int/void* unionHisham Muhammad
I was occasionally passing negative values to size_t. Plus, this better reflects the intent of the variant argument. Reported by Coverity: https://scan8.coverity.com/reports.htm#v13253/p10402/fileInstanceId=22093891&defectInstanceId=7543346&mergedDefectId=174179&fileStart=251&fileEnd=500
2018-02-04Add support for Linux TASK_IDLEVladimir Panteleev
Linux commit 06eb61844d841d0032a9950ce7f8e783ee49c0d0 ("sched/debug: Add explicit TASK_IDLE printing") exposes kthreads idling using TASK_IDLE in procfs as "I (idle)". Until now, when sorting the STATE ("S") column, htop used the raw value of the state character for comparison, however that led to the undesirable effect of TASK_IDLE ('I') tasks being sorted above tasks that were running ('R'). Thus, explicitly recognize the idle process state, and sort it below others.
2017-09-14Make 'c' key work with threads as well.Hisham Muhammad
2017-07-27Security review: check results of snprintf.Hisham Muhammad
Calls marked with xSnprintf shouldn't fail. Abort program cleanly if any of them does.
2017-07-26Security review: make privilege dropping-restoring optional.Hisham Muhammad
This is/was necessary only on macOS, because you needed root in order to read the process list. This was never necessary on Linux, and it also raises security concerns, so now it needs to be enabled explicitly at build time.
2017-07-10Add "no perm" status when other fields fail due to lack of permission.Hisham Muhammad
Thanks @Sworddragon for the heads up. See #88.
2016-12-29Replace all uses of sprintf with snprintfTomasz Kramkowski
In all the cases where sprintf was being used within htop, snprintf could have been used. This patch replaces all uses of sprintf with snprintf which makes sure that if a buffer is too small to hold the resulting string, the string is simply cut short instead of causing a buffer overflow which leads to undefined behaviour. `sizeof(variable)` was used in these cases, as opposed to `sizeof variable` which is my personal preference because `sizeof(variable)` was already used in one way or another in other parts of the code.
2016-10-01Interpret TTY_NR column on Linux,Hisham
translate dev_t to major:minor on other platforms. Closes #316.
2016-09-06Fix column misalignment for priority -101 threadsIvan Kozik
BFS-patched kernels can have kernel threads with priority -101. This change makes priority -101 display as "RT", just like priority -100. Related: https://github.com/hishamhm/htop/issues/314
2016-06-20Let's keep it simple then!Hisham
2016-06-19While we're at it, get rid of another sprintf.Hisham
2016-05-30Silence cast warning.Hisham
2016-05-25Silence warnings about seteuid return value.Hisham
Closes #483.
2016-05-04Fix a small undefined behavior detected by libubsan.Hisham
2016-02-20Catch invalid IO values due to no permissions.Hisham
Display them properly. Not fully convinced of the "no perm" message...
2016-02-10Support -1 as tpgidHisham
2016-02-02Reuse comm object if possible, avoid useless repetitions of free+strdup.Hisham
2015-12-07drop privileges before changing process priority or sending signalsMichael Klein
- replaces uid check from d18e9a4895599a479df264a6c7380b8805abb434
2015-12-02add some security checks when running SUID rootMichael Klein
on Darwin, htop needs to run with root privileges to display information about other users processes. This commit makes running htop SUID root a bit more safe.
2015-08-20Make column width calculation dynamic.Hisham Muhammad
Closes #228.
2015-08-19Rename String to StringUtils.David Hunt
Fixes building on case-insensitive filesystems where String.h gets confused with <string.h>. From d734dacea0a10d0465dad4e95b3421511e7da112 Mon Sep 17 00:00:00 2001 From: David Hunt <dhunt@iolanthe.attlocal.net> Date: Sat, 11 Jul 2015 20:56:31 -0500 Subject: [PATCH 1/8] Rename String to StringUtils
2015-08-07New setting: "Show program path"Tobias Geerinckx-Rice
Add a setting to hide all but the last component from the programme path, leaving only the "basename". Makes htop more usable on smaller screens, or systems with longer than average paths. Off by default. "Highlight program basename" will still be respected, to further visually separate process names from their arguments.
2015-05-20added missing defines for androidsherpya
2015-04-02Merge branch 'master' into wipHisham Muhammad
Conflicts: Process.c Process.h htop.c linux/LinuxProcess.c linux/LinuxProcess.h test_spec.lua
2015-03-31Fixes to subclassing Process.Hisham Muhammad
2015-03-23Tempus fugit.Hisham Muhammad
Conflicts: htop.c htop.h
2015-03-21Tempus fugit.Hisham Muhammad
2015-03-16Major advances in FreeBSD port.Hisham Muhammad
2015-03-16Isolate portable and Linux-specific process fields.Hisham Muhammad
2015-03-15Move more Linux-specific code into Linux subdir.Hisham Muhammad
2015-02-23Merge fixesHisham Muhammad
2015-02-23Fix allocation of processes. Closes #166.Hisham Muhammad
Conflicts: Process.c Process.h ProcessList.c ScreenManager.c linux/LinuxProcessList.c