1. 24 Feb, 2018 1 commit
    • Masatake YAMATO's avatar
      pidof: allow to change a separator put between pids · ac19cb62
      Masatake YAMATO authored
      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: 's avatarMasatake YAMATO <yamato@redhat.com>
  2. 19 Feb, 2018 9 commits
  3. 12 Feb, 2018 3 commits
    • jim warner's avatar
      top: account for the idle state ('I') threads in total · c888534a
      jim warner authored
      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 a238a687Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
    • jim warner's avatar
      top: adapt utf8 logic to support extra wide characters · b4bce3b8
      jim warner authored
      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 7ef38420Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
    • jim warner's avatar
      top: tweak that recent enhancement to startup defaults · dfa118b4
      jim warner authored
      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 3e6a208aSigned-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
  4. 13 Jan, 2018 4 commits
  5. 07 Jan, 2018 1 commit
    • Craig Small's avatar
      sysctl: Don't crash file fopen fails · 272c5b0f
      Craig Small authored
      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
  6. 29 Dec, 2017 6 commits
  7. 23 Dec, 2017 5 commits
    • Craig Small's avatar
      Merge branch 'jrtc27/procps-cross-platform' · cc6bade6
      Craig Small authored
    • James Clarke's avatar
      sig: Move runtime signal count check to compile time · bd72ba3a
      James Clarke authored
      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.
    • jim warner's avatar
      top: allow more flexible approach for startup defaults · 3e6a208a
      jim warner authored
      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
      #78Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
    • jim warner's avatar
      library: relocate the typedef used in alloc.h override · 0003d704
      jim warner authored
      There is no longer justification for placing a typedef
      employed in overriding that alloc.h message handler in
      the procps.h header file. So this commit just moves it
      to the alloc.h header file itself where's it's needed!
      [ gosh, sure wish i had thought to relocate this guy ]
      [ when the changes in the 1st commit shown were made ]
      . most recent related changes
      commit 18e5aecd
      . place where it *should* have been relocated
      commit 2865ded6Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
    • jim warner's avatar
      top: miscellaneous changes to whitespace/comments only · cdf8eac9
      jim warner authored
      [ ok, there's also 1 newly added #undef included too ]
      Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
  8. 22 Dec, 2017 1 commit
  9. 20 Dec, 2017 5 commits
    • Craig Small's avatar
      watch: Support ANSI 39,49 reset sequences · f9bef2b2
      Craig Small authored
      ANSI colour sequences 39 and 49 reset the foreground and background
      colours respectively. This feature was missing from watch using the
      colour "-c" option.
       Fixes #73
    • jim warner's avatar
      slabtop: let's stop always ignoring the last slab node · 1013f271
      jim warner authored
      This patch will fix a fencepost error that has existed
      since at least 2004, the result of which was to always
      completely ignore that last merged / sorted slab node.
      [ Of course, little harm was done since output would ]
      [ have been limited to a terminal's height. Thus, it ]
      [ would have required a huge display before noticed. ]
      [ But, now that the run once switch shows everything ]
      [ such an omission would become really unforgivable. ]
      Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
    • jim warner's avatar
      slabtop: for run_once switch (-o), output all slabinfo · 0ef497bb
      jim warner authored
      It doesn't make sense to restrict the number of output
      lines to the total of terminal rows when using the run
      once command line switch. And, in fact, that's how the
      newlib version of slabtop works. Everything is output.
      So, this commit places both versions on equal footing.
      [ it was even worse if the switch was used in a pipe ]
      [ since only 23 lines would have then been displayed ]
      Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
    • jim warner's avatar
      top: exploit msg handler override to avoid corrupt tty · 18e5aecd
      jim warner authored
      Way back in November of 2011, the library was equipped
      with an overridable error message handler function. It
      was done expressly for a program like top which alters
      the tty. But that support was withdrawn shortly after.
      This was all done in the lead up to v3.3.2. That's the
      release where NLS support was added and it represented
      a hectic time. In hindsight, the changes went too far.
      So this commit, in a minimal fashion, restores ability
      to address a potential fatal library error. After all,
      any properly behaving library would never unilaterally
      subject a caller to a stderr message and then an exit.
      [ when exposing 1 variable in libprocps.sym, 2 other ]
      [ existing symbols were repositioned alphabetically. ]
      . generalized library memory provisions
      commit 7126cc44
      . top exploit library memory provisions
      commit 88087ec5
      . library xalloc type functions made private
      commit 2865ded6
      . restored prior top memory logic
      commit 05f5deb9Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
    • jim warner's avatar
      top: add and/or expand a couple more translation hints · 0a91e21d
      jim warner authored
      After noticing that the 'uk' translation expanded what
      was supposed to be a 3 line header into 5 lines, seems
      appropriate to offer more guidance on max lines count.
      Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
  10. 14 Oct, 2017 5 commits