Commit Graph

54 Commits

Author SHA1 Message Date
Jim Warner
583cdaca1a library: normalize recently added namespaces interface
While 'invisible' thread subdirectories are accessible
under /proc/ with stat/opendir calls, they have always
been treated as non-existent, as is true with readdir.

This patch trades the /proc/#/ns access convention for
the more proper /proc/#/task/#/ns approach when thread
access is desired. In addition some namespace code has
been simplified and made slightly more efficient given
the calloc nature of proc_t acquisition and its reuse.

Reference(s):
commit a01ee3c0b3

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-11-25 20:57:32 +11:00
Aristeu Rozanski
a01ee3c0b3 procps: add support for linux namespaces
Each process in Linux has a /proc/<pid>/ns directory which contains
symbolic links to pipes that identify which namespaces that process
belongs to. This patch adds support for ps to display that information
optionally.

Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
2013-04-16 15:05:21 -04:00
Jim Warner
6c8e9d9581 library: fix proc_t page fault delta counts alignment
When the maj_delta and min_delta fields were added to
the proc_t, they necessitated some compiler generated
padding bytes.

With this slight reordering, those padding bytes are
no longer generated.  And since the original commit
already broke the library ABI, now is an opportune
time to correct that misalignment.

Reference:
commit 7753bd1004

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-02 20:56:39 +10:00
Jim Warner
7753bd1004 library: adapt proc_t for top 'page fault delta' counts
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:37:11 +10:00
Jim Warner
348e6091cb library: add a single vector string choice for 'environ'
In preparation for top scrollable environment display,
the new flag PROC_EDITENVRCVT was added to mirror the
existing single vector string handling for cgroup and
cmdline.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:34:54 +10:00
Craig Small
a909f6e917 Change restrict to __restrict in public includes
procps automake defines restrict which means the binaries for procps
binaries compile. However external programs may not of defined
restrict which means they will not complie if they include files found
in /usr/include/proc.

Includes from libc6 use __restrict and if is good enough for
them, its good enough for us.
2012-01-09 21:44:51 +11:00
Sami Kerola
922d218e1e include/devname.h: add missing header
The devname.h requires readproc.h header which has dev_t. Unless
header is included the includes in program files must be in
correct order. I also added FIXME item to remind that for uid &
gid value int not correct data type but uid_t or gid_t from
pwd.h.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:17:02 +01:00
Craig Small
f7fb8bddf4 miscellaneous top and library cleanup
top changes
 . refined column header width calculations
 . added error messages for:
     invalid signal ('k')
     invalad max tasks ('n')
 . corrected narrative for summary_show

library changes
 . corrected some comments (only)
2011-09-25 00:27:37 +10:00
Craig Small
0e6ac0db3e added tgid support plus miscellaneous cleanup
ps
   . added tgid support
   . made process/task naming consistent
 top
   . added tgid support
   . standardized pid related width logic
 documents
   . added tgid to ps & top man documents
 library
   . fixed OOMEM_ENABLE readtask bug
   . corrected header typo for tgid
2011-08-17 21:01:35 +10:00
Craig Small
bb4f08ba29 refined library i/f and improved performance
Library changes
   readproc
    . added readeither to more efficiently
      fill both process and thread proc_t
    . added readproctab3, uses readeither
    . included task path support in:
        fill_cgroup_cvt, fill_cmdline_cvt,
        read_unvectored
    . QUICK_THREADS #define allows copying
      process info vs. repeatedly reading
    . simple_nexttid no longer values ppid
    . path var made non-static in readtask
    . documented 'proc_data_t' in .h file
    . tweaked some c comments & formatting
   library.map
    . added new readeither, readproctab3
 Program changes
   ps
    . exploits readproctab3 where possible
    . improved args/comm compliance
   top
    . exploits readeither
2011-08-11 07:42:14 +10:00
Craig Small
3ef4823f90 supgid/supgrp support, improved library interface
Library changes
   readproc
    . added support for supplementary groups
    . eliminated 2 potential mem leak sources
       . shortcut used for multi-threaded str
         vectors & ptrs was obsoleted
       . freeing of proc_t related dynamic
         memory now rests with the library
    . standardized/normalized many c comments
   sysinfo
    . corrected note regarding glibc & cpuinfo
   library.map
    . made the visible freeproc accessable
 Program changes
   pmap
    . initialized buffer for new readproc i/f
    . eliminated now obsolete free() call
   ps
    . added width aware supgrp support
    . initialized buffers for new readproc i/f
    . eliminated now obsolete free() calls
   top
    . added supgrp support as variable width
    . eliminated now obsolete free() calls
    . expoilted library freeproc function
    . corrected -h|v args text & spacing
    . updated some c comments
 Documentation changes
   ps.1
    . added supgid and supgrp
   top.1
    . added supgid and supgrp
    . addition of above required renumbering
      many fields in section 3a. DESCRIPTIONS
2011-08-01 21:28:46 +10:00
Jim Warner
16f8bc685f miscellaneous library documentation changes
Library changes
  . standardized comments in proc_t statm/status memory definitions

Signed-off-by: Jan Görig <jgorig@redhat.com>
2011-06-23 15:39:32 +02:00
Jim Warner
7b0fc19e9d enhanced libproc cgroup/cmdline support, exploited by top
Library Changes
. added PROC_EDITCMDLCVT flag
. added an internal (static) fill_cmdline_cvt function:
  - reads and "escapes" /proc/#/cmdline
  - returns result as a single string in a single vector
  - callers are guaranteed a cmdline (no more NULL)
. added vectorize_this_str function, exploited by
  fill_cgroup_cvt, fill_cmdline_cvt
. generalized read_cmdline function as read_unvectored, now
  exploited by fill_cgroup_cvt, fill_cmdline_cvt, read_cmdline
  ( cgroup and cmdline no longer need be converted to string )
  ( vectors before being transformed to final representation )
. fixed bug regarding skipped group numbers (when enabled)
. escape_str made responsible for all single byte translation
  with distinction between control chars + other unprintable
. added escaped_copy function for already escaped strings
. reorganized parts of proc_t to restore formatting standards
  ( displacement changes shouldn't matter with new version # )
. former ZAP_SUSEONLY #define now OOMEM_ENABLE
. added to library.map: escaped_copy; read_cmdline

Top Program Changes
. exploited the new PROC_EDITCMDLCVT provision
. eliminated now obsolete #include "proc/escape.h"
. changed the P_WCH display format if no kernel symbol table
. fixed very old bug in lflgs for out-of-view sort fields
. former ZAP_SUSEONLY #define now OOMEM_ENABLE

Ps Program Changes
. exploited the new PROC_EDITCMDLCVT provision
. exploited the new escaped_copy function
. consolidated pr_args and pr_comm into pr_argcom

Signed-off-by: Jan Görig <jgorig@redhat.com>
2011-05-18 10:33:44 +02:00
Jim Warner
57031319d6 cgroup support migrated to libproc, plus miscellaneous re-formatting
This source patchset addresses the following:
Library Extension (readproc)
 . added PROC_EDITCGRPCVT flag
 . added an internal (static) fill_cgroup_cvt function:
   . reads AND parses /proc/#/cgroup
   . returns result as a single string in a single vector
   . thus no changes to proc_t structure or free memory logic
Program Enhancements (top)
 . removed parse_cgroup logic in favor of libproc
 . eliminated cgroup sort recurring overhead
 . converted WCHAN field to variable width
 . generalized variable width field logic in task_show
 . real-time notation under P col more distinctive as 'rt'
Program Cosmetic (top)
 . CGROUP now known as CGROUPS (plural)
 . moved jan's attribution from top.c to 'Notes' in top.h
 . numerous comments tweaked
Document Enhancements (top)
 . documented CGROUPS field (required renumbering all fields)
 . adapted narratives for the 3 current variable width fields
 . expanded real-time scheduling notes, 'RT' now shown as 'rt'

Signed-off-by: Jan Görig <jgorig@redhat.com>
2011-05-05 12:12:27 +02:00
Werner Fink
e646984924 Add missed oom support to libproc
Add missed oom support to libproc
Signed-off-by: Werner Fink <werner@suse.de>
2011-04-15 15:52:40 +02:00
Jan Görig
af25453d9a ps displays cgroup
Author: Swann Perarnau <swann.perarnau@imag.fr>
Bug-Debian: http://bugs.debian.org/469669
Reviewed-by: Craig Small <csmall@debian.org>
2010-12-16 10:23:49 +01:00
albert
5f570a84f1 per-process swap info available on Linux 2.6.34 2010-05-18 07:02:03 +00:00
albert
5c591b836f fix "ps sm" bug involving 1-thread-proc optimization 2006-06-17 04:14:57 +00:00
albert
0586dc8b6d fix warnings; put CFLAGS on lib link command 2004-09-23 13:41:33 +00:00
albert
f1db79c042 better handling of long usernames 2004-07-20 23:31:12 +00:00
albert
3f603adbae remove some table inconsistencies and rename it_real_value 2004-04-17 03:13:56 +00:00
albert
d526282deb nswap data dead since 2.4.xx kernels 2004-04-13 03:56:52 +00:00
albert
cb8bd84b21 CodingStyle left out of tarball. Tweak top. Leftovers? 2004-02-23 18:47:42 +00:00
albert
1e1218cca8 pmap stack detection 2004-01-26 20:01:56 +00:00
albert
7dfe80961a sorted threads might work 2003-10-19 23:37:47 +00:00
albert
e180e4875f more goodies 2003-10-16 03:30:41 +00:00
albert
3a16c12ce3 top on wyse60, whitespace doc, thread fixes 2003-10-07 03:12:50 +00:00
albert
35859fb0a8 ugly wart gone 2003-09-28 17:23:29 +00:00
albert
ac6260bc23 hard disk about to die 2003-09-28 02:45:05 +00:00
albert
c462dcfad5 ps thread support 2003-09-20 08:29:55 +00:00
albert
4456afd68a EVIL_GROUPING_HACK 2003-09-18 02:18:43 +00:00
albert
8b04273f89 EVIL_PROC_HACK 2003-09-17 21:58:32 +00:00
albert
0db94e6a1a GPLONLY_ and PID-related stuff 2003-07-03 05:20:19 +00:00
albert
4a54e25aca 2.5.61 2003-02-17 00:57:15 +00:00
albert
27ed270851 memory leak fixed 2003-02-11 08:19:12 +00:00
albert
ebc5354699 KLONG 2003-01-16 08:03:40 +00:00
albert
3e67b58ec2 satisfy GPL section 2a and LGPL section 2b name+date requirement 2002-12-15 00:30:17 +00:00
albert
5087f3dbf6 big header clean-up 2002-12-09 07:00:07 +00:00
albert
4382008ad0 likely to help 2002-12-08 23:53:05 +00:00
albert
7ac9a0e1f5 present for Jim 2002-12-03 09:07:59 +00:00
albert
4e7de4274d http://www.coker.com.au/selinux/procps/procps.diff 2002-11-27 23:04:32 +00:00
albert
d0bc469c10 spare bits 2002-11-25 10:22:41 +00:00
albert
9e098634f0 "Do" cleanup 2002-10-22 06:12:12 +00:00
albert
9cae81a619 reduce waste 2002-10-22 04:55:12 +00:00
albert
77356d9d64 make top go faster 2002-10-13 08:23:50 +00:00
albert
e04a2ca5b5 3.0.0 apps should run on 3.0.1 lib 2002-10-09 07:27:34 +00:00
albert
e4d350522e mention -a 2002-10-09 04:28:48 +00:00
albert
bc9cdacdcc all 2.5.xx RT info except HP-UX "cls" 2002-10-03 09:41:57 +00:00
albert
e96d6b6141 Avoid opening System.map just to check it, etc. 2002-10-02 12:10:39 +00:00
albert
84ed57020d ifdef and cruft removal 2002-09-30 07:11:30 +00:00