Commit Graph

1244 Commits

Author SHA1 Message Date
Mike Frysinger
0da6537c5f fix printf format warnings
pgrep.c: In function 'main':
pgrep.c:793:4: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long int' [-Wformat]

vmstat.c: In function 'diskpartition_format':
vmstat.c:382:9: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat]
vmstat.c:408:10: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat]

w.c: In function 'main':
w.c:394:4: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-26 21:15:42 +01:00
Mike Frysinger
fc3bf171ff pmap: fix const warning
pmap.c:300:8: warning: assignment discards 'const' qualifier
	from pointer target type [enabled by default]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-26 21:12:39 +01:00
Kent R. Spillner
81f64657ba watch: exit when command output changes.
Add new flags to watch (-g/--chgexit) so that it exits when the
output changes.  This is useful in builds and shell scripts, for
example when deploying webapps to block the remainder of the
deployment steps until after the webapp starts.

e.g. watch --chgexit curl http://foo/bar
2012-01-26 08:42:37 -06:00
Sami Kerola
8fe81caa42 sysctl: fix coding style
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-25 09:18:38 +01:00
Sami Kerola
1cde286c75 docs: add to pgrep.1 count return value information
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-25 09:17:49 +01:00
Sami Kerola
da20fcbe42 docs: remove tcp_default_win_scale from sysctl.conf sample
The variable net.ipv4.tcp_default_win_scale has not been part of
kernel since 2.6.9 (Oct 2004).

Reference: http://oss.sgi.com/archives/netdev/2004-08/msg01589.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-24 22:34:12 +01:00
Sami Kerola
ea221b4e42 libprocps: hide private symbols
Clean the global list of symbols contain only functions and variables which
are being called from library.  The removed symbols are internal for the
library, which means they can be changed without changes to programs using
the library.  This clean up should help incoming libprocps clean up work.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-24 21:54:01 +01:00
Craig Small
8955ec26fe Merge remote-tracking branch 'sami/vapier' 2012-01-24 22:36:28 +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
Mike Frysinger
2b449855c7 proc: pull in ctype.h where needed
Fix the build warnings:

sig.c:227:5: warning: implicit declaration of function 'toupper' [-Wimplicit-function-declaration]
sig.c:231:3: warning: implicit declaration of function 'isdigit' [-Wimplicit-function-declaration]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-24 08:55:05 +01:00
Mike Frysinger
afaf698896 use helpers from c.h
A few files still use the C library helpers from err.h, so migrate
them to the local c.h helpers.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-24 08:55:05 +01:00
Mike Frysinger
13d8cc0681 watch: include sys/wait.h for waitpid
Fixes build warning:
	watch.c:682:3: warning: implicit declaration of
		function 'waitpid' [-Wimplicit-function-declaration]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-24 08:55:05 +01:00
Mike Frysinger
af61809a18 include error.h for error() and friends
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-24 08:55:05 +01:00
Sami Kerola
7fc80ffa42 skill: exclude debugging strings from nls
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-22 01:23:59 +01:00
Sami Kerola
2b99362139 tload: remove unnecessary goto
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-21 23:29:02 +01:00
Sami Kerola
8f7eefc9c8 docs: aligh top.1 header with other procps-ng utils
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-21 16:49:47 +01:00
Sami Kerola
624773957f docs: add exit values to watch.1
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-21 16:41:31 +01:00
Sami Kerola
ae08eb8af6 tload: check write() return value
Exit at rare events when writing to tty is unsuccessful.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-21 16:24:33 +01:00
Sami Kerola
bc974b3c33 pkill: enable displaying what is killed
Add new command line options -e, --echo to display what is
killed. Cost of this change is greater run time memory footprint,
because an union had to be changed to struct to allow name and
pid printing which what I as an user would expect to see in
verbose kill output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-21 13:44:00 +01:00
Sami Kerola
12dce9f83b pgrep: fix compiler warning
pgrep.c:786:4: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-21 12:15:41 +01:00
Sami Kerola
3489b9343e pkill: fix error printing
Print correct pid number of process that was where not killed
because of kill was not successful. Incorrect behaviour before
this fix is bello.

-- snip
$ ps -elf | grep dh[c]
1 S root      1409     1  0  80   0 -  1782 poll_s 02:01 ?        00:00:00 dhclient wlan0
$ pkill dhc
pkill: killing pid 1 failed: Operation not permitted
-- snip

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-21 12:15:40 +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
0e8c4659de other: make AUTHORS file obsolete
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-13 22:42:38 +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
Sami Kerola
bf88c882ed other: tell in ChangeLog where to see changes
We do not want to maintain ChangeLog, people should look git log
instead.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-13 22:42:38 +01:00
Jim Warner
b73a423cc2 top: avoid %cpu distortions when toggling task/thread modes
This commit addresses a long standing buglet (debian #441166) which
surfaces when the display mode is switched between task and threads.

An extra procps refresh is now forced upon such a transition which
parallels the approach used at startup for the exact same reason.

Reference: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=441166
2012-01-14 00:04:46 +11:00
Jim Warner
b246af9cec top: force newline for unexpected signal abnormal exit
This commit just restores the pre-nls behavior, which was lost
in the migration to nls string tables support.
2012-01-14 00:04:46 +11:00
Jim Warner
3ad8fd56ed vmstat: slabinfo (-m option) test disabled if not readable
The dejagnu tests for slabtop are skipped when "/proc/slabinfo" is
unreadable due to permissions.  This commit provides the same check
for vmstat under its -m (slabinfo) option.
2012-01-14 00:04:46 +11:00
Craig Small
58a6c89cd1 sysctl -p has no space
The man page has examples like sysctl -p filename. Optional arguments
using getopt cannot have a space between the option and argument.
So the correct format is sysctl -pfilename
2012-01-13 23:59:26 +11: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
Mike Fleetwood
23d2e0b0b7 tests: add SCHED_BATCH test
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
Craig Small
3c2377ca15 Linux version for non-linux systems
On non-linux systems, uts.version provides the version of that
specific kernel (FreeBSD or Hurd version, for example) and not the
emulated procfs pseudo version.

On those systems we need to directly read /proc/version and parse the
string.  This change replaces Debian patches gnu-kbsd-version and
complain_unmounted_proc patches.
2012-01-09 21:57:44 +11: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
Craig Small
1928653399 watch needs a conditonal LDADD
Makes Debian patch makefile_watch_ncurses redundant.
watch was being linked to NCURSES_LIBS when it should of been
WATCH_NCURSES_LIBS which can be ncursesw with 8bit enabled.
2012-01-09 21:40:53 +11:00
Sami Kerola
cac93d35d0 build-sys: use dist-xz
Even as conservative project as coreutils has switched to xz distributions so
neither should we have any reason to use gz and waste space & bandwidth.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-08 23:02:17 +01:00
Sami Kerola
6c21a3613b other: indent FAQ file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-08 21:57:35 +01:00
Sami Kerola
feb25fc10e other: update CodingStyle
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-08 21:57:34 +01:00
Sami Kerola
5aabf74e73 other: update BUGS file
Change information submission address to be procps@freelists.org and
instruct people to send patches in 'git am' friendly format.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-08 21:57:34 +01:00
Sami Kerola
b29a64be17 other: update TODO
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-08 21:57:34 +01:00
Sami Kerola
be0dfba9b2 other: move files to Documentation/ directory
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-08 21:57:26 +01:00
Sami Kerola
794298b9f9 build-sys: use git version as package version
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-08 21:35:07 +01:00
Sami Kerola
6241e9d545 w: indicate unknown host when -f is used
The option -f used too print `-' to FROM column when host was not
known. This commit changes behaviour back to what it was earlier.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-08 21:31:56 +01:00
Sami Kerola
9d47cb0c38 pwdx: re-create invalid process id check
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-08 21:29:51 +01:00
Craig Small
ab25578bee Updated NEWS with new items for procps-ng 3.3.2 2012-01-06 16:48:09 +11:00
Sami Kerola
b0d0b4856e docs: add preload paths to sysctl.conf.5
The patch also has other maintenance fixes, such as man header fixes,
high lighting corrections and add bug report address.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-06 16:12:22 +11:00
Sami Kerola
ec1f4d394a docs: clarify slabtop sort criteria listing
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-06 16:10:10 +11:00
Sami Kerola
bb142f7aa6 slabtop: total slabs & caches header fix
Commit 0ac63f5bc1 messed up header
print order; the Total Slabs and Total Caches where reported in place
of each other.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-06 16:10:09 +11:00
Sami Kerola
26f2deac52 docs: watch manual update about -e option behaviour change
Relates to: commit 7ac61b3fa1

Signed-off-by: Sami Kerola <sami.kerola@tomtom.com>
2012-01-06 00:18:07 +11: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