Commit Graph

60 Commits

Author SHA1 Message Date
Michael Schwendt
dd87e4f48c libprocps: protect locale environment getting overwrite
The problem is that in ./proc/sysinfo.c uptime(), it is not
considered that the "savelocale" string is overwritten by the
subsequent call to setlocale().  Hence restoring the locale later on
won't work this way.  "savelocale" ought to be a copy of the string
pointed to by setlocale()'s return-value.

Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=548711
Backported-by: Sami Kerola <kerolasa@iki.fi>
2012-04-25 09:34:41 +10:00
Sami Kerola
ce61089059 docs: clarification to license headers in files
Add license header to all files.  The summary of licensing is below,
taken from Craig Small's email which is referred in commit message
tail.

sysctl and pgrep are GPL 2+
The rest is LGPL 2.1+

Reference: http://www.freelists.org/post/procps/Incorrect-FSF-address-in-the-license-files,8
Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=797962
CC: Craig Small <csmall@enc.com.au>
CC: Jaromir Capik <jcapik@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:41:11 +11:00
Michael Tokarev
04ce4db830 vmstat: do not scale si/so just like bi/bo
Use strtoull insteadof strtoul for some counters.

A patch from Debian.

Bug-Debian: http://bugs.debian.org/558361
Bug-Debian: http://bugs.debian.org/558134
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:54:20 +11:00
David Fries
3cea313cf3 libprocps-ng: sysinfo.c: truncate the vmstat figure to 32 bits
A patch from Debian.

Bug-Debian: http://bugs.debian.org/620557
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:53:59 +11:00
Armin van Buuren
90b201f1f4 libproc-ng: prettyfy proc mount messages
A patch from Gentoo.

Bug-Gentoo: https://bugs.gentoo.org/138029?id=138029
Bug-Gentoo: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-process/procps/files/procps-3.2.7-proc-mount.patch?revision=1.1&view=markup
Bug-Gentoo: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-process/procps/files/procps-3.2.7-proc-mount.patch?revision=1.1&view=markup
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 10:58:02 +11:00
Jim Warner
827334870d library: exploit enhanced library memory allocation provisions
There were numerous library memory allocation inconsistencies.
Some were checked for failure and others were not.

All library source modules were modified to utilize the alloc.h
memory rouines which are consistent in dealing with errors.
2011-12-11 22:26:55 +11:00
Craig Small
20463f1a13 vmstat -p <part> works and updated version to 3.3.1
configure.ac now set to 3.3.1
vmstat -p has not worked for a long time, this applies Debian patch
vmstat_part_format, the details:

Author: Daniel Novotny
Description: The contents of /proc/diskstats have changed since 2.6.25
 Changed PATH_MAX to 32 because its missing on hurd
Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=485243
Bug-Debian: http://bugs.debian.org/588677
Last-Update: 2010-11-17
2011-11-27 22:47:17 +11:00
Craig Small
e383fe2622 Merge branch 'master', remote-tracking branch 'sami/ng' 2011-10-20 22:15:27 +11:00
Jim Warner
b49055e657 redhat analysis: proc/sysinfo 2011-10-15 08:26:27 +02:00
Craig Small
13ce6ebdf0 Use 7 cpu numbers not 4 for Hertz Hack
For the small number of devices that we cannot get Hertz out of ELF
notes but the cpu numbers make sense (ie not kFreeBSD) there is a hack
by using the CPU numbers. The problem is there was 4 numbers, now there
are 7. This fixes the hack by adding all 7 to get a more correct number.

This is from Debian patch sysinfo_7_numbers
Bug-Debian: http://bugs.debian.org/460331
2011-10-07 14:35:16 +11:00
Craig Small
a5750100a0 Fix Hertz calculation for FreeBSD
FreeBSD has no good way of finding the Hertz value. ELF notes don't
work, you can't find it in a function and even asm/params.h does
not have it.  Lucky for us, it is always 100.

Based upon Debian patch patch sysinfo_kfreebsd_hertz by Petr Salinger
Bug-Debian: http://bugs.debian.org/460331
Caution, 460331 has lots of overlapping bugs all around the Hertz
problem across many arches.
2011-10-07 10:22:24 +11:00
Craig Small
aae3d318d4 Elf note AT_CLKTCK is only found on Linux
Suppresses a message about elf notes not found on non-Linux systems.
kFreeBSD systems, for one, don't have this so the message appears
every time you run a procps program otherwise.

Based upon Debian patch sysinfo_elfnote by Petr Salinger
Bug-Debian: http://bugs.debian.org/378157
2011-10-07 10:08:42 +11:00
Craig Small
b9a408372e Merge branch 'master', remote-tracking branch 'sami/ng' 2011-10-01 23:23:30 +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
Craig Small
a26c3bfa39 top hotplug memory support
Another patch from Jim for top to support hot-pluggable memory. Not
fully tested on real hot-pluggable memory because neither of us have
it
2011-07-14 21:16:02 +10:00
Sami Kerola
33fb22b169 proc/sysinfo.c: autotools caused a regression
For some reason necessary variable was commented out at June
2003, see commit bellow for details.

commit 5c99a21b72

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-04 17:22:44 +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
Werner Fink
aac0de8994 Initialize smp_num_cpus only if really required
Initialize smp_num_cpus only if really required

Signed-off-by: Werner Fink <werner@suse.de>
2011-04-15 15:53:20 +02:00
Jan Görig
8fde4af11d Call libproc constructors in strict order
Having one constructor depend on another means if the order
is reversed you get a different result.
Patched based on idea by Tom Evans.

Added new code to old_Hertz_hack by Werner Fink <werner@suse.de>

Bug-Debian: http://bugs.debian.org/460331
Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=632236
Reviewed-by: Jan Görig <jgorig@redhat.com>
2011-01-19 12:50:26 +01:00
Jan Görig
4d3c19af52 Read the system boot time from /proc instead of computing
Read the time of system boot from /proc/stat (entry: btime) instead
of computing it as the difference between the current time and the
uptime. This is the only way to get a consistent result which won't
possibly change from one run to the next.

The problems with the original code were:
* Both the current time and the uptime are rounded down to the second,
  but the system doesn't boot on an integer second value so they do not
  tick at the same moment. Thus, the rounding errors can cause a one
  second difference from one run to the next.
* We can't read the uptime and the current time at the exact same moment
  anyway, so the time difference we compute is bound to be inaccurate.
Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=222251
Author: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Craig Small <csmall@debian.org>
2010-12-16 10:30:39 +01:00
albert
7dd414ac1b new /proc/meminfo fields 2008-03-24 04:41:26 +00:00
albert
9049ffef32 ps man page 2006-09-10 06:25:56 +00:00
albert
9278134e49 top: show CPU time stolen from a virtual machine 2006-06-25 02:15:36 +00:00
albert
47d33e7ed4 g is criteria 2006-06-24 20:12:29 +00:00
albert
29cbc63561 fputs instead of fprintf 2005-10-30 23:45:47 +00:00
albert
864a5356a1 fix race condition 2005-06-10 15:43:15 +00:00
albert
6ec1cff342 ps: built-in test code, etc. 2004-10-12 00:12:25 +00:00
albert
0d77d98bf3 ttySMX* devices, /proc/vmstat change, /proc/meminfo change 2004-08-27 20:21:46 +00:00
albert
af2077f22d new /proc/vmstat fields 2004-08-27 14:23:36 +00:00
albert
792358ba42 Linux 2.2 non-SMP on SMP Alpha needed this 2004-08-10 07:18:04 +00:00
albert
6308cb79e1 rh109147-like bug w/ old data in buffer, plus ")" problem and speed 2004-07-28 15:19:46 +00:00
albert
713d32a93a some overflow problems fixed -- thanks Holger Kiehl 2004-07-26 13:48:59 +00:00
albert
c8a8290ef2 fix vmstat -d 2004-05-04 23:29:40 +00:00
albert
e54c8239b1 new Linux 2.6.0-test4 CPU stats shown 2003-09-08 01:39:49 +00:00
albert
8618adeaaf got most of procps-3.1.11ff2.diff 2003-08-10 23:40:41 +00:00
albert
45764fb735 3.1.11 2003-07-14 12:11:43 +00:00
albert
0db94e6a1a GPLONLY_ and PID-related stuff 2003-07-03 05:20:19 +00:00
albert
5c99a21b72 diskstats and slabinfo 2003-06-08 17:28:06 +00:00
albert
de2857aa89 fabian.frederick@gmx.fr vmstat code 2003-05-31 00:38:55 +00:00
albert
89ccfbf4f8 whip me, beat me, make me do UNIX terminal handling 2003-03-27 16:28:41 +00:00
albert
9c25e92bf0 3.1.6 news 2003-01-23 07:08:00 +00:00
albert
0a03eac352 malloc error 2003-01-23 05:48:27 +00:00
albert
71d958095f just checking 2002-12-15 06:30:04 +00:00
albert
3e67b58ec2 satisfy GPL section 2a and LGPL section 2b name+date requirement 2002-12-15 00:30:17 +00:00
albert
c3ee8f3252 Inact_laundry 2002-12-08 00:14:02 +00:00
albert
bd1a19b577 c99 2002-11-25 10:16:33 +00:00
albert
1e1645c4d4 first 3.0.4 thing: ELF note warning 2002-10-14 07:53:08 +00:00
albert
81a4a3d281 gcc 3.0 warnings 2002-10-12 04:25:57 +00:00
albert
af89241571 coding style 2002-10-09 21:32:33 +00:00
albert
0fda206a66 warning and variable name fixes 2002-10-09 07:11:08 +00:00