Commit Graph

1805 Commits

Author SHA1 Message Date
Hisham Muhammad 19f0f4db27 Merge pull request #488 from Explorer09/func-naming
Rename Meter.setValues() functions to updateValues()
2016-05-04 15:18:52 -03:00
Explorer09 9dea20e068 Rename Meter.setValues() functions to updateValues()
Rationale (copied from htop issue #471):
The function name "setValues" is misleading. For most OOP (object-
oriented programming) contexts, setXXX functions mean they will change
some member variables of an object into something specified in
function arguments. But in the *Meter_setValues() case, the new values
are not from the arguments, but from a hard-coded source. The caller
is not supposed to change the values[] to anything it likes, but
rather to "update" the values from the source. Hence, updateValues is
a better name for this family of functions.
2016-05-04 13:39:26 +08:00
Hisham Muhammad 2ea4bee66d Merge pull request #486 from mmcco/null-check
Remove needless allocation error conditions
2016-04-29 23:01:32 -03:00
Michael McConville 1809f4be98 Remove needless allocation error conditions
These allocations were converted to use xMalloc et al. and no longer
need error checks.
2016-04-29 21:10:05 -04:00
Andy Pilate 5776cb56b4 Revert "Fix FreeBSD CPU% calculation"
This reverts commit f554f08fa9.
2016-04-28 21:42:18 +02:00
Daniel Lange 74f8b31040 Add Keywords entry to .desktop file (Debian Lintian warning desktop-entry-lacks-keywords-entry)
Debian patch from
https://anonscm.debian.org/cgit/collab-maint/htop.git/tree/debian/patches/002-lintian-warning-fix-desktop-keywords.patch
2016-04-19 19:06:03 +02:00
Daniel Lange 4d3f483b96 Fix a typo in the man page (Debian Lintian spelling-error-in-manpage)
Debian patch from
https://anonscm.debian.org/cgit/collab-maint/htop.git/tree/debian/patches/001-lintian-warning-fix-man-typo.patch
2016-04-19 18:32:39 +02:00
James Clarke 2de52862a6 Use Linux backend on the Hurd 2016-04-18 23:57:30 +01:00
James Clarke a9508275cc Use $target_os instead of $target in configure.ac 2016-04-18 23:55:55 +01:00
Hisham 306c5443ae Update header. 2016-03-31 11:01:23 -03:00
Hisham d15555ed2c Merge branch 'master' of https://github.com/hishamhm/htop 2016-03-31 00:19:59 -03:00
Hisham d64f2bdd56 If task_for_pid fails, stop trying. 2016-03-31 00:18:42 -03:00
Hisham Muhammad 6c2f698a47 Merge pull request #458 from Explorer09/bar-tweaks
BarMeterMode_draw() minor code improvement
2016-03-25 01:57:10 -03:00
Explorer09 7b3c8bc77a BarMeterMode_draw minor code improvement
Removed a loop that sets the bar[] buffer with spaces and merged that
task to the snprintf() call just below. No need for the barOffset
variable. Display behavior is unchanged.

Size comparision (when compiled on Ubuntu 14.04 64-bit):

    $ size htop.old htop.new
       text    data     bss     dec     hex filename
     137312   15112    3776  156200   26228 htop.old
     137216   15112    3776  156104   261c8 htop.new
2016-03-22 14:52:31 +08:00
Hisham Muhammad 3a4c0fa2d6 Merge pull request #452 from Explorer09/cpu-meter-tweaks
Assert (Platform_meterTypes[0] == &CPUMeter_class)
2016-03-20 05:02:07 -03:00
Explorer09 328de35623 Assert (Platform_meterTypes[0]==&CPUMeter_class)
Just assume Platform_meterTypes[0] is always &CPUMeter_class for every
platform. This removes a conditional in AvailableMetersPanel_new().

Also adds some comments about the logic here. Without assuming
Platform_meterTypes[0], the (int i=1) clause in this for loop will not
make sense. (I.e. Why not (int i=0)? )

Also replaced a sprintf() call with safer snprintf() in code further
below.
2016-03-19 15:01:13 +08:00
Hisham Muhammad c8a735e471 Merge pull request #444 from Explorer09/meter-maxitems
Explicit "maxItems" property of meters
2016-03-13 20:57:08 -03:00
Explorer09 99fb3070a2 Explicit "maxItems" property of meters
Two changes in this commit:
- All meters now explicitly specify "maxItems" property, even for just
  1 item. (Exception is "container" CPU meter classes, which use
  CUSTOM_METERMODE.)
- "maxItems" being 0 is now allowed. This will let bar meters and graph
  meters render an empty meter.
2016-03-11 10:54:34 +08:00
Explorer09 7d3f67e822 Revert 5c593fae42 (xCalloc)
calloc() allows 'nmemb' or 'size' to be zero, in which case NULL may be
returned. Letting htop die because of either argument being zero doesn't
make sense.

As a side note: As size_t is unsigned, compiler should be able to optimize
conditional (nmemb > 0 && size > 0) to (nmemb && size). This theorically
shouldn't increase code size too much.
2016-03-11 10:43:31 +08:00
Hisham Muhammad 3283c6d23c Merge pull request #441 from Explorer09/issue-438
Avoid overlapping key values defined by curses (Real fix).
2016-03-09 02:03:11 -03:00
Explorer09 8a928c8b89 Avoid overlapping key values defined by curses (Real fix).
Real fix for issue #438.
2016-03-09 10:16:34 +08:00
Hisham f295a52ed9 Avoid overlapping key values defined by curses.
Closes #438.
2016-03-08 12:23:18 -03:00
Hisham e2ccc7b240 Prepare for release 2.0.1. 2016-03-07 18:32:06 -03:00
Hisham Muhammad ef1e62d1fa Merge branch 'juanfra684-openbsd-mem-used' 2016-03-07 15:03:50 -03:00
Hisham Muhammad 453105e77a Merge branch 'Sp1l-master' 2016-03-07 16:58:47 -03:00
Hisham Muhammad db80f202f2 Avoid global, as done by @gaod in #387. 2016-03-07 16:58:02 -03:00
Hisham Muhammad 98e43816a5 Merge branch 'master' of https://github.com/Sp1l/htop into Sp1l-master 2016-03-07 16:54:38 -03:00
Hisham Muhammad 694addceb5 Merge pull request #436 from mmcco/tuneup
Misc. OpenBSD tuneup and improvement
2016-03-07 16:38:39 -03:00
Hisham Muhammad 4623394456 Merge pull request #435 from mmcco/freebsd
Improve error reporting on FreeBSD libkvm call
2016-03-07 16:35:59 -03:00
Hisham Muhammad 4ad7aa6432 Merge branch 'openbsd-mem-used' of https://github.com/juanfra684/htop into juanfra684-openbsd-mem-used 2016-03-07 15:03:18 -03:00
Michael McConville 4b780a3499 A few more OpenBSD fixes
Namely:

 o use malloc where an xCalloc slipped in

 o safeguard against an empty arg list - I don't think it's possible,
   but it would be potentially exploitable

 o we need to initialize the arg string to an empty string because we no
 longer use strlcpy(3)

 o annotate a tricky use of strlcpy(3)'s truncation
2016-03-05 23:38:12 -05:00
Michael McConville b08cb7352e Misc. OpenBSD tuneup and improvement
Including:

 o set *basenameEnd even in error cases (FreeBSD probably needs this)

 o use kvm_openfiles(3) rather than kvm_open(3) so that we can report
   errors (as with FreeBSD)

 o sanify the process argument list creation by using strlcat(3)

 o drop the pageSizeKb variable and use the PAGE_SIZE_KB macro directly,
   as the page size can't change anyway

 o clean up a few macros, add MINIMUM() and MAXIMUM() (should be
   mirrored to FreeBSD)

 o fix some syntax

 o add some useful comments
2016-03-05 23:23:29 -05:00
Michael McConville b886ecc479 Improve error reporting on FreeBSD libkvm call
This involves switching from kvm_open(3) to kvm_openfiles(3). The only
difference is that the latter has saner error reporting (see the man
page for details). We can now fatally report the error rather than just
calling assert(3).
2016-03-05 22:59:39 -05:00
Hisham Muhammad 63c55854e5 Merge pull request #388 from mhinz/add-p-to-help
Add "p" to Help
2016-02-29 22:03:45 -03:00
Hisham 4f1bd232d8 Merge branch 'master' of https://github.com/hishamhm/htop 2016-02-29 21:57:47 -03:00
Hisham 84a69b1ea4 Release resource when using hwloc 2016-02-29 21:57:27 -03:00
Hisham e77811e99b any of these values may wrap 2016-02-29 21:57:03 -03:00
Marco Hinz 0a4a447d0d Add "p" to Help 2016-03-01 00:57:09 +01:00
Tim Creech cc8375f9ea FreeBSD: use KERN_PROC_PROC with kvm_getprocs to avoid erroneously combining LWPs 2016-02-28 22:41:50 -05:00
Hisham Muhammad 03af73bbc7 Merge pull request #427 from tcreech/master
Fix low CPU usage reporting in FreeBSD
2016-02-27 03:04:52 -03:00
Tim Creech 0cf3cfa3af Fix low CPU usage reporting in FreeBSD 2016-02-26 23:23:27 -05:00
Hisham 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
Hisham 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
Hisham a8a5e62760 Force -lgcov harder when running `make coverage`.
Shouldn't be needed, but I had to make this tweak to make this work again.
2016-02-19 13:40:21 -02:00
Hisham f5ddb974a1 Tweaks on the test suite, still problematic. 2016-02-19 13:40:00 -02:00
Hisham 565101234a Remove old commented code. 2016-02-19 13:39:38 -02:00
Hisham d4741d5410 Fix error test — looks like nobody bumped into this one! 2016-02-19 13:39:16 -02:00
Hisham 9668cd11ed Merge branch 'master' of https://github.com/hishamhm/htop 2016-02-19 13:38:54 -02:00
Hisham c23d4f12d1 Fix behavior of ESC key, getting rid of the annoying delay.
Thank you @Explorer09 for the push!
Closes #417.
2016-02-19 13:38:02 -02:00
Hisham Muhammad 34431dc7fd Merge branch 'master' of https://github.com/hishamhm/htop 2016-02-18 23:46:36 -02:00