]> granicus.if.org Git - procps-ng/log
procps-ng
9 years agoadded new CI status button
Craig Small [Sat, 24 Oct 2015 01:35:01 +0000 (01:35 +0000)]
added new CI status button

9 years agoRemove CI from readme as the function has been integrated
Craig Small [Sat, 24 Oct 2015 01:23:31 +0000 (01:23 +0000)]
Remove CI from readme as the function has been integrated

9 years agowatch: Correctly process [m Remove lib dependency
Craig Small [Tue, 1 Sep 2015 11:28:07 +0000 (21:28 +1000)]
watch: Correctly process [m Remove lib dependency

The commit referenced below made the ANSI sequence
[m be interpreted as [0m However this change was put
in the incorrect place and would reference an undefined
pointer, causing a crash. Thanks to Jimmy Theis for the
second heads-up.

watch doesn't need any libprocps functions so it is no
longer linked to them.

References:
 commit a5937e4e943eaf28b378a318566d6968f2b167be
 https://www.freelists.org/post/procps/watch-crashes-but-its-not-the-latest-commit-fault
 https://www.freelists.org/post/procps/Segmentation-fault-in-watch-3311

9 years agops: display control group name
Craig Small [Sat, 15 Aug 2015 07:10:38 +0000 (17:10 +1000)]
ps: display control group name

The cgroup field while shown as a vector is a concatenated
string, so alot of the complexity of sorting and displaying
has gone.

This change simplifies the cgroup sorting and adds display
and sorting for the name attribute of the cgroup, if found.

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agops: sort by cgroup
Craig Small [Sat, 15 Aug 2015 06:23:37 +0000 (16:23 +1000)]
ps: sort by cgroup

A rather small fix to sort by cgroup. This sorting function
could be used for other string vector entries, but I can't
see why you want to for, say, environment.

Reference:
 https://bugs.debian.org/692279

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agoUpdate NEWS for next version
Craig Small [Sat, 15 Aug 2015 05:42:40 +0000 (15:42 +1000)]
Update NEWS for next version

9 years agoRELEASE 3.3.11 v3.3.11
Craig Small [Sun, 9 Aug 2015 07:54:49 +0000 (17:54 +1000)]
RELEASE 3.3.11

Update NEWS file to number this release.

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agobuild-sys: Update Library Version
Craig Small [Sun, 9 Aug 2015 07:45:19 +0000 (17:45 +1000)]
build-sys: Update Library Version

procps v3.3.11 will bring Library API 5:0:0
The reason for the change is the removal of some calls and
the addition of others. The newlib branch should hopefully
reset some of these changes to a much slower pace.

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agotranslations: Update all and fix Polish
Craig Small [Sun, 9 Aug 2015 07:37:44 +0000 (17:37 +1000)]
translations: Update all and fix Polish

Translation files downloaded from TP.
Polish file fixed for man-po, there were two
bad sequences.

References:
 http://www.freelists.org/post/procps/Bad-sequences-in-the-manpo-translations

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agobuild-sys: include .version in EXTRA_DIST
Craig Small [Sun, 9 Aug 2015 06:27:37 +0000 (16:27 +1000)]
build-sys: include .version in EXTRA_DIST

.version is created in the top_srdir which when building normally
doesn't present a problem. When make distcheck is run, the source
directory is made read-only and it fails with permission denied.

The version of misc/git-version-gen is old and is missing the
instruction to add .version to EXTRA_DIST. This commit does just
that.

make distcheck now passes.

References:
 https://github.com/gagern/gnulib/blob/master/build-aux/git-version-gen
 https://lists.gnu.org/archive/html/bug-gnulib/2011-08/msg00000.html

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agofree: Parse -s option correctly.
Craig Small [Sat, 8 Aug 2015 11:04:01 +0000 (21:04 +1000)]
free: Parse -s option correctly.

If the -s option was the first option on the command line, free
would report seconds argument failed. This only appeared on the
Debian free, not the one in git.

Closer examination revealed that if a valid float string is
given to strtof() it doesn't set errno to 0, but just leaves it
alone. As we are explicitly testing errno for overflows, this
means the previous errno change is picked up here.

The simple answer is to set errno to 0 before calling strtof().

References:
 https://bugs.debian/org/733758
 https://enc.com.au/2015/08/08/be-careful-with-errno/

9 years agoAdd notice in news about vmstat
Craig Small [Sat, 8 Aug 2015 07:14:36 +0000 (17:14 +1000)]
Add notice in news about vmstat

9 years agomiscellaneous: a final cleanup prior to release 3.3.11
Jim Warner [Thu, 6 Aug 2015 13:43:48 +0000 (08:43 -0500)]
miscellaneous: a final cleanup prior to release 3.3.11

This patch just eliminates some eol whitespace, adds a
missing eof newline and contributes yet one additional
entry to the NEWS summary regarding saved top rcfiles.

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agoadd CI badge
Craig Small [Thu, 6 Aug 2015 12:41:44 +0000 (12:41 +0000)]
add CI badge

9 years agoUpdate NEWS entry
Craig Small [Thu, 6 Aug 2015 12:35:02 +0000 (22:35 +1000)]
Update NEWS entry

9 years agops: enable sort by etimes
Craig Small [Thu, 6 Aug 2015 12:08:13 +0000 (22:08 +1000)]
ps: enable sort by etimes

ps has two columns showing the same data which is elapsed time, just
the format is changed:
 etimes - elapsed time in seconds
 etime  - elapsed time in DD-hh:mm:ss

ps used to only sort by etime but not etimes, by making etimes
and alias of etime for sorting both flags work.

References:
 https://bugs.debian.org/794619

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agotop: fix unlikely edge case wherein all fields are off
Jim Warner [Mon, 3 Aug 2015 05:00:00 +0000 (00:00 -0500)]
top: fix unlikely edge case wherein all fields are off

While testing a newlib interface for pids acquisitions
I encountered some unexpected results if an idiot user
(me) turns off all displayable fields. So, this commit
ensures that the PID field will be shown as a minimum.

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: avoid an unnecessary conversion for 'USED' column
Jim Warner [Fri, 31 Jul 2015 05:00:00 +0000 (00:00 -0500)]
top: avoid an unnecessary conversion for 'USED' column

When the USED column was introduced the proc_t.vm_swap
& proc_t.resident values were added together. However,
using 'resident' required an additional PROC_FILL flag
not to mention extra conversion of pages to kibibytes.

So now we'll use an already present vm_rss value which
removes any special handling for top's derived column.

And while we're at it we'll trade some more 'resident'
field uses with that more immediately usable 'vm_rss'.

Reference(s):
commit 709785e20bd19dc28546d19c45bb7444a56f88b9

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: miscellaneous accumulated tweaks to code/comments
Jim Warner [Mon, 27 Jul 2015 05:00:00 +0000 (00:00 -0500)]
top: miscellaneous accumulated tweaks to code/comments

Jeeze, to correct spelling on one single word (incure)
you had to go and align the entire comments paragraph?

[ well, at least there's one other minor code change ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: eliminate 'user' from the inspection view headers
Jim Warner [Mon, 27 Jul 2015 05:00:00 +0000 (00:00 -0500)]
top: eliminate 'user' from the inspection view headers

Since it's possible that euser name is not being shown
or the horizontal position had been scrolled past that
USER column, then part of those headers will be blank.

So it doesn't make sense to try and show the USER that
is associated with a process at all. Thus, this commit
simply removes the 'user' provision from both headers.

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agobuild-sys: Add gitlab CI job file
Craig Small [Tue, 28 Jul 2015 12:47:15 +0000 (22:47 +1000)]
build-sys: Add gitlab CI job file

9 years agoMerge branch 'master' into 'master'
Craig Small [Tue, 28 Jul 2015 12:39:48 +0000 (12:39 +0000)]
Merge branch 'master' into 'master'

Fix readlink anomalies

Noticed minor readlink issues in pidof.c and pwdx.c.

I have fixed them in two separate commits, please see the commit messages for their specific descriptions.

See merge request !5

9 years agow: Adjust command width
Craig Small [Tue, 21 Jul 2015 12:45:02 +0000 (22:45 +1000)]
w: Adjust command width

w would error out if the window size was smaller than 71 or some
other fields through environment grew too big. The code was a little
convoluted as well. The minimum length for command was 3, which is
pretty useless.

This change does the following:
 w doesn't care by default the window size
 w will adjust the command length up and down, to a minimum of 7
characters.
 if the fields don't fit, w will line-wrap each line.

The idea being its better the line-wrap than it is to error out.

References: https://bugs.debian.org/183394

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agow: Fix choice of current process
Craig Small [Tue, 21 Jul 2015 12:25:06 +0000 (22:25 +1000)]
w: Fix choice of current process

If there is a PID wrap-around w will choose the wrong process.
For example:
$ ps x -o pgrp,tpgid,start,tty,cmd | grep pts/3
 3834  3834 21:50:26 pts/3    ssh server
 4461  4461 21:57:14 pts/2    grep pts/3
23410  3834 21:07:17 pts/3    mutt
26071  3834   Jul 13 pts/3    /bin/bash

w will show the user as:
csmall   pts/3    my-laptop:S.1   13Jul15  5:54   1.36s  1.13s /bin/bash

So why?
w scans the process table and has two ways of finding the best match.
 #1 match things like terminal,username and process group, find oldest
 #2 match utmp pid to process tgid

The problem is that #2 trumped #1, which is fine when your login process
is numerically lower than your other processes. However in this case
26071 is larger and appears later in the readdir() than the correct
process, which is 3834.

The fix is not not overwrite best if it already exists.

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agotop: improve vertical scroll management for 'i' toggle
Jim Warner [Sun, 12 Jul 2015 09:44:44 +0000 (04:44 -0500)]
top: improve vertical scroll management for 'i' toggle

When a user is taking advantage of the scroll features
it is likely a scrolled vertical position is well past
the first displayable task. That is especially true of
top's forest view ('V') mode where those early systemd
attached processes are generally not very interesting.

As such, should the idle mode toggle ('i') be employed
a distorted display is almost guaranteed because tasks
that have used some cpu, and thus should be displayed,
have already been skipped by virtue of their position.

So this patch temporarily nullifies vertical scrolling
during the period when idle tasks are not being shown.

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agoFix readlink's do-while-loop
Tobias Stoeckmann [Sat, 11 Jul 2015 19:30:31 +0000 (21:30 +0200)]
Fix readlink's do-while-loop

The function pid_link tries to handle programs which contain very
long paths to their executables. If 1024 bytes are not enough to
contain the path, the loop wants to get more and more space until
the path can fit.

The loop's condition does not fit though.

readlink will never return a value higher than its supplied size
limit, which is "path_alloc_size - 1", therefore the loop-check of
"len == path_alloc_size" will always be false: the loop will never
be repeated.

While at it, the if-condition inside the loop's body can be omitted,
because it is always true.

9 years agoHandle out of memory conditions.
Tobias Stoeckmann [Sat, 11 Jul 2015 19:28:47 +0000 (21:28 +0200)]
Handle out of memory conditions.

malloc and realloc could return NULL when no memory is available.
The code doesn't handle errors, so use xmalloc/xrealloc instead.

While at it, sync alloclen's type with len's type, so both are ssize_t.

9 years agobuild-sys: Clean up libsystemd in configure
Craig Small [Thu, 9 Jul 2015 13:11:40 +0000 (23:11 +1000)]
build-sys: Clean up libsystemd in configure

The previous commit got rid of some but not all the library. The
format of it was a little odd with the library being explicitly
defined instead of letting autoconf do it for you.

9 years agobuild-sys: use merged systemd library
Craig Small [Thu, 9 Jul 2015 12:12:10 +0000 (22:12 +1000)]
build-sys: use merged systemd library

Since systemd 209 released in Feb 2014 three systemd libraries
including systemd-login have been merged. This change merely
checks for, and links to, the new library.

References:
  http://lists.freedesktop.org/archives/systemd-devel/2014-February/017146.html
  https://bugs.debian.org/731256

9 years agoMerge branch 'master' into 'master'
Craig Small [Wed, 8 Jul 2015 12:22:09 +0000 (12:22 +0000)]
Merge branch 'master' into 'master'

Add _XOPEN_SOURCE_EXTENDED definition in WATCH8BIT

This is required for POSIX correctness ([ref]), and additionally is required for building procps against the musl C library.

[ref]: http://lists.gnu.org/archive/html/bug-ncurses/2011-07/msg00004.html

See merge request !4

9 years agoMerge branch 'sigoption1' into 'master'
Craig Small [Wed, 8 Jul 2015 12:08:08 +0000 (12:08 +0000)]
Merge branch 'sigoption1' into 'master'

Fixes to option parsing in kill, skill, pkill.

Hi,

These are some fixes to how kill, skill and pkill handle parameters in the -SIGNUM form.

The handling was incorrect in kill/skill, it was actually not properly truncating argc/argv before removing the -SIGNUM argument. There were some hacks around the code to work around the bug, but using `kill -1` on its own would end up working as if `kill -1 -1` (which means `kill -HUP <all processes>`) was executed. (Yes, it was painful when I accidentally typed it... more than once.)

I also made `kill` print the usage if it only gets a signal number, but no pids (as in the `kill -1` example.)

And `pkill` had similar code but was using a buggy atoi() to try to parse the signal number, which meant that trailing garbage was accepted, so I corrected that by removing the buggy atoi() and letting the already existing code that already accepted numeric signals do its work as supposed to...

I also wanted to tackle the "pgrp" case where a negative number is passed to kill, causing it to kill a process group. The current code is buggy, for instance `kill -TERM -2345` will kill process group 2 and not process group 2345 as supposed to. It should also be possible to pass it multiple pgrps or a mix of pgrps and pids. It's hard to fix that though, considering how getopt_long() works, so I'll defer that for a second pull request.

I tested this fairly well, both manually and made sure there were no regressions in the test suite, also didn't break `make distcheck`.

Let me know if you have any questions or other remarks...

Cheers!
Filipe

See merge request !3

9 years agopkill: reject -signal number with trailing garbage
Filipe Brandenburger [Fri, 5 Jun 2015 05:33:02 +0000 (22:33 -0700)]
pkill: reject -signal number with trailing garbage

This commit prevents pkill from accepting something like `-1garbage` as
a SIGHUP. The previous code was using atoi() which does not check for
trailing garbage and would parse the above as 1.

Handling numeric signals in signal_option() is not really necessary,
since signal_name_to_number() will recognize numeric signals and parse
them properly using strtol() and checking for trailing garbage. It also
checks that the numeric signals are in the proper range. So all we need
to do is remove the buggy numeric signal handling here.

Tested with `pkill -1garbage sleep`, after this patch it will complain
that "1" is not a valid option, which is the expected.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agokill: print usage if no pid is passed in command line
Filipe Brandenburger [Fri, 5 Jun 2015 05:27:03 +0000 (22:27 -0700)]
kill: print usage if no pid is passed in command line

This makes a command such as `kill -TERM` or `kill -9` fails and prints
usage, instead of silently succeeding.

The behavior is consistent with how `kill` behaves without an explicit
signal, or with the behavior of the `kill` builtin in a shell like bash.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agoskill: fix command line with signal, again
Filipe Brandenburger [Fri, 5 Jun 2015 05:07:49 +0000 (22:07 -0700)]
skill: fix command line with signal, again

Have skill_sig_option sanitize the command line by properly decrementing
*argc after moving the arguments to remove the -signal one.

One bug caused by this issue was when running `kill -1`, then the code
would interpret -1 as both SIGHUP and as process group -1 and send
SIGHUP to all of them. Or `kill -28` which would send SIGWINCH to
process group -2 (in another bug, the -pgid support only accepts a
single digit, fix for that bug will follow.)

This also reverts commit 7610b3128e6ac4 ("skill: fix command line with
signal") which worked around this bug in `skill` and also removes the
"sigopt" hack which worked around this bug in `kill`.

The skill_sig_option implementation is compatible with signal_option()
from pgrep.c. I plan to factor them out into a single source file in a
follow up commit, to prevent the duplication.

This commit fixes the issues reported above. I also tested the issues
from commit 7610b3128e6ac4, `skill -9 -t pts/0` works as expected, also
tried `kill` with -signal and a number of pids and it worked as
expected.

Also tested that `make check` and `make distcheck` keep working.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agoAdd _XOPEN_SOURCE_EXTENDED definition in WATCH8BIT
Andrew Wilcox [Sun, 5 Jul 2015 19:37:48 +0000 (14:37 -0500)]
Add _XOPEN_SOURCE_EXTENDED definition in WATCH8BIT

This is required for POSIX correctness (see
http://lists.gnu.org/archive/html/bug-ncurses/2011-07/msg00004.html),
and additionally is required for building procps against the musl C
library.

9 years agosysctl: Correct stat on /etc/sysctl.conf
Victor Ananjevsky [Fri, 26 Jun 2015 13:03:11 +0000 (23:03 +1000)]
sysctl: Correct stat on /etc/sysctl.conf

sysctl --system fails when the file /etc/sysctl.conf doesn't
exists. This happens due to wrong check of stat(2) return code.

Reference:
  https://www.freelists.org/post/procps/sysctl

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agopwdx: Do not link to libprocps
Craig Small [Wed, 24 Jun 2015 12:27:24 +0000 (22:27 +1000)]
pwdx: Do not link to libprocps

pwdx doesn't actually use any of the libprocps functions but
it is linked because it is the default.  This specific LDADD
removes that unrequired linking.

9 years agobuild-sys: tweak to prevent dirty tree with every make
Jim Warner [Sat, 20 Jun 2015 05:00:00 +0000 (00:00 -0500)]
build-sys: tweak to prevent dirty tree with every make

Please let's stop the nls translation insanity. With a
one time push we can eliminate the dirty tree syndrome
which surfaces with every local build. Later, before a
release, the translations can be updated in final form
then pushed just 1 more time to the gitlab repository.

I'm tired of having to always re-issue this request in
order to circumvent the problem and thus prevent a too
broad commit (not to mention some nasty side effects).

[ bash$ git update-index --assume-unchanged po/??.po ]

Reference(s):
http://www.freelists.org/post/procps/procpsng-translations

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: sacrifice a redundant procps_linux_version() call
Jim Warner [Sat, 20 Jun 2015 05:00:00 +0000 (00:00 -0500)]
top: sacrifice a redundant procps_linux_version() call

With the commit referenced below, the linux version is
no longer available via an external variable. So we'll
eliminate the extra superficial function call employed
at program end as part of a debugging (only) o/p spew.

[ the user will soon be returned to the command line ]
[ & he/she can run their own 'uname -r' if in doubt! ]

Reference(s):
commit 56d9d5e7e701e71646679b2b8cefa9239ee59592

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agofix integer overflow on 2GiB+ maps on 32-bit platforms
Yuriy M. Kaminskiy [Sat, 20 Jun 2015 11:39:41 +0000 (21:39 +1000)]
fix integer overflow on 2GiB+ maps on 32-bit platforms

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agomiscellaneous: remove some trailing whitespace buildup
Jim Warner [Fri, 19 Jun 2015 13:41:51 +0000 (08:41 -0500)]
miscellaneous: remove some trailing whitespace buildup

wish folks (craig) would use these in their .gitconfig

[core]
  whitespace = trailing-space, space-before-tab, blank-at-eof
[apply]
  whitespace = warn

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agobuild-sys: fix oversight for a newly added header file
Jim Warner [Fri, 19 Jun 2015 13:34:12 +0000 (08:34 -0500)]
build-sys: fix oversight for a newly added header file

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: Change linux version
Craig Small [Fri, 19 Jun 2015 11:00:46 +0000 (21:00 +1000)]
library: Change linux version

Added function procps_linux_version() which used to be an
exported integer instead.  Also changed the method of obtaining
the linux version (more correctly the os release) to use a specific
procfs entry. This works for both Linux and FreeBSD.

9 years agoUpdate the po files
Craig Small [Fri, 19 Jun 2015 10:36:43 +0000 (20:36 +1000)]
Update the po files

9 years agodocumentation: fix man pages due to refactor for wchan
Jim Warner [Thu, 18 Jun 2015 05:00:00 +0000 (00:00 -0500)]
documentation: fix man pages due to refactor for wchan

This patch will bring three of our man pages into line
with the recent refactor of the libprocps wchan logic.

[ and also eliminates more damn eol whitespace which ]
[ snuck in our repo with the commit referenced below ]

Reference(s):
http://www.freelists.org/post/procps/WCHAN,11
commit cf4788c28dba784a09c8b036a56fffa49da584e7

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: adapt to a simplified library interface for wchan
Jim Warner [Thu, 18 Jun 2015 05:00:00 +0000 (00:00 -0500)]
top: adapt to a simplified library interface for wchan

This patch was made necessary by those library changes
in support of recently revised/simplified wchan logic.

Reference(s):
http://www.freelists.org/post/procps/WCHAN,11

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agops: exploit the simplified library interface for wchan
Jim Warner [Thu, 18 Jun 2015 05:00:00 +0000 (00:00 -0500)]
ps: exploit the simplified library interface for wchan

This patch was made necessary by those library changes
in support of recently revised/simplified wchan logic.

In addition, this commit eliminates a broken alternate
'namelist' provision which was intended to allow users
to specify a System.map file to be used in translating
addresses into function names. But, the real effect of
the now defunct 'N' and '-n' options was to indirectly
force addresses (not names) to be displayed since such
user named map files could not be successfully parsed.

Besides when the required FRAME_POINTER kconfig option
is absent there is no address to translate and when it
is present /proc/PID/wchan is already translated. Thus
an alternate mapping is unnecessary and inappropriate.

[ we'll forgive POSIX for documenting '-n  namelist' ]

Reference(s):
http://www.freelists.org/post/procps/WCHAN,11

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: refactor and rely on modern kernels for wchan
Jim Warner [Thu, 18 Jun 2015 05:00:00 +0000 (00:00 -0500)]
library: refactor and rely on modern kernels for wchan

Several Debian based distributions were recently found
to have omitted a kernel configuration option that had
the effect of rendering /proc/#/stat and /proc/#/wchan
useless for providing any 'sleeping in function' info.

That problem also prompted a reevaluation of the whole
approach to wchan matters which had grown increasingly
complex as our library evolved over the last 13 years.

The net result was a decision to rely on /proc/#/wchan
which arrived along with the 2.5 kernel. This then let
us vastly simplify the internal code plus the external
interface which will benefit both the top and ps pgms.

Reference(s):
http://www.freelists.org/post/procps/WCHAN,11
https://lkml.org/lkml/2008/11/6/12
https://bugs.debian.org/711592

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: correct an alphabetic field error in man document
Jim Warner [Mon, 15 Jun 2015 05:00:00 +0000 (00:00 -0500)]
top: correct an alphabetic field error in man document

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agobuild-sys: do not distribute the aging README.top file
Jim Warner [Tue, 12 May 2015 08:00:00 +0000 (03:00 -0500)]
build-sys: do not distribute the aging README.top file

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: remove procps_version functions
Craig Small [Thu, 18 Jun 2015 12:37:24 +0000 (22:37 +1000)]
library: remove procps_version functions

It doesn't make any sense to have the binary version strings
embedded into the library. The version strings are defined
already either in the Makefile or in include/c.h

9 years agops: update man document to support LXC container names
Jim Warner [Sat, 13 Jun 2015 05:00:00 +0000 (00:00 -0500)]
ps: update man document to support LXC container names

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agops: add code to exploit the new library LXC containers
Jim Warner [Sat, 13 Jun 2015 05:00:00 +0000 (00:00 -0500)]
ps: add code to exploit the new library LXC containers

Reference(s):
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1424253
https://bugs.launchpad.net/ubuntu/+source/procps/+bug/1424253

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: update man document to support the LXC containers
Jim Warner [Sat, 13 Jun 2015 05:00:00 +0000 (00:00 -0500)]
top: update man document to support the LXC containers

[ in addition to the primary 'lxc' business, i found ]
[ numerous apostrophes used instead of that back-tic ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: add support exploiting new library LXC containers
Jim Warner [Sat, 13 Jun 2015 05:00:00 +0000 (00:00 -0500)]
top: add support exploiting new library LXC containers

Reference(s):
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1424253
https://bugs.launchpad.net/ubuntu/+source/procps/+bug/1424253

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: add support for displaying LXC container name
Jim Warner [Sat, 13 Jun 2015 05:00:00 +0000 (00:00 -0500)]
library: add support for displaying LXC container name

This commit adds a lxc container name to every proc_t.
If a process is not running in a container, then a '-'
will be provided, making such a field always sortable.

Unlike other proc_t character pointers, lxc containers
will find many duplicate shared values. So rather than
strdup 'em (with a later free required upon reuse), we
try to keep track of those already seen and share that
address among all tasks running within each container.

We rely on the lines in the task's cgroup subdirectory
which may initially seem somewhat unsophisticated. But
the lxc library itself uses a similar approach when it
is called to list active containers. In that case, the
/proc/net/unix directory is parsed for the '/lxc' eye-
catcher, with potential complications from hashed path
and names that are too long (something we don't face).

[ too bad docker abandoned lxc - our commit won't do ]
[ anything for the users of those kind of containers ]

Reference(s):
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1424253
https://bugs.launchpad.net/ubuntu/+source/procps/+bug/1424253

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: address memory aberration with LXC containers
Jim Warner [Sat, 13 Jun 2015 00:00:00 +0000 (00:00 +0000)]
library: address memory aberration with LXC containers

Under a lxc container, the /proc/meminfo 'MemFree' and
'MemAvailable' amounts will be equal, unless memory is
being limited via cgroups in which case 'MemAvailable'
could exceed that for 'MemTotal'. And when a container
has been nested, there exist additional memory quirks.

A program might then display used or available amounts
greater than total memory (assuming unsigned honored),
or negative values (should a signed cast be employed).

This anomaly primarily impacted the top and free pgms.
Thus, two simple sanity checks have been introduced to
avoid any illogical kb_main_available or kb_main_used.

( Busybox top & free also display anomalous although )
( different results when running in a lxc container. )

Reference(s):
https://bugzilla.redhat.com/show_bug.cgi?id=1153817

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotestsuite: fix ps signals test
Craig Small [Sun, 14 Jun 2015 05:20:48 +0000 (15:20 +1000)]
testsuite: fix ps signals test

On some setups the signals count can change and be truncated. You
will notice this because the number will have "<" prepended. The
testsuite didn't handle this.
You could either get:
         BLOCKED          BLOCKED          BLOCKED           CAUGHT
CAUGHT          CATCHED
0000000000000000 0000000000000000 0000000000000000 00000001f3d1fef9 00000001f3d1fef9 00000001f3d1fef9

or
  BLOCKED   BLOCKED   BLOCKED    CAUGHT    CAUGHT   CATCHED
 00000000  00000000  00000000 <f3d1fef9 <f3d1fef9 <f3d1fef9

9 years agorevert pl.po file
Craig Small [Sat, 13 Jun 2015 23:08:01 +0000 (09:08 +1000)]
revert pl.po file

9 years agoupdate polish po file
Craig Small [Sat, 13 Jun 2015 22:59:53 +0000 (08:59 +1000)]
update polish po file

9 years agoDo not link test process to libprocps
Craig Small [Sat, 13 Jun 2015 22:54:59 +0000 (08:54 +1000)]
Do not link test process to libprocps

The test process introduced at 420cd9c7 incorrectly linked to
libprocps which made the CI runner fail.

9 years agops.1: usernames are truncated
Peggy Russell [Sat, 13 Jun 2015 06:54:23 +0000 (16:54 +1000)]
ps.1: usernames are truncated

ps now truncates usernames and doesn't change them to uids.
Man page is now updated with the correct information

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agoSkip tests where /proc/vmstat unreadable
Craig Small [Sat, 13 Jun 2015 05:13:39 +0000 (15:13 +1000)]
Skip tests where /proc/vmstat unreadable

testsuite would fail if /proc/vmstat was unreadable.
Issue #3 brought up by Mike Frysinger.
test script explicitly checks to see if it is readable and
sets these tests to unsupported if not.

9 years agoCreate test process
Craig Small [Sat, 13 Jun 2015 05:04:31 +0000 (15:04 +1000)]
Create test process

For the test suite, procps used to use sleep which would just
create a process or two to test the tools against.  Some setups
coreutils creates all programs including sleep into one blob which
means a lot of the tests fail, see issue #2

procps has its own sleep program now.

9 years agoprocps: Add a zero-width break point in slabtop.1
David Prévot [Sat, 23 May 2015 20:01:14 +0000 (16:01 -0400)]
procps: Add a zero-width break point in slabtop.1

It allows to distinguish the initial NAME (to be translated) with the
latter one (that must not be translated) and thus permits to handle its
translation differently.

References: https://bugs.debian.org/786643

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agopgrep: prevent buffer overflow in opts
Filipe Brandenburger [Mon, 11 May 2015 18:40:50 +0000 (11:40 -0700)]
pgrep: prevent buffer overflow in opts

Recent commit 9742c74e7c522 ("pgrep: Enable case-insensitive process matching")
caused the "opts" string to overflow the show 32-character space allocated for
it.

Bump it up to 64 bytes, which should be enough even if more options are added.

Tested: Running ./pgrep stopped crashing and `make check` passed.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agoMerge branch 'fix_parallel_build' into 'master'
Craig Small [Wed, 13 May 2015 11:57:10 +0000 (11:57 +0000)]
Merge branch 'fix_parallel_build' into 'master'

build-sys: use proper dependencies on libproc.la

Use `LDADD` or `*_LDADD` instead of `AM_LDFLAGS` to refer to `libproc.la`.

This is recommended in the automake manual:
http://www.gnu.org/software/automake/manual/html_node/Linking.html

Before this commit, parallel builds may break, as there is no explicit dependency to ensure the library is built before the binaries that try to link to it.

Tested by running `make -jNN` repeatedly for different levels of parallelism to ensure the build works. Also checked that `make check` and `make distcheck` still work as expected. Also made sure that a parallel make invocation works with `make -j distcheck`.

Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
See merge request !2

9 years agobuild-sys: use proper dependencies on libproc.la
Filipe Brandenburger [Mon, 11 May 2015 19:31:59 +0000 (12:31 -0700)]
build-sys: use proper dependencies on libproc.la

Use LDADD or *_LDADD instead of AM_LDFLAGS to refer to libproc.la.
Otherwise, parallel builds will break as there is no explicit dependency
to ensure the library is built before the binaries that try to link to
it.

v2: Added empty rules lib_test_*_LDADD to remove the dependency on
libproc which is not used by the lib/test_* binaries.

Tested by running `make -jNN` repeatedly for different levels of
parallelism to ensure the build works. Also checked that `make check`
and `make distcheck` still work as expected. Also made sure that a
parallel make invocation works with `make -j distcheck`.

Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agotranslations: update translations from TP
Craig Small [Sun, 10 May 2015 07:50:19 +0000 (17:50 +1000)]
translations: update translations from TP

9 years agodocs: Update filenames in Makefile too
Craig Small [Sun, 10 May 2015 07:49:11 +0000 (17:49 +1000)]
docs: Update filenames in Makefile too

9 years agopgrep: Enable case-insensitive process matching
William Orr [Sun, 10 May 2015 07:42:09 +0000 (17:42 +1000)]
pgrep: Enable case-insensitive process matching

FreeBSD has case-insensitive matching of processes in pgrep and
pkill, which can be super-useful. This patch uncomments and
documents the code needed to make this work.

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agodocs: Fixed title and linked to bugs
Craig Small [Sun, 10 May 2015 07:36:21 +0000 (17:36 +1000)]
docs: Fixed title and linked to bugs

9 years agodocs: Updated documentation
Craig Small [Sun, 10 May 2015 07:23:54 +0000 (17:23 +1000)]
docs: Updated documentation

Updated the documents with the following general changes:
* Replaced Gitorious with GitLab
* Moved translate stuff out of README
* Changed plain text to markdown (looks better on website)

9 years agoadded a README in markup
Craig Small [Sun, 10 May 2015 06:43:41 +0000 (06:43 +0000)]
added a README in markup

9 years agoMerge branch 'filbranden/procps-build_sys_cleanup_usrbin'
Craig Small [Sun, 10 May 2015 05:28:56 +0000 (15:28 +1000)]
Merge branch 'filbranden/procps-build_sys_cleanup_usrbin'

configure.ac conflict was due to the git url being
changed after the merge request.

Conflicts:
configure.ac

9 years agotests: slabinfo should not be too strict about slab names
dmarc-noreply@freelists.org [Wed, 6 May 2015 22:17:24 +0000 (15:17 -0700)]
tests: slabinfo should not be too strict about slab names

Before this commit, the test checking `vmstat -m` (slabinfo) output uses
a fairly strict regular expression that only allows alphanumeric
characters and a few exceptions such as "_", "-", "(" and ")".

However, recent kernels use a wider range of characters, such as ">".
For instance, see this Linux commit which creates a "page->ptl" slab:
  https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/mm/memory.c?id=b35f1819acd9243a3ff7ad25b1fa8bd6bfe80fb2#n4283

Other patches for reporting slab usage per memcg include the names of
the cgroup in the slabinfo output, which can include additional
characters and use dots for abbreviation.

The check should not be so string, instead it could simply look for a
chain of non-whitespace characters and that should be enough.

Tested that `make check` is still working, including in some of the
environments where features that enable the additional slabinfo names.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agotests: fix regexp in ps_sched_batch.exp to match in first line
dmarc-noreply@freelists.org [Wed, 6 May 2015 22:17:23 +0000 (15:17 -0700)]
tests: fix regexp in ps_sched_batch.exp to match in first line

The current regexp checks for a \s+ in the beginning, however that will
only match if there is a \n in the `ps` output before test-schedbatch,
but that will not happen if test-schedbatch is the first process in the
list, which happens if the PID of test-schedbatch is low enough to bring
it up in the sorted list.

Fix it by enabling newline-sensitive matching with (?n) which then
allows using ^ and $ anchors in the regexp (including an optional \r
introduced by expect.) Matching the end of line also improves checking
that the last field matches 18 exactly and not something like 181, etc.

Tested that `make check` does not break and also fixed the flakiness
seen in an environment with few processes running under the test user
which made the issue more frequent.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agotests: do not mark ps_sched_batch.exp as untested
dmarc-noreply@freelists.org [Wed, 6 May 2015 22:17:22 +0000 (15:17 -0700)]
tests: do not mark ps_sched_batch.exp as untested

Right now the test case is both testing it (expect_pass "$test") and
marking it as untested (untested "$test"), it should do either one or
the other, so stop marking it as untested.

Before this change, these lines appear in testsuite/ps.log or the output
of `make check RUNTESTFLAGS="--all"`:

  PASS: ps SCHED_BATCH scheduler
  UNTESTED: ps SCHED_BATCH scheduler

Note that the second line is confusing, it's implying that the test is
untested, right after having tested it and indicated it passes.

After this change, only the first line will appear.

Tested that both `make check` and `make distcheck` continue working with
this commit.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agorevert ps_sched checks for following commits
Craig Small [Sun, 10 May 2015 05:04:19 +0000 (15:04 +1000)]
revert ps_sched checks for following commits

9 years agoChanged git site to gitlab
Craig Small [Sun, 10 May 2015 04:57:50 +0000 (14:57 +1000)]
Changed git site to gitlab

9 years agopgrep SID=1 is valid
Craig Small [Sat, 9 May 2015 07:53:08 +0000 (17:53 +1000)]
pgrep SID=1 is valid

On most systems the only process with a SID=1 is init
and certainly not a test sleep.  On docker systems this
test program IS on SID=1 and so our "impossible SID" becomes
possible.

9 years agoFix some sched and tty tests
Craig Small [Sat, 9 May 2015 07:48:12 +0000 (17:48 +1000)]
Fix some sched and tty tests

The ps sched test has been disabled. There are too many
odd build farms this fails in strange ways.

Other odd build farms have no tty and so some tests check
for no tty and skip if not found.

9 years agobuild-sys: install binaries in bindir (get rid of usrbin_execdir)
Filipe Brandenburger [Sat, 2 May 2015 06:27:13 +0000 (23:27 -0700)]
build-sys: install binaries in bindir (get rid of usrbin_execdir)

The "usrbin_execdir" hack meant to install some binaries in /bin and
others in /usr/bin. However:

- It is very inflexible: not much control on the final directory name
  and it is not possible to get rid of the usr/bin suffix without
  patching the build system.

- It is hard to use: it requires configure to receive --exec_prefix=/
  and other settings do not make much sense. It is not very obvious that
  that setting needs to be passed and it takes a while to figure it out.

- It produces garbage with the default setup: the default prefix of
  /usr/local ends up installing the binaries under /usr/local/usr/bin
  which does not make any sense.

Furthermore, the requirement to split binaries in /bin and /usr/bin is
not that strong since some distributions adopted the /usr merge and so
would agree to just deploy all binaries to /usr/bin directly.

Distributions that would still like to split /bin from /usr/bin should
actually move binaries such as `ps` and `kill` to /bin after the install
of procps-ng is complete. After all, they are the ones responsible for
determining what are the binaries that need to be in the root partition
and that list depends on their early boot init scripts, so it is
possible that the list must be augmented with other binaries from this
package.

Therefore, I propose here to get rid of that hack and simply install all
the binaries to bindir instead, which solves the problems described
above and simplifies the build and install of procps-ng.

Tested that it builds and both `make check` and `make distcheck` work.

Tested that `make install` works and produces the expected tree, the
only difference being the absence of the bogus /usr/local/usr/bin
directory and now all binaries are merged into /usr/local/bin as
expected.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agobuild-sys: enable "subdir-objects" automake option
Filipe Brandenburger [Fri, 1 May 2015 23:48:21 +0000 (16:48 -0700)]
build-sys: enable "subdir-objects" automake option

Otherwise, automake 1.14 will warn that this option will become the
default in an upcoming release, which will cause problems for the
procps-ng build.

Now that the automake rules were merged in the top level Makefile.am,
it is possible to enable "subdir-objects" without breaking the build or
the dist.

Tested that it builds and both `make check` and `make distcheck` work.

Tested that `make install` works and produces the same tree before and
after this change. Confirmed that binaries are also placed in the same
locations in the build tree.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agobuild-sys: merge automake subdirs into toplevel
Filipe Brandenburger [Sat, 2 May 2015 04:28:53 +0000 (21:28 -0700)]
build-sys: merge automake subdirs into toplevel

This will be required for subdir-objects, otherwise automake will have
problems with more than one Makefile.am having rules to build the same
files.

Tested that it builds and both `make check` and `make distcheck` work.

Tested `make install` and compared the tree with the one installed
before this commit, both installed the binaries to the same locations.
The binaries are also in the same location in the build tree (for
instance, ps/pscommand is still there.)

Checked the binaries for the correct libraries linked into them. Binary
sizes matched before and after this change.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agobuild-sys: drop unneeded $(top_srcdir) from source paths
Filipe Brandenburger [Sat, 2 May 2015 04:36:40 +0000 (21:36 -0700)]
build-sys: drop unneeded $(top_srcdir) from source paths

This is cleaner and we need to match paths exactly when we enable the
subdir-objects automake option.

Out-of-tree builds still work since automake is smart to know these are
source files and that it needs to look for them in $(top_srcdir), so
there is no need to make this explicit.

Tested that it builds and both `make check` and `make distcheck` work.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agobuild-sys: split test cases in lib/ into their own files
Filipe Brandenburger [Sat, 2 May 2015 00:43:51 +0000 (17:43 -0700)]
build-sys: split test cases in lib/ into their own files

In order to avoid compiling the same source files twice, with and
without the TEST_PROGRAM define.

Tested that the build still works and that `make distcheck` works as
expected.

Tested that the test_* programs in lib/ keep working. (Though they are
not really invoked by `make check` and in particular test_nsutils is
quite useless, test_fileutils also quite poor.)

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agobuild-sys: remove AC_PROG_RANLIB from configure.ac
Filipe Brandenburger [Fri, 1 May 2015 23:42:33 +0000 (16:42 -0700)]
build-sys: remove AC_PROG_RANLIB from configure.ac

This suppresses the following warning from libtoolize 2.4.2:

  libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT'

Tested that this does not break the build and that both `make check` and
`make distcheck` continue working as expected.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agobuild-sys: add $(top_srcdir) to include search dir
Filipe Brandenburger [Sat, 2 May 2015 00:09:39 +0000 (17:09 -0700)]
build-sys: add $(top_srcdir) to include search dir

This is required for out-of-tree build to work, since many source files
include e.g. proc/*.h which is not under the include/ directory.

Tested that `make distcheck` starts working after this patch.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agotop: correct a small typo in manual page
Tobias Stoeckmann [Fri, 13 Feb 2015 18:00:00 +0000 (12:00 -0600)]
top: correct a small typo in manual page

Reference(s)
http://www.freelists.org/post/procps/PATCH-typo-in-top1

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: miscellaneous accumulated changes to program code
Jim Warner [Sun, 1 Feb 2015 06:00:00 +0000 (00:00 -0600)]
top: miscellaneous accumulated changes to program code

This commit just tweaks top in the following respects:

. for alphabetic integrity, change 'INSP_hdr...' names

. eliminate the -Wsometimes-uninitialized warning that
was found under OSX Yosemite (llvm 6.0/clang-600.0.56)

. update program 'comments' reflecting copyright dates

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: miscellaneous accumulated changes to man document
Jim Warner [Sun, 1 Feb 2015 06:00:00 +0000 (00:00 -0600)]
top: miscellaneous accumulated changes to man document

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agofree: Use IEC units
Craig Small [Fri, 3 Apr 2015 08:18:58 +0000 (19:18 +1100)]
free: Use IEC units

Free always used 1024 based units but used the confusing old style
kilo,mega etc.

This change changes the names to kibi,mebi for 1024 based divisors
and kilo,mega for 1000 based divisors or IEC units.

It also checks if you try to set two units, e.g free -k -m
Petabyte and Pebibyte have been added.

If you used to use the long options such as --mega these will now
actually print megabytes (they previously printed mebibytes).
The short options are being used on the IEC units

References: https://www.gitorious.org/procps/procps/merge_requests/38

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agopgrep: Off by one in realloc in option handling
Vadim Kaushan [Fri, 3 Apr 2015 07:17:08 +0000 (18:17 +1100)]
pgrep: Off by one in realloc in option handling

The loop that parses options has a of by one bug where the realloc
adds one byte, instead of one list element.  This is exposed when
you try things like:
  pgrep -t,,,,

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agopgrep.1 removed STANDARDS section
Craig Small [Tue, 17 Mar 2015 11:43:22 +0000 (22:43 +1100)]
pgrep.1 removed STANDARDS section

pgrep got updated due to the confusion of the f,l and a flags.
While the newer behaviour is far better but it is no longer following
the ancient Solaris standards, so that got removed.

References: https://bugs.debian.org/752501

9 years agow: fixing missing '-' in the FROM field when empty
Jaromir Capik [Mon, 2 Mar 2015 17:41:07 +0000 (18:41 +0100)]
w: fixing missing '-' in the FROM field when empty

With 99bebff06a058f1ebf794fca1b358d0df73fdd35 a configurable
width of the FROM column was introduced. Unfortunately this
caused a regression in the dash printing. Hopefully fixed
with this commit.

9 years agowatch: treat <ESC>[m as <ESC>[0m
Jaromir Capik [Wed, 25 Feb 2015 17:40:53 +0000 (18:40 +0100)]
watch: treat <ESC>[m as <ESC>[0m

Known terminals call reset in case of empty ANSI sequence.
We should do the same, even when this is not defined by the
ANSI standard.

9 years agoUpdated translations
Craig Small [Sat, 24 Jan 2015 08:09:33 +0000 (19:09 +1100)]
Updated translations

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agopmap: print process even if smaps unreadable
Craig Small [Sat, 24 Jan 2015 07:53:29 +0000 (18:53 +1100)]
pmap: print process even if smaps unreadable

pmap would previously print the process name if
/proc/PID/smaps could be opened, even if subsequent
reads failed.  This actually occurs with other users
PIDs.

Kernel 3.18rc1 introduced a change where the file could
not been opened, meaning pmap -X 1 previously showed
the process name and nothing else but NOW shows nothing
make check failed because of this.

This change prints the process name even before trying to open
the file, returning it to previous behaviour.
Thanks to Vincent Bernat for some analysis.

References:
  https://bugs.debian.org/775624
  https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?id=29a40ace841cba9b661711f042d1821cdc4ad47c

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years ago'slabtop -o' with stdin not a tty would complain
Derek Fawcus [Thu, 15 Jan 2015 13:14:53 +0000 (13:14 +0000)]
'slabtop -o' with stdin not a tty would complain

When the command is executed in one shot mode (-o) with stdin
being something other than a terminal,  the tcgetattr() call
would fail,  and generate an error message. e.g.:

slabtop: terminal setting retrieval: Inappropriate ioctl for device
 Active / Total Objects (% used)    : 905319 / 915886 (98.8%)

Signed-off-by: Craig Small <csmall@enc.com.au>