1. 03 Mar, 2018 2 commits
    • Support running with child namespaces · 0e39102f
      By default pgrep/pkill should not kill processes in a namespace it is not
      part of. If this is allowed, it allows callers to break namespaces they did
      not expect to affect, requiring rewrite of all callers to fix.
      So by default, we should work in the current namespace. If --ns 0 is
      specified, they we look at all namespaces, and if any other pid is specified
      we continue to look in only that namespace.
      Signed-off-by: Debabrata Banerjee <dbanerje@akamai.com>
      Debabrata Banerjee authored
    • top: show that truncation indicator ('+') consistently · b2d7f620
      With a little luck, this should be the final tweak for
      our support of extra wide characters. Currently, those
      characters don't always display the '+' indicator when
      they've been truncated. Now, it should always be seen.
      [ plus it's done a tad more efficiently via snprintf ]
      Signed-off-by: Jim Warner <james.warner@comcast.net>
      jim warner authored
  2. 02 Mar, 2018 4 commits
    • ps: Add NEWS and checks for times and cputimes · 90a4aee4
      The previous commit had one minor bug in it because the fields need
      to be alphabetical and times comes after timeout.
      Added NEWS item for this feature
      Added another testsuite check for new flags in case they
      disappear or go strange one day.
       commit 8a94ed61
      Craig Small authored
    • ps: add times & cputimes format specifiers: cumulative CPU time in seconds · 5329984b
      These format specifiers are to time & cputime what etimes is to etime.
      Signed-off-by: Sébastien Bigaret <sebastien.bigaret@telecom-bretagne.eu>
      Sébastien Bigaret authored
    • pidof: allow to change a separator put between pids · 7f597105
      I frequency use pidof command with strace system call tracer.
      strace can trace MULTIPLE processes specified with "-p $PID"
      arguments like:
      	  strace -p 1 -p 1030 -p 3043
      Sometimes I want to do as following
      	  strace -p $(pidof httpd)
      However, above command line doesn't work because -p option
      is needed for specifying a pid. pidof uses a whitespace as
      a separator. For passing the output to strace, the separator
      should be replaced with ' -p '.
      This maybe not a special to my use case.
      This commit introduces -S option that allows a user to specify a
      separator the one wants.
          $ ./pidof bash
          ./pidof bash
          24624 18790 12786 11898 11546 10766 7654 5095
          $ ./pidof -S ',' bash
          ./pidof -S ',' bash
          $ ./pidof -S '-p ' bash
          ./pidof -S '-p ' bash
          24624-p 18790-p 12786-p 11898-p 11546-p 10766-p 7654-p 5095
          $ ./pidof -S ' -p ' bash
          ./pidof -S ' -p ' bash
          24624 -p 18790 -p 12786 -p 11898 -p 11546 -p 10766 -p 7654 -p 5095
          $ strace -p $(./pidof -S ' -p ' bash)
          strace -p $(./pidof -S ' -p ' bash)
          strace: Process 24624 attached
          strace: Process 18790 attached
          strace: Process 12786 attached
      Signed-off-by: Masatake YAMATO <yamato@redhat.com>
      Masatake YAMATO authored
  3. 01 Mar, 2018 5 commits
  4. 19 Feb, 2018 10 commits
  5. 12 Feb, 2018 4 commits
    • top: respond to an additional library 'state' category · 6a5cd6d6
      Signed-off-by: Jim Warner <james.warner@comcast.net>
      jim warner authored
    • library: account for idle state ('I') threads in total · 7ede9ef7
      With the documentation update in the commit referenced
      below, we should also account for such threads as they
      will already be represented in the task/thread totals.
      [ and do it in a way that might avoid future changes ]
      commit 91df65b9
      Signed-off-by: Jim Warner <james.warner@comcast.net>
      jim warner authored
    • top: adapt utf8 logic to support extra wide characters · 264790d8
      Back when top was refactored to support UTF-8 encoding
      it was acknowledged that languages like zh_CN were not
      supported. That was because a single 'character' might
      require more than a single 'column' when it's printed.
      Well I've now figured out how to accommodate languages
      like that. My adaptation is represented in this patch.
      [ and just in case someone wishes to avoid the extra ]
      [ runtime costs, a #define OFF_XTRAWIDE is included. ]
      Along the way, I've cleaned up some miscellaneous code
      supporting the 'Inspect' feature so that the rightmost
      screen column was always used rather than being blank.
      [ interestingly, my xterm & urxvt terminal emulators ]
      [ are able to split extra wide characters then print ]
      [ 1/2 of such graphics in the last column. the gnome ]
      [ terminal emulator does not duplicate such behavior ]
      [ but prints 1 extra character in same width window. ]
      . Sep, 2017 - original utf8 support
      commit 9773c56a
      Signed-off-by: Jim Warner <james.warner@comcast.net>
      jim warner authored
    • top: tweak that recent enhancement to startup defaults · 6f2e6696
      When the new approach for startup defaults was adopted
      in the reference below, a file might be left open that
      technically should be closed. This situation arises in
      the unlikely event the #define RCFILE_NOERR is active.
      Without that #define, the program will exit early thus
      rendering the open file issue moot. However, even with
      that #define there was no real harm with an open file.
      It simply meant a 2nd FILE struct would have been used
      when, or if, the rcfile was written via a 'W' command.
      Anyway, this patch ensures such a file will be closed.
      . Dec, 2017 - /etc/topdefaultrc introduced
      commit 55a42ae0
      Signed-off-by: Jim Warner <james.warner@comcast.net>
      jim warner authored
  6. 13 Jan, 2018 4 commits
  7. 07 Jan, 2018 1 commit
    • sysctl: Don't crash file fopen fails · 8882afa0
      The commit referenced below put a setvbuf() before checking what
      fopen() returned. If the file could not be opened then the file
      handle was NULL at setvbuf() crashed.
      setvbuf() is now called after checking what fopen() returns and only
      when it was successful.
       commit 58ae084c
      Craig Small authored
  8. 29 Dec, 2017 3 commits
  9. 23 Dec, 2017 6 commits
    • Merge branch 'madrisan/procps-newlib' into newlib · fab7cc56
      Craig Small authored
    • library: Move runtime signal count check to compile time · 98a5332d
       Since the value of number_of_signals is known at compile time, we can
       use a compile-time check instead. This also adds SIGLOST for the Hurd,
       uses the correct signal counts for the Hurd and FreeBSD, and only gives
       a compile-time warning when compiled on an unknown platform that it does
       not know whether the number of signals is correct.
      Author: James Clarke <jrtc27@jrtc27.com>
       commit bd72ba3a (jrtc27/procps-cross-platform)
      Craig Small authored
    • top: allow more flexible approach for startup defaults · 55a42ae0
      Those references below offer more detail regarding the
      default startup changes beginning with version 3.3.10.
      It is important to remember that all such changes were
      supposed to impact only new users or users who had not
      saved the personal config file (via that 'W' command).
      However, I introduced a bug wherein the rcfile was not
      fully honored. This gave the changes a bad reputation.
      That bug was corrected in release 3.3.11 but the issue
      of default startup options keeps resurfacing. And it's
      clear there's no consensus on what should be included.
      Our --disable-modern-top configure option is of little
      help since it remains an all-or-nothing approach. What
      we need is an answer offering unlimited customization.
      So, this commit will provide distribution packagers or
      system administrators with a much more flexible way to
      set their own preferred startup default configuration.
      A new rcfile is being introduced: '/etc/topdefaultrc',
      whose format/content is the same as a personal rcfile.
      Thus once a 'proper' enterprise configuration has been
      established and saved via 'W', it can be copied to the
      /etc/ directory. Thereafter, startup in the absence of
      a saved rcfile will use that configuration as default.
      Now if a distribution packager or system administrator
      wishes to expose their users to some of top's advanced
      capabilities they can do so gradually. Perhaps setting
      up graph mode for summary area task and memory display
      while retaining the %CPU sort could be tried. Or maybe
      showing colors, but better customized for a particular
      terminal emulator. Such possibilities are now endless.
      [ in exploiting this new capability, i hope that the ]
      [ other windows (alt display mode) aren't overlooked ]
      . Sep, 2014 - Not fully honoring rcfile bug discussed
      . Oct, 2014 - Attempt to defend new startup defaults
      . Jul, 2015 - Forest vs. %CPU views discussion
      . Oct, 2017 - Question the use of --disable-modern-top
      . Oct, 2017 - Forest vs. %CPU views discussion again
      . Dec, 2017 - Rehash of 3.3.10 startup defaults change
      Signed-off-by: Jim Warner <james.warner@comcast.net>
      jim warner authored
    • top: let's exploit the new standardized errno handling · 0a502adf
      With the library having now normalized errno handling,
      perhaps it is time at least one program took advantage
      of it. So, instead of printing just a message with the
      programs's line number, top will now also provide that
      associated errno string text, compliments of strerror.
      [ with those newlib functions returning NULL, we can ]
      [ use errno directly in strerror. for the ones which ]
      [ yield an int, all we need do is invert such return ]
      [ values before passing it to the strerror function. ]
      Signed-off-by: Jim Warner <james.warner@comcast.net>
      jim warner authored
    • top: miscellaneous changes to whitespace/comments only · 71b3de01
      [ ok, there's also 1 newly added #undef included too ]
      Signed-off-by: Jim Warner <james.warner@comcast.net>
      jim warner authored
  10. 22 Dec, 2017 1 commit