Commit Graph

39 Commits

Author SHA1 Message Date
Craig Small
ccb6ae8de1 library: cleanup of library includes
The includes used to define a lot of things a library include
should not. It was also a bit messy what was exposed in the library
and what was not.

get_pid_digits -> procps_pid_length and exported correctly

MALLOC attribute move into relevant .c files
NORETURN attribute moved to relevant .c, not used in library
PURE attribute removed, it wasn't used
KLONG/KLF/STRTOUKL were fixed for long, so now just use long

HIDDEN attribute removed. It was for 3 functions. The PROCPS_EXPORT
seems to do the same (opposite) thing.

likely/unlikely removed from most places, its highly debateable
this does anything useful as CPUs have gotten smarter about branches.

Re-arranged the includes, ALL external programs should just #include
<proc/procps.h> then proc/procps.h includes headers for files that
have exported functions. procps.h and the headers it includes should
not use items that are not exportable (e.g. hidden functions or
macros) they go in procps-private.h
2016-04-16 17:03:57 +10:00
Craig Small
471cf4cd36 Merge branch 'master' into newlib
Conflicts:
	pgrep.c
	proc/sysinfo.c
	ps/output.c
	skill.c
	top/top.c
	top/top.h
	w.c
2015-10-28 21:09:26 +11:00
Craig Small
b2f49b105d Closes: #9 ps: Remove Unix98 output limitations
ps previously followed the Unix98 standard when it comes to
user-defined output, sometimes. This meant you could have
user output format with a header that included commas and
equals signs. It was dependent on if ps thought you wanted
sysv or bsd format and THAT was dependent on things in previous
options.

It was very confusing to a user because
 ps p $$ -o pid=,comm=
gave you a two-column output but
 ps -p $$ -o pid=,comm=
would give you a one column output with the header ",comm="

The -p versus p means (to ps) you want sysv or bsd parsing.
Unix98 standard or not, this is plainly just silly.

The commit removes any of the quirks Unix98 has with user defined
output.  If you really wanted a ps header with commas in the output,
today isn't your day.

Signed-off-by: Craig Small <csmall@enc.com.au>
2015-10-26 11:18:52 +11:00
Jim Warner
584028dbe5 ps: exploit those new <pids> task/threads capabilities
This commit represents the ps transition to the <pids>
'stacks' interface. While an effort to minimize impact
on existing code was made (as with a disguised proc_t)
the changes were still extensive. Along the way, a few
modifications beyond simply conversion were also made.

------------------------------------------------------
Here's a brief overview the design of this conversion:

. The need to satisfy relative enum requirements could
not easily have been made table driven since any entry
in the format_array might require several <pids> items
in support. So I decided to allow every print function
to contribute its own relative enums once the decision
as to exactly what will be printed had been finalized.

. A similar approach was taken for sorting, since it's
possible to have sort keys that will not be displayed.
Here, I relied on the existing print extensions above.

. In summary, just prior to printing ps walks thru two
lists one time (the format_list & sort_list) and calls
each print function. That function does not print, but
sets its required enum if necessary. Later, when those
same functions are called repeatedly for every printed
line, the only overhead will be an if test and branch.

------------------------------------------------------
Below is a summary of major changes beyond conversion:

. Sorts are now the responsibility of the library. And
therefore the total # of sortable fields substantially
increased without effort. Additionally, several quirky
fields remain as sortable, even though they can't ever
be printed(?). Surely that must make sense to someone.

[ while on this subject of sort, please do *not* try ]
[ to sort old ps on 'args'. or better yet, if you do ]
[ try that sort, see if you can determine his order, ]
[ without peeking at the source. that one hurts yet! ]

. All logic dealing with the old openproc flags and ps
struct members known as 'need' have been whacked since
that entire area was solely the new library's concern.

. Remaining malloc/calloc calls to stdlib were changed
to xmalloc/xcalloc from our own include/xalloc.h file.
None of the replaced calls ever checked return values.

[ be aware that 2 minor potential memory leaks exist ]
[ depending on command line arguments. no attempt is ]
[ made to free dynamically acquired format/sort node ]
[ structures upon return; a conscious design choice. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-10-05 21:52:08 +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
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
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
Jim Warner
dd194da7ec ps: change PACKAGE_BUGREPORT to procps@freelists.org 2012-01-05 09:56:05 +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
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
4bd36d1483 ps: add gettext support
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:45 +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
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
Sami Kerola
71d10d3a49 name change: procps -> procps-ng
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-04 20:50:12 +02:00
albert
7dd414ac1b new /proc/meminfo fields 2008-03-24 04:41:26 +00:00
albert
f7603be903 oops, IRIX personality fix 2005-10-30 00:27:45 +00:00
albert
b2ca4a892a IRIX personality PRI 2005-10-30 00:26:34 +00:00
albert
0586dc8b6d fix warnings; put CFLAGS on lib link command 2004-09-23 13:41:33 +00:00
albert
6a48d37343 ps: add k and -x 2004-04-26 00:47:31 +00:00
albert
3f49530d77 new -M and Z options for security data 2004-03-27 03:55:52 +00:00
albert
c36c11c6b2 NSA SELinux for Linux 2.6.xx 2003-12-24 04:18:24 +00:00
albert
7dfe80961a sorted threads might work 2003-10-19 23:37:47 +00:00
albert
3a16c12ce3 top on wyse60, whitespace doc, thread fixes 2003-10-07 03:12:50 +00:00
albert
71312f1516 more per-process stuff 2003-09-29 04:09:52 +00:00
albert
35859fb0a8 ugly wart gone 2003-09-28 17:23:29 +00:00
albert
d611d4e66f any leftover changes 2003-09-17 17:14:32 +00:00
albert
360e6533c9 misc 2003-08-16 21:15:53 +00:00
albert
0db94e6a1a GPLONLY_ and PID-related stuff 2003-07-03 05:20:19 +00:00
albert
0a03eac352 malloc error 2003-01-23 05:48:27 +00:00
albert
3e67b58ec2 satisfy GPL section 2a and LGPL section 2b name+date requirement 2002-12-15 00:30:17 +00:00
albert
4b57916ac9 ps --sort bug 2002-10-14 05:12:14 +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
e96d6b6141 Avoid opening System.map just to check it, etc. 2002-10-02 12:10:39 +00:00
albert
7b1aebf7c4 label: } 2002-10-02 00:33:56 +00:00
albert
84ed57020d ifdef and cruft removal 2002-09-30 07:11:30 +00:00
csmall
cd2727983c added SELINUX patches 2002-09-27 13:48:00 +00:00
csmall
03a9b5a30f procps 010114 2002-02-01 22:47:29 +00:00