Commit Graph

187 Commits

Author SHA1 Message Date
Jaromir Capik
0f6b289212 license: update FSF addresses
The license files are synchronized with the versions from GNU web
site.

http://www.gnu.org/licenses/gpl-2.0.html
http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html

Signed-off-by: Jaromir Capik <jcapik@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-04 08:04:24 +11: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
Sami Kerola
60ea600599 ps: fix compiler warnings
common.h:23:19: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
global.c:499:3: warning: ISO C does not support the '%Ld' gnu_printf format [-Wformat]
output.c:134:1: warning: 'sr_cstime' defined but not used [-Wunused-function]
output.c:816:3: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
output.c:816:3: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:36:29 +11:00
Jaromir Capik
99c99baebc docs: typo in ps.1 manual [rpmlint]
Signed-off-by: Jaromir Capik <jcapik@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:18:27 +11:00
Craig Small
502a79e02f Merge remote-tracking branch 'sami/to-craig' into sami-merge
Conflicts:
	pgrep.c
	w.c
2012-03-03 13:56:32 +11:00
Craig Small
563dd2c5f1 Fix string literals in fprintf and friends
Both these are from [-Werror=format-security]
sig.c:262:5: error: format not a string literal and no format arguments
global.c:517:3: error: format not a string literal and no format arguments
2012-03-03 12:05:07 +11:00
Craig Small
a15520db8c ps abort causes problems in testsuite
Under certain circumstances, using abort() when either make check
or make distcheck puts ps into an infinite loop around the
function catastrophic_failure() in ps and the C library raise
and abort functions.

Using exit removes this problem and does almost the same thing.
2012-03-03 11:49:48 +11:00
Mike Frysinger
9c32fdbec3 ps: include error.h
This code currently uses error_at_line() from error.h, so pull it in.
Long term, this might get moved to c.h as a local helper on err.h,
but I have no idea.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-24 08:55:05 +01:00
Sami Kerola
79ceb30b5c ps: unify cases and remove trailing dots in messages
Strings with lower caps & no trailing dots have greater change to
have multiple occurences, meaning less effort for translators, than
strings with them.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-15 20:52:58 +01:00
Sami Kerola
5c9ec043cd docs: remove old information from HACKING
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-13 22:42:38 +01:00
Sami Kerola
809906b6a7 ps: add catastrophic_failure()
The catastrophic_failure function tries to make bug reporting useful
by telling in which line error occured, and drops core.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-13 22:42:38 +01:00
Mike Fleetwood
2bac5334b0 ps: display the nice value for processes with the SCHED_BATCH scheduler policy
Ps command does not display the nice value for processes with the SCHED_BATCH
scheduler policy, only for SCHED_OTHER.

Boinc (http://boinc.berkeley.edu/) client runs project processing jobs on
Linux using SCHED_BATCH scheduler policy and nice value 19.  The nice value
is not displayable by ps.

Steps to Reproduce:
1. Run process using SCHED_BATCH scheduler policy with nice value.
    ./test-schedbatch 18 &
2. Display process details:
    ps -o pid,ppid,user,comm,cls,nice

Results before:
[mike@rockover c]$ ps -o pid,ppid,user,comm,cls,nice
  PID  PPID USER     COMMAND         CLS  NI
18205  2540 mike     bash             TS   0
20552 18205 mike     test-schedbatch   B   -
20553 18205 mike     ps               TS   0
[mike@rockover c]$ awk '{printf "%5d %-17s %1d %2d\n", $1, $2, $41, $19}'
/proc/20552/stat
20552 (test-schedbatch) 3 18

Results after this patch:
[mike@rockover c]$ ps -o pid,ppid,user,comm,cls,nice
  PID  PPID USER     COMMAND         CLS  NI
18205  2540 mike     bash             TS   0
20552 18205 mike     test-schedbatch   B  18
20553 18205 mike     ps               TS   0

Additional info: Here is the fragment from the sched_setscheduler(2) manual
page on the subject:

   SCHED_BATCH: Scheduling batch processes
       (Since  Linux 2.6.16.)  SCHED_BATCH can only be used at static
       priority 0.  This policy is similar to SCHED_OTHER in that it
       schedules the process according to its dynamic priority (based on the
       nice value).  The difference is that this policy will cause the
       scheduler to always assume that the process is CPU-intensive.
       Consequently, the scheduler will apply a small scheduling penalty with
       respect to wakeup behaviour, so that this process is mildly disfavored
       in scheduling decisions.

       This policy is useful for workloads that are noninteractive, but do
       not want to lower their nice value, and for workloads that want a
       determin- istic scheduling policy without interactivity causing extra
       preemptions (between the workload's tasks).

Reference: https://bugzilla.redhat.com/show_bug.cgi?id=741090
Acked-by: Jaromir Capik <jcapik@redhat.com>
Acked-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
2012-01-09 21:37:41 +01:00
Sami Kerola
5ccb0951c1 ps: corrections to messages
Signed-off-by: Sami Kerola <sami.kerola@tomtom.com>
2012-01-06 00:17:50 +11:00
Jim Warner
dd194da7ec ps: change PACKAGE_BUGREPORT to procps@freelists.org 2012-01-05 09:56:05 +11:00
Jim Warner
893b1b81a8 ps: update url for BUILD_WITH_WHINE error message 2012-01-05 09:56:05 +11:00
Jim Warner
3388f65c03 build-sys: correct all Makefile.am files for LOCALEDIR, etc
Some of the latest changes to Makefile.am files are missing.

This patch restores the LOCALEDIR variable, among others,
and dispenses with the include directives in the ps/ and top/
subdirectories since they're no longer needed.
2012-01-04 08:58:54 +11:00
Jim Warner
b139890758 ps: update man document for redesigned help provisions 2012-01-04 08:58:53 +11:00
Jim Warner
4fb48c0bdb ps: generalize help text logic, add related translator hints
This commit represents an experiment in nls help text support.

The word --help itself been made translatable along with the
help section names and their abbreviations.  Thus, the work of
the translators will ultimately alter program run-time behavior.

Perhaps someday all "long" options can behave in a similar way
which could offer a considerable benefit to other languages.
Instead of translationg just option descriptions, the long
forms of those options could also be transalated.

This commit also:
 . includes the section abbreviations in --help output
 . isolates all --help support in the ps/help.c module
 . provides (hopefully) meaningful Translator guidance
 . removes --help support from the ps/common.h header
 . removes --help support from the ps/parser.c module
 . eliminates tabs in line with the style of other ps modules
 . eliminates the need for the include/c.h header file
2012-01-04 08:58:53 +11:00
Jim Warner
b8c3288594 ps: exclude debugging only code from participation in nls support
This commit is prmarily concerned with elimnating deugging only
code from the nls template file.

It also eliminates any remaing useless trailing whitespace.
2012-01-04 08:58:53 +11:00
Jim Warner
71b72b36ce ps: minor reformatting and trailing whitespace elimination
This patch mostly reorganizes include files and eliminates
some useless trailing whitespace.

It also adopts the standard procps-ng unconditional approach
to nls initialization.
2012-01-04 08:58:53 +11:00
Jim Warner
fe20653a4e ps: trade cumbersome GNU attributes with less wordy alternatives 2012-01-04 08:58:52 +11:00
Craig Small
76b3e91e6a Made the c and nls include explicit
These two includes need the path otherwise the make distcheck fails.
I suspect its actually a ps/Makefile.am problem
2012-01-02 17:46:17 +11:00
Sami Kerola
c3405fab1a translations: group usage texts
Reference: http://www.freelists.org/post/procps/backporting,5
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-02 16:29:03 +11:00
Craig Small
a99002e3fe Merge branch 'master' into nls
Conflicts:
	configure.ac
	pmap.c
	ps/Makefile.am
2011-12-26 09:11:27 +11:00
Craig Small
2983b30523 Renaming libprocfs to libprocps
The library used to be called libprocps but it was renamed to make sure
there was only one. However the formatting of the library SONAME has
changed so there cannot be any confusion.

libprocps makes it clear that its a library from this project and not a
set of functions directly on the filesystem.
2011-12-23 09:18:43 +11:00
Sami Kerola
003d388922 docs: clean up ps.1 manual page
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
0022b6ec5d nls: improve translations and provide translator help comments
Reference: http://www.freelists.org/post/procps/backporting,1
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
c862a4caa5 nls: add functions which take translations to be used
Add the following three functions to most of the commands.

setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);

Reference: http://www.freelists.org/post/procps/backporting,1
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
305b36e5b1 build-sys: remove non-existing files from Makefile.am
The f23390043bece9f2d4870e5b3a187896e2c7d23f removed few files,
which still exist in Makefile.am making `make dist' to fail. This
patch fixes the isue.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:51 +01:00
Sami Kerola
9057b18a32 libproc-ng & ps: fix warning reported by smatch
proc/ksym.c +279 read_file(54) info: redundant null check on buf calling free()
proc/ksym.c +330 parse_ksyms(41) info: redundant null check on ksyms_data calling free()
proc/ksym.c +332 parse_ksyms(43) info: redundant null check on ksyms_index calling free()
proc/ksym.c +451 sysmap_mmap(110) info: redundant null check on sysmap_index calling free()
proc/procps.h:74:5: warning: undefined preprocessor identifier 'SHARED'
proc/slab.c +145 parse_slabinfo20(24) error: potential null derefence 'prev'.
proc/slab.c +222 parse_slabinfo11(21) error: potential null derefence 'prev'.
ps/stacktrace.c +131 debug(6) error: snprintf() is printing too much 99 vs 16

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:50 +01:00
Sami Kerola
c1fa3bfce8 misc: compiler warning fixes
Fix few compiler warnings. Some of these warnings appeared multiple
times, and the listing bellow is more about which sort of errors
where fixed.

devname.c:87:12: warning: comparison of integers of different signs: 'int' and 'unsigned long'
output.c:389:36: warning: passing 'char **const' to parameter of type 'const char *const restrict *' discards qualifiers in nested pointer types
output.c:611:31: warning: comparison of integers of different signs: 'const unsigned long' and 'int'
stacktrace.c:33:37: warning: unused parameter 'signum'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:50 +01:00
Sami Kerola
4bd36d1483 ps: add gettext support
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:45 +01:00
Sami Kerola
db6aea7d3f ps: new usage function
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:17:03 +01:00
Craig Small
2865ded64e Removed xalloc type functions from library
These xalloc functions are a private function for the library. If using
programs need them, then they should make their own error reporting or
use a common file.
2011-12-20 22:56:17 +11:00
Craig Small
0c82b0ceda ps: rename SZ to SIZE
Means we do not follow SCO but less confusion.

A patch from Debian.

Bug-Debian: http://bugs.debian.org/541061
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:50:12 +11:00
Jessica McKellar
9ecd3c8414 ps: add sorting to %mem for ps
A patch from Debian.

Bug-Debian: http://bugs.debian.org/599043
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:48:38 +11:00
Alfredo Esteban
daf4014205 ps: --sort does not work with time argument
A patch from Debian.

Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508435
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508435
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:29:12 +11:00
unknown
fe82a3246a ps: add build option to disable ps option warning
Slackware seems to have this patch, while it is not in use(?) Well,
the upstream procps-ng allows one to disable warnings if that is
wanted. After all having this sort of 'feature' does not cost much,
while lacking it might annoy someone.

A patch from Slackware.

Reference: http://www.ftp.be/packages/slackware/slackware_source/a/procps/procps.nowarning.diff.gz
Backported-by: Sami Kerola <kerolasa@iki.fi>

Conflicts:

	proc/ksym.c
2011-12-18 10:53:44 +11:00
Craig Small
38763ede40 Rename library and use proper versioning
Previously the version of libproc always tracked the version of procps.
This doesn't work when other non-procps programs link to the library as
they are always playing catch up.

This change makes the library version independent of the procps version.
It will only be incremented when needed.
2011-12-17 22:35:05 +11:00
Jim Warner
229be7b160 ps: exploit enhanced library memory allocation provisions
There were numerous ps memory allocation inconsistencies.
Some were checked for failure and others were not.

The program was modified to utilize the library memory
rouines which are consistent in dealing with errors.

(a few changes simply removed trailing whitespace)
2011-12-11 22:29:25 +11:00
Jim Warner
ba13a76422 redhat analysis: ps/sortformat 2011-10-15 08:26:28 +02:00
Jim Warner
0e663aacbc redhat analysis: ps/display 2011-10-15 08:26:28 +02:00
Jim Warner
6317f8e685 redhat analysis: ps/parser 2011-10-15 08:26:27 +02:00
Craig Small
b9a408372e Merge branch 'master', remote-tracking branch 'sami/ng' 2011-10-01 23:23:30 +10:00
Jim Warner
b7638e7ae9 build-sys: rename libproc to libprog-ng
The library file version string is taken from configure.ac AC_INIT.

Reference: http://www.freelists.org/archive/procps/09-2011

Signed-off-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Craig Small <csmall-procps@enc.com.au>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-23 22:07:15 +02:00
Craig Small
e4c45d6984 added ps etimes, miscellaneous top enhancements
ps program
 . etimes added for ELAPSED expressed in seconds
 . time_t used in place of former unsigned long

top program
 . corrected scroll message bug when 'x' toggle on
 . fixed forest view potential missing libflags bug
 . improved 'k' default signal invocation logic
 . enhanced logic for %CPU maximums displayed
 . made signal handling more robust and efficient
2011-09-12 22:18:23 +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
Sami Kerola
71d10d3a49 name change: procps -> procps-ng
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-04 20:50:12 +02:00