1. 23 Mar, 2017 2 commits
    • Kyle Laker's avatar
      whattime: Fix formatting · 7b8eba40
      Kyle Laker authored
      Update formatting within the if block to two spaces
      7b8eba40
    • Kyle Laker's avatar
      whattime: Show 0 minutes in pretty output · 668394ba
      Kyle Laker authored
      When supplying the -p command to uptime, it does not display any
      sections where the value is less than 1; however, after a reboot, this
      causes the command to just output "up". Showing 0 minutes when the
      system has been up for less than a minute makes it clear a reboot just
      occurred.
      668394ba
  2. 16 Mar, 2017 6 commits
    • jim warner's avatar
    • jim warner's avatar
      top: by default, show cmd line vs. cmd name at startup · fc5f5a93
      jim warner authored
      All of top's display was designed to fit into an 80x24
      terminal. This includes the help screens plus both the
      Summary and Task Areas, assuming no saved config file.
      
      With release 3.3.10, the startup defaults were changed
      assuming ./configure --disable-modern-top wasn't used.
      This was done in the hope of introducing some users to
      unknown capabilities such as colors, forest view, etc.
      
      The purpose of this commit is to coax a few more users
      into possibly exploring another capability: scrolling.
      We do so by tweaking the default startup display so as
      to show full command lines. Now, when things no longer
      fit in 80x24, horizontal scrolling might be exploited.
      
      [ of course, this can be reversed with the -c switch ]
      Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      fc5f5a93
    • jim warner's avatar
      top: provide -1 command line switch as 'Cpu(s)' toggle · 89db82d1
      jim warner authored
      If built without ./configure --disable-modern-top, the
      program displays each cpu individually providing there
      is sufficient vertical screen real estate. For massive
      SMP environments this will necessitate use of a config
      file where the cpu summary toggle ('1') could be saved
      via the 'W' command. But, an rcfile may not be viable.
      
      So this commit introduces a '1' command line switch to
      emulate exactly the effects of the interactive toggle.
      
      And since it is our first numeric switch some existing
      parsing logic had to be changed slightly. Such changes
      are, in truth, an improvement. For example, instead of
      seeing "inappropriate '2'" with ./top -2 we'll now see
      the vastly more appropriate error "unknown option '2'.
      
      References(s):
      #55Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      89db82d1
    • jim warner's avatar
      top: provide -E command line switch for memory scaling · fb48b5d9
      jim warner authored
      In their 3.2.7 version of top, Redhat introduced an -M
      switch to automatically scale Summary Area memory data
      to avoid truncation (and the resulting '+' indicator).
      
      The procps-ng top does not employ suffixes with memory
      data nor does it allow for different scaling with each
      separate value. Rather, scaling appears at line start.
      
      If built without ./configure --disable-modern-top, the
      Summary Area memory will be scaled at GiB which should
      lessen chance of truncation. Otherwise KiB was used to
      reflect such memory, increasing the truncation chance.
      
      And while 'W' can be used to preserve some appropriate
      scaling value, there are arguments against such rcfile
      approaches as cited in the issue and bug report below.
      
      So this commit will bump the Summary Area memory scale
      factor from KiB to MiB when using --disable-modern-top
      as a concession to that Redhat bug report noted below.
      
      And it also introduces a new command line switch which
      can force any desired scaling regardless of the rcfile
      or which ./configure option might have been specified.
      
      [ for top's help text we'll show 'E' as if it were a ]
      [ switch without arguments in order to keep the help ]
      [ text displayable without wrap in an 80x24 terminal ]
      
      [ the man page, however, will show all k-e arguments ]
      
      Reference(s):
      #53
      https://bugzilla.redhat.com/show_bug.cgi?id=1034466Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      fb48b5d9
    • jim warner's avatar
      top: show fewer decimal places for memory (by default) · fe6e03d8
      jim warner authored
      After much reflection I've come to the conclusion that
      displaying 3 decimal places (usually) when memory data
      had been scaled is no longer optimal with today's ever
      increasing amounts. And given that not all task memory
      fields are the same widths, inconsistencies can easily
      arise as illustrated and discussed in the issue below.
      
      Instead of unilaterally reducing the number of decimal
      places, this commit will sneak in such a change via an
      existing configure option that was very likely unused.
      
      The former 'disable-wide-memory' option has now become
      'enable-wide-memory', which can be used if the current
      behavior (3 decimal places) is preferred. Without that
      option, whenever memory is scaled beyond KiB, just one
      decimal place will be shown in Summary and Task areas.
      
      And Task area field width will no longer be changed by
      this revised configure option. Instead, all such field
      widths will now be fixed at the former maximum values.
      
      Reference(s):
      #50Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      fe6e03d8
    • jim warner's avatar
  3. 07 Feb, 2017 2 commits
  4. 04 Feb, 2017 3 commits
    • Craig Small's avatar
      pkill: Return 0 if successfully killed process · 625d0809
      Craig Small authored
      Original report:
      When trying kill a process with insufficient privileges (see blow),
      pkill displays the error message “... failed: Operation not permitted”,
      but returns 0. Surely it should return 3?
      
      $ pkill syslogd ; echo $?
      pkill: killing pid 373 failed: Operation not permitted
      0
      
      Return value 0 means one of more things matched. For a pgrep (which
      shares code with pkill) this makes sense, there was a match. It seems
      wrong for pkill to return 0 when it in fact could not do what you told
      it to.  However return value 3 means a fatal error and it's not fatal.
      
      Looking at other programs when trying to kill things it cannot kill.
      shell kill returns 1, procps kill returns 1, killall returns 1, skill
      returns 0 (and says it was successful!, ah well poor old skill)
      
      The consensus seems to be that you return 1 if you cannot kill it, even
      if you found it. In other words the return value for both not found and
      not able to kill it is the same.
      
      pkill only returns 0 if something was killed. This means we found a
      match AND the kill() system call worked too.
      
      References:
       https://bugs.debian.org/852758Signed-off-by: Craig Small's avatarCraig Small <csmall@enc.com.au>
      625d0809
    • Craig Small's avatar
      NEWS: Very minor typo fixed · 1fb37313
      Craig Small authored
      Signed-off-by: Craig Small's avatarCraig Small <csmall@enc.com.au>
      1fb37313
    • jim warner's avatar
      NEWS: updated with the two most recent program changes · a4f93b6d
      jim warner authored
      [ in addition to program changes, this file has been ]
      [ made to agree with that NEWS file under our newlib ]
      [ branch since some entries were ordered differently ]
      [ due to differences in the order of actual commits. ]
      Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      a4f93b6d
  5. 26 Jan, 2017 1 commit
  6. 17 Jan, 2017 1 commit
    • Earnestly's avatar
      top: Add unobtrusive XDG support · af53e170
      Earnestly authored
      By default the file HOME/.toprc will be prefered.  This ensures there
      should be minimal breakage even if this file is later created by some
      other means.  Otherwise we will follow the new behaviour described by
      the XDG Base Directory Specification:
      
      If the XDG_CONFIG_HOME environment variable is available we will attempt
      to use this as XDG_CONFIG_HOME/procps/toprc otherwise we will fall-back
      to HOME/.config/procps/toprc instead.
      Signed-off-by: Earnestly's avatarEarnestly <zibeon@gmail.com>
      af53e170
  7. 03 Jan, 2017 2 commits
  8. 02 Jan, 2017 1 commit
  9. 20 Dec, 2016 1 commit
  10. 07 Dec, 2016 4 commits
  11. 23 Nov, 2016 1 commit
  12. 22 Nov, 2016 1 commit
  13. 21 Nov, 2016 1 commit
  14. 07 Nov, 2016 1 commit
  15. 15 Oct, 2016 1 commit
    • jim warner's avatar
      top: make that 'forest view' just a tad more efficient · c6407ef1
      jim warner authored
      It makes no sense to begin our tracked nested level at
      '1' then later require a '1' to be subtracted from the
      level as artwork and indentation is added for display.
      
      By beginning such tracked levels at zero, we can avoid
      the need to adjust it & use it directly in a snprintf.
      
      [ this commit parallels a patch in our newlib branch ]
      Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      c6407ef1
  16. 12 Oct, 2016 2 commits
  17. 09 Oct, 2016 1 commit
  18. 25 Sep, 2016 1 commit
  19. 21 Sep, 2016 1 commit
  20. 19 Sep, 2016 2 commits
  21. 18 Sep, 2016 1 commit
    • jim warner's avatar
      top: finally circumvent that minor libnuma memory leak · 18b1a887
      jim warner authored
      Still unhappy with a minor memory leak associated with
      libnuma, I experimented with omitting the dlclose that
      was issued at module's end. For some reason which will
      remain a mystery, the valgrind leak then went bye-bye.
      
      So this patch just omits one use of dlclose and relies
      on whatever kernel magic is at work to free the memory
      when each process ends. We kept, however, the original
      code (now commented-out) to serve as a future caution.
      
      There remains one potential (but unlikely) dlclose use
      near the original dlopen. But there will be no leak as
      that 'numa_node_of_cpu' will not yet have been called.
      This seems to be the culprit that triggers such leaks.
      
      None of this libnuma shit would likely have come close
      to hitting our fan had the numa developers provided us
      with 'new' and 'unref' functions like our newlib does.
      
      [ this commit parallels a patch in our newlib branch ]
      Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      18b1a887
  22. 11 Sep, 2016 2 commits
    • Craig Small's avatar
      pgrep: Fix off by one error in line check · 24fd2605
      Craig Small authored
      There is now a warning if your command is longer than 15 characters
      and therefore can never match. Except it was checking for more than
      16 characters.
      
      Adjusted this and added a test case.
      
      References:
       !25
       commit 8e8835b2
      24fd2605
    • Craig Small's avatar
      Merge branch 'fifteen_chars_warning' into 'master' · 8e8835b2
      Craig Small authored
      pgrep - adds warning that pattern exceeds 15 chars without '-f' option
      
      Resolves many questions seen on forums around the web. Adds a decent warning about the behaviour.<br>
      Ideas about better text?
      
      See merge request !25
      8e8835b2
  23. 10 Sep, 2016 2 commits
    • Craig Small's avatar
      Merge branch 'fix-kill-l-bad-free-sig-prefix' into 'master' · 18e7ebd2
      Craig Small authored
      kill: Fix free() with bad pointer on SIG-prefixed signal-name
      
      kill -l SIGHUP (or any other signal-name prefixed with "SIG")
      would cause free() to be called with a bad pointer instead of
      a pointer to what was allocated. Fix this and add test-case.
      
      See merge request !26
      18e7ebd2
    • jim warner's avatar
      pmap: fix printing bug associated with the '-x' option · b899c55d
      jim warner authored
      Ever since its introduction, the 'x' (extended format)
      option has employed strncmp to parse those smaps keys.
      
      Such an approach worked well as long as those prefixes
      were guaranteed to be unique. But, with the 4.3 kernel
      a new 'SwapPss' field was added to those within smaps.
      
      That triggered a 2nd match for the 'Swap' logic which,
      in turn, resulted in a duplicate output line of zeros.
      
      So this patch just trades strncmp for strcmp, avoiding
      potential future problems when /proc/$$/smaps evolves.
      
      Reference(s):
      . recent bug report
      https://bugzilla.redhat.com/show_bug.cgi?id=1374061
      . linux 4.3 kernel introduces SwapPss
      commit 8334b96221ff0dcbde4873d31eb4d84774ed8ed4
      . original pmap -x option introduction
      commit 380cc1e9Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      b899c55d