Commit Graph

320 Commits

Author SHA1 Message Date
1a13b4d0f4 Don't store invisible trailing whitespace 2016-06-15 12:41:50 -03:00
e77811e99b any of these values may wrap 2016-02-29 21:57:03 -03:00
797bcd0961 Catch invalid IO values due to no permissions.
Display them properly. Not fully convinced of the "no perm" message...
2016-02-20 02:23:26 -02:00
baec4bdcb0 Try to retain last full name of a zombie process.
Once a process goes zombie on Linux, /proc/PID/cmdline
gets empty. So, when we detect it is a zombie we stop
reading this file.
For processes that were zombies before htop started,
there's no way to get the full name.
Closes #49.
2016-02-19 20:51:57 -02:00
e0c364b9cc Fix reading of io_syscr and io_syscw.
Issue noticed by GCC6 -Wmisleading-indentation.
Thanks @JIghtuse and @Explorer09!
Closes #409.
2016-02-16 14:34:25 -02:00
35657208d7 Disable the syscall on systems that don't have it.
Got a report in #397 that htop runs in NetBSD
masquerading as Linux and using a compatibility /proc
(like we used to in FreeBSD) and that it builds fine
apart from this syscall.
2016-02-14 12:05:35 -02:00
0b70439316 Fix buffer reuse. 2016-02-13 02:18:28 -02:00
b2c2b2bfb3 Merge branch 'reuse-comm' 2016-02-02 15:58:50 +01:00
1cfcc42a8f Reuse comm object if possible, avoid useless repetitions of free+strdup. 2016-02-02 15:56:52 +01:00
b54d2dde40 Check for failure in allocations. 2016-02-02 15:53:02 +01:00
6dae8108f8 Introduce CLAMP macro. Unify all MIN(MAX(a,b),c) uses.
With the CLAMP macro replacing the combination of MIN and MAX, we will
have at least two advantages:
1. It's more obvious semantically.
2. There are no more mixes of confusing uses like MIN(MAX(a,b),c) and
   MAX(MIN(a,b),c) and MIN(a,MAX(b,c)) appearing everywhere. We unify
   the 'clamping' with a single macro.
Note that the behavior of this CLAMP macro is different from
the combination `MAX(low,MIN(x,high))`.
* This CLAMP macro expands to two comparisons instead of three from
  MAX and MIN combination. In theory, this makes the code slightly
  smaller, in case that (low) or (high) or both are computed at
  runtime, so that compilers cannot optimize them. (The third
  comparison will matter if (low)>(high); see below.)
* CLAMP has a side effect, that if (low)>(high) it will produce weird
  results. Unlike MIN & MAX which will force either (low) or (high) to
  win. No assertion of ((low)<=(high)) is done in this macro, for now.

This CLAMP macro is implemented like described in glib
<http://developer.gnome.org/glib/stable/glib-Standard-Macros.html>
and does not handle weird uses like CLAMP(a++, low++, high--) .
2016-01-15 20:26:01 +08:00
b10e54cdee Merge remote-tracking branch 'upstream/master' into envscreen 2016-01-06 22:39:57 +01:00
be9edc5d43 Merge branch 'master' of https://github.com/hishamhm/htop 2016-01-03 16:32:48 -02:00
7170382706 Fix spelling of "maintainer" 2016-01-02 12:11:26 -05:00
802e216870 Extend buffer for reading lines from /proc.
Apparently a line longer than 255 chars was spotted in the wild:
http://serverfault.com/questions/577939/linux-ps-htop-show-processes-running-for-hundreds-or-thousands-of-days-though-h#comment676098_577939
2015-12-14 13:27:11 -02:00
cc23d13f87 Add Platform_getProcessEnv
- currently implemented for darwin and linux
2015-12-03 22:23:40 +01:00
a84aa2e782 Cached memory calculations, take 2.
Thanks to @OmegaPhil for discussion and reviewing.
2015-11-29 23:55:31 -02:00
5bc1f5ed04 Account unreclaimable slab and shmem as used memory,
reclaimable slab as cached memory.

Hopefully this presents a more truthful representation of
available vs. used memory on Linux.
See brndnmtthws/conky#82, #242, #67, #263.
2015-11-28 22:22:00 -02:00
b669540e4e Merge pull request #298 from patrickmarlier/issue202
Fix a case where the usertime calculation can overflow (see issue #202)
2015-10-26 17:55:13 -04:00
71190654bc Calculate CPU averages on Darwin (See #295). 2015-10-23 13:46:21 -02:00
93f05b459f fixed broken merge, where I forgot to check linux/Platform.c so that it matches upstream 2015-10-06 20:05:55 +02:00
2379835910 Added platform dependent DEFAULT_SIGNAL define, for now for:
FreeBSD
Linux
Other platforms will have it undefined for now.
2015-10-06 14:04:22 +02:00
3fe2f3e28e Move list of signals to platform-specific code.
Implementations for Linux (tested) and FreeBSD (still untested, thanks to @etosan for providing the table).
Darwin and OpenBSD(ping @mmcco) builds should be broken now, pending their own tables.
2015-10-06 03:02:49 -03:00
b37d4f172f Fix a case where the usertime calculation can overflow (see issue #202) 2015-09-14 22:51:14 +02:00
e8970b6f32 fix calloc() calls
* size_t nmemb (number of elements) first, then size_t size
* do not assume char is size 1 but use sizeof()
* allocate for char, not pointer to char (found by Michael McConville,
  fixes #261)
2015-09-07 07:52:39 +02:00
5e4f1e46cc Reduce scope of variables. 2015-08-20 01:12:34 -03:00
9428010121 Make column width calculation dynamic.
Closes #228.
2015-08-20 00:32:47 -03:00
5e602f18d5 Rename String to StringUtils.
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-19 13:45:20 -03:00
e42d78007e Merge pull request #230 from maksqwe/cstime_fix
Fix sort by cstime
2015-08-12 17:08:26 -03:00
6f6f0e36ad Fix typo in comment 2015-08-04 18:48:34 +05:00
1bdee6b6ba Fix sort by cstime 2015-07-23 14:24:39 +03:00
08829cbc3b fix compiler warnings
gcc gives warnings like this:

warning: ignoring return value of ‘fscanf’, declared with attribute
warn_unused_result

Assign value to a variable, cast to (void) to discard it.
2015-05-15 11:33:25 +02:00
f4f6d54ffd Fix compilation of OpenVZ support.
Closes #185.
Closes #190.
2015-05-13 15:00:58 -03:00
2f45008477 Enable OOM support unconditionally on Linux.
Read OOM data only if column is enabled.
Make sort ordering more consistent. Closes #182.
2015-04-09 15:41:21 -03:00
b291fba02b Fixes to use platform-specific compare routines. 2015-04-09 15:40:46 -03:00
d880def0e9 Merge branch 'master' into wip
Conflicts:
	Process.c
	Process.h
	htop.c
	linux/LinuxProcess.c
	linux/LinuxProcess.h
	test_spec.lua
2015-04-02 01:57:37 -03:00
4c24a9b462 Fixes to subclassing Process. 2015-03-31 23:23:10 -03:00
7cb8cb05fb Simplify constructors. 2015-03-23 19:24:34 -03:00
d0c72c3fb2 Move FunctionBar inside Panel 2015-03-23 15:26:56 -03:00
4e064e0db7 Build fixes to resync with FreeBSD changes. 2015-03-16 23:03:40 -03:00
272e2d9b34 Major advances in FreeBSD port. 2015-03-16 23:02:03 -03:00
7fd4af80ff Linux build fixes. 2015-03-16 03:25:43 -03:00
5c8b83405b Merge branch 'master' into wip
Conflicts:
	Process.c
	Process.h
	linux/LinuxProcess.c
	linux/LinuxProcess.h
	linux/LinuxProcessList.c
	unsupported/Platform.c
	unsupported/Platform.h
2015-03-16 03:22:33 -03:00
adbfe3c3f1 Get FreeBSD tree to compile again with latest changes. 2015-03-16 03:14:20 -03:00
be1700cf94 Isolate portable and Linux-specific process fields. 2015-03-16 01:43:04 -03:00
e3fe3962cb Move more Linux-specific code into Linux subdir. 2015-03-15 20:29:13 -03:00
e7d6eb6a82 Fix deletion of processes. Closes #172.
Conflicts:
	linux/LinuxProcess.c
2015-03-08 19:52:28 -03:00
a4b03e8875 Improve reading of cgroups. 2015-03-08 19:47:49 -03:00
39a725abc2 Fix deletion of processes. Closes #172. 2015-03-08 19:45:56 -03:00
0a184b769f Merge fixes 2015-02-23 03:53:36 -03:00