1. 15 Jun, 2016 1 commit
  2. 28 Apr, 2016 1 commit
  3. 09 Feb, 2016 1 commit
    • Emanuele Aina's avatar
      pmap: Fix detail parsing on long mapping lines · 9965fdcb
      Emanuele Aina authored
      If the mapping descriptor is longer than 128 chars, the last parsed
      character won't be a newline even if the current buffer contains it a
      bit further than that. The current code always interprets it as a short
      fgets() read instead, and thus keeps calling fgets() until it gets a
      newline, dropping valid lines and failing with the following error:
      
      pmap: ERROR: inconsistent detail field in smaps file, line:
       Rss:                 212 kB
      9965fdcb
  4. 20 Jun, 2015 1 commit
  5. 24 Jan, 2015 1 commit
  6. 19 Aug, 2014 1 commit
    • Adam Sampson's avatar
      pmap: avoid depending on an uninitialised value. · 1d212457
      Adam Sampson authored
      It's possible for the first entry that this reads from /proc/*/smaps to
      start with a map_desc-less line like this:
      
      7fa71b77d000-7fa71c288000 rw-p 00000000 00:00 0
      
      in which case sscanf will only read up to inode, and it won't set c; the
      code below would then incorrectly discard the next ("Size:") line.
      
      (With GCC 4.9.0, this bug causes the "pmap extra extended output" test
      to fail for me.)
      1d212457
  7. 08 Aug, 2014 1 commit
  8. 02 Feb, 2014 1 commit
    • Craig Small's avatar
      Update help files · 8e7ef322
      Craig Small authored
      Benno Schulenberg suggested some changes to the help messages
      to provide some consistency and clarity for both the users and
      translators of procps.
      
      The test needed to be updated as the pmap output changed too.
      Signed-off-by: Craig Small's avatarCraig Small <csmall@enc.com.au>
      8e7ef322
  9. 27 Dec, 2013 1 commit
  10. 22 May, 2013 1 commit
    • Cristian Rodríguez's avatar
      Fix off-by-one in pmap · 5a39544b
      Cristian Rodríguez authored
      When procps is built with gcc 4.8 address sanitizer
      
      static int one_proc(proc_t * p)..
      ..
      char smap_key[20];
      ...
      (sscanf(mapbuf, "%20[^:]: %llu", smap_key..
      
      rightfully results in an overflow and the program aborts.
      5a39544b
  11. 26 Mar, 2013 2 commits
    • Gilles Espinasse's avatar
      procps-ng : fix pmap uninitialized warnings · d164f47d
      Gilles Espinasse authored
      pmap.c: In function 'one_proc':
      pmap.c:529: warning: 'maxw1' may be used uninitialized in this function
      pmap.c:529: warning: 'maxw2' may be used uninitialized in this function
      pmap.c:529: warning: 'maxw3' may be used uninitialized in this function
      pmap.c:529: warning: 'maxw4' may be used uninitialized in this function
      pmap.c:529: warning: 'maxw5' may be used uninitialized in this function
      
      Without -d and -x option, that should be doable to trigger the issue but I haven't found how
      Signed-off-by: 's avatarGilles Espinasse <g.esp@free.fr>
      d164f47d
    • Gilles Espinasse's avatar
      procps-ng : fix pmap unused variable warnings · bccc2404
      Gilles Espinasse authored
      pmap.c: In function 'print_extended_maps':
      pmap.c:310: warning: unused variable 'value'
      pmap.c: In function 'config_read':
      pmap.c:792: warning: unused variable 'section'
      pmap.c: In function 'get_default_rc_filename':
      pmap.c:969: warning: unused variable 'ret'
      pmap.c: In function 'main':
      pmap.c:999: warning: unused variable 'default_rc_filename'
      Signed-off-by: 's avatarGilles Espinasse <g.esp@free.fr>
      bccc2404
  12. 20 Mar, 2013 1 commit
    • Rainer Müller's avatar
      configure: check for program_invocation_name · 042776e0
      Rainer Müller authored
      For portabiliy, check for program_invocation_name during configure and
      define HAVE_PROGRAM_INVOCATION_NAME accordingly. Use of this symbol is
      now enclosed with the appropriate #ifdef block.
      
      The symbol program_invocation_name is only used for error message
      handling using error(), so it's safe to omit this if it is not
      available.
      042776e0
  13. 19 Mar, 2013 1 commit
    • Jaromir Capik's avatar
      pmap: Fixing -n,-N x -p,-q check · 43bcb470
      Jaromir Capik authored
      The -p,-q switches are mutually exclusive with -n,-N, but
      not between each other. This commit changes the expression
      to a correct one.
      43bcb470
  14. 18 Mar, 2013 7 commits
    • Jaromir Capik's avatar
      pmap: fixing the width measurement of extended_pmap with -q · 5c513ce5
      Jaromir Capik authored
      This commit fixes the width measurement of the extended pmap
      function to work correctly with the -q switch. With no header
      and no footer only widths of the particular values matter.
      5c513ce5
    • jim warner's avatar
      pmap: a spade is a spade, so let's call a Flags a Perm · c80e93be
      jim warner authored
      For some reason when the new -X/-XX options were added
      what was always displayed as 'Mode' became 'Flags'. So
      now a precious horizontal space is wasted because that
      field's data has only 4 bytes whereas the header is 5.
      
      Moreover, this created a conflict with the top program
      which used that name in a column header already. Plus,
      top emitted a 'Translation Hint' that suggests the max
      chars should be 8 which is a limit pmap needn't share!
      
      The xgettext program provides no way to keep identical
      strings separate. This meant both top and pmap will be
      sharing not only the msgid but a Translation Hint too.
      So, the solution will now be two distinct field names.
      
      Besides the kernel folks document it as 'perm' anyway!
      
      Reference(s):
             new options for pmap
      commit faec3407Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      c80e93be
    • jim warner's avatar
      pmap: wield my machete, achieve width-wise nls support · 0c0c5434
      jim warner authored
      The existing gettext nls support in pmap exposed users
      to some potentially ugly misalignments should the text
      that's used in headers someday actually be translated.
      
      The length issue had been addressed already for -X/-XX
      modes, but the column headers weren't nls translatable
      as yet. This commit makes any header (not literally in
      /proc/#/smaps) nls aware. It provides translated width
      protection to all modes except one that's header-less!
      
      As part of this effort, the occasional two spaces that
      preceeded the Mapping column have been reduced to one.
      
      Reference(s):
             new usage & fix coding style
      commit d5088478
             improve translations
      commit 0022b6ec
             add gettext support
      commit d59cf08cSigned-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      0c0c5434
    • jim warner's avatar
      pmap: trade inept width approach for printf's built-in · 3262143a
      jim warner authored
      When the new -X/-XX options were introduced, the width
      and justification requirements were satisfied with a 2
      step approach. First, format strings would dynamically
      be built and then employed in the subsequent printf().
      
      This was a total waste of time and resources since the
      printf family of functions provide for the '*' width &
      precision conventions to meet this need via arguments.
      
      But even more importantly that foolish endeavor always
      hides the potential warnings like the one shown below.
      
      Henceforth this pmap will printf in the proper manner!
      
      Reference(s):
             new options for pmap
      commit faec3407
      pmap.c:459:4: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Wformat]
      Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      3262143a
    • jim warner's avatar
      pmap: formatting only changes, for minimum consistency · 9db53750
      jim warner authored
      This patch just adjusts miscellaneous indentation etc.
      so we can begin the odious task of addressing the pmap
      nls needs with at least a consistently formatted base.
      Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      9db53750
    • jim warner's avatar
      pmap: restore a proper response when arguments missing · f85439e4
      jim warner authored
      Ever since pmap was refactored via the reference below
      (and sprinkled with those damn tabs), the response for
      the absence of any argument has been an error message.
      
      This patch restores the proper behavior ('usage' text)
      and updates the dejagnu 'no arguments' expect pattern.
      
      Reference(s):
      commit d5088478Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      f85439e4
    • Jaromir Capik's avatar
      pmap: New switches - RC support (-n/-N,-c/C) & ShowPath (-p) · 088d77c3
      Jaromir Capik authored
      This commit introduces 4 new switches for the RC support
      and 1 more switch for toggling the path printing
      in the mapping field. the configuration file can be used
      for a selection of columns to be displayed and for toggling
      the path printing in the mapping field.
      088d77c3
  15. 15 Feb, 2013 3 commits
    • Jaromir Capik's avatar
      pmap: fixing pidlist allocation & disabling vmflags in -X · 12ee64c8
      Jaromir Capik authored
      This commit fixes allocation of the pid list so that it
      is sufficient for storing the list terminator.
      
      Additionally the vmflags printing in the -X mode is disabled
      because it's too long. From now the vmflags are displayed
      in the -XX mode only.
      12ee64c8
    • Jaromir Capik's avatar
      pmap - removing the column width constraints in the -X/-XX modes · d454bfe9
      Jaromir Capik authored
      This commit changes the width measurement principle in the -X/-XX
      modes so that a width of totals is measured instead of the width
      of summands. The value of totals is always higher than the value
      of summands. That additionally prevents the totals from having
      a wrong indentation.
      
      This commit also removes the minimum column width constraints
      hardcoded to 7 characters.
      d454bfe9
    • Jaromir Capik's avatar
      pmap: fixing broken indentation in the -X/-XX modes · 20ce346e
      Jaromir Capik authored
      This commit changes the processing principle of the -X/-XX modes
      from 1-pass to 2-pass. A separate width measurement stage has been
      added, so that the real maximum widths can be measured and used
      for correct indentation.
      
      The firstmapping variable now has a new value (2) used for the
      width measurement stage (1st pass). The printing is disabled
      in this stage. The file position is reset to the beginning
      of the file once the end of file is reached and the printing stage
      (2nd pass) begins.
      It's questionable if this approach is sensitive to Read-after-Write
      race conditions. Anyway, this feature is a good candidate for
      a complete redesign in the future.
      
      Additionally this commit introduces a final cleaning of the list
      used for the evaluation of totals in the -X/-XX modes.
      20ce346e
  16. 05 Feb, 2013 1 commit
    • Jaromir Capik's avatar
      pmap: empty output or crashes on ppc/s390 caused by wrong pidlist type · 365a5fa5
      Jaromir Capik authored
      Previously the pidlist variable was defined as unsigned long *
      whilst the openproc function accepts pid_t *.
      Both target types differ in size (8 != 4) and therefore the issue
      mainly affects big endian architectures.
      
      This commit changes the pidlist type to pid_t * so that it's
      compatible with openproc.
      365a5fa5
  17. 24 Jan, 2013 1 commit
  18. 23 Jan, 2013 1 commit
  19. 22 Dec, 2012 1 commit
    • jim warner's avatar
      pmap avoid SEGV potential with new X/XX detail options · 7e8ee148
      jim warner authored
      While permissions suggests that /proc/#/smaps contents
      are world-readable, in practice this file might not be
      available to a non-root process. Whether this is a bug
      in the kernel or an intentional design decision really
      makes no difference. This commit will protect pmap -X.
      
      (everything is perfectly justified plus right margins)
      (are completely filled, but of course it must be luck)
      
      Reference(s):
      commit faec3407
      Author: Dimitrios Apostolou <jimis@gmx.net>
      Date:   Thu Sep 27 22:08:04 2012 +1000
      Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      7e8ee148
  20. 06 Nov, 2012 3 commits
    • Sami Kerola's avatar
      pmap: fix compiler warnings · 22ceeca4
      Sami Kerola authored
      pmap.c:80:7: warning: declaration of 'mapbuf' shadows a global declaration [-Wshadow]
      pmap.c:63:13: warning: shadowed declaration is here [-Wshadow]
      pmap.c:137:37: warning: declaration of 'mapbuf' shadows a global declaration [-Wshadow]
      pmap.c:63:13: warning: shadowed declaration is here [-Wshadow]
      Signed-off-by: 's avatarSami Kerola <kerolasa@iki.fi>
      22ceeca4
    • Sami Kerola's avatar
      pmap: remove memory leaks · e677476a
      Sami Kerola authored
      Signed-off-by: 's avatarSami Kerola <kerolasa@iki.fi>
      e677476a
    • Sami Kerola's avatar
      pmap: use correct types for memory allocation · c043c47d
      Sami Kerola authored
      Fixes error which did not happen always.  Changes of being affected by
      the bug where greater the more there where pids defined as pmap argument.
      The debian bug referral can almost certainly reproduce the problem,
      especially when tried multiple times in row.
      
      pmap: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr)
      (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct
      malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >=
      (unsigned long)((((__builtin_offsetof (struct malloc_chunk,
      fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) -
      1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) ==
      0)' failed.
      Reported-by: 's avatarlee <lee@yun.yagibdah.de>
      Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688180Signed-off-by: 's avatarSami Kerola <kerolasa@iki.fi>
      c043c47d
  21. 27 Sep, 2012 1 commit
  22. 23 Mar, 2012 1 commit
    • Sami Kerola's avatar
      all: check stdout and stderr status at exit · 52269d22
      Sami Kerola authored
      If stream status is not checked at the end of execution below problem
      would not report error, or non-zero exit code.  The uptime is just an
      example same was true with all commands of the project.
      
      $ uptime >&- ; echo $?
      uptime: write error: Bad file descriptor
      1
      $ uptime >/dev/full ; echo $?
      uptime: write error: No space left on device
      1
      Signed-off-by: 's avatarSami Kerola <kerolasa@iki.fi>
      52269d22
  23. 04 Mar, 2012 2 commits
  24. 03 Mar, 2012 2 commits
  25. 05 Feb, 2012 1 commit
    • Sami Kerola's avatar
      pmap: ensure arg1 is not null, and set qualifers to match with usage [smatch scan] · cbb9e545
      Sami Kerola authored
      pmap.c:436 main(59) error: we previously assumed 'arg1' could be null (see line 427)
      pmap.c:136:3: warning: return discards 'const' qualifier from pointer target type [enabled by default]
      pmap.c:142:4: warning: return discards 'const' qualifier from pointer target type [enabled by default]
      pmap.c:150:2: warning: return discards 'const' qualifier from pointer target type [enabled by default]
      pmap.c:300:8: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
      Signed-off-by: 's avatarSami Kerola <kerolasa@iki.fi>
      cbb9e545
  26. 26 Jan, 2012 1 commit
  27. 03 Jan, 2012 1 commit
    • Craig Small's avatar
      Changed the err and warns to macros · fb11e1fe
      Craig Small authored
      err and warn are BSD format but they are not recommended by library
      developers.  However their consiseness is useful!
      
      The solution is to use some macros that create xerr etc which then
      just map to the error() function.  The next problem is error() uses
      program_invocation_name so we set this to program_invovation_short_name
      
      This is a global set but seems to be the convention (or at least errors
      are on the short name only) used everywhere else.
      fb11e1fe