Commit Graph

209 Commits

Author SHA1 Message Date
Thomas Moestl
297cf923e7 The hw.availpages sysctl has an unsigned long value now, fix the retrieval
to match that.
2002-11-01 23:26:20 +00:00
Tim J. Robbins
01e5f16641 Do not print a header line if it would be empty; required by 1003.1-2001. 2002-10-31 13:41:37 +00:00
Robert Watson
2af538eb48 Use the MAC interface to list process MAC labels rather than using
the LOMAC-specific interface (which is being deprecated).  The
revised LOMAC using the MAC framework will export levels listable
using this mechanism.

Approved by:	re
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2002-10-24 00:00:57 +00:00
Bruce Evans
bb2d6f211d Oops, the previous version was a last minute test version with off_t
replaced by int instead of size_t.

Spotted by:	fanf
2002-10-03 17:19:36 +00:00
Bruce Evans
684370e703 Use a non-bogus type for representing the values of offsets in structs.
off_t is for offsets in files, and it is signed so it was no better
than the original type of int for avoiding warnings from broken lints,
except accidentally on machines like i386's where size_t is smaller
than off_t.
2002-10-03 15:00:07 +00:00
John Baldwin
0d6326492b Catch up to SMTX -> SLOCK changes. 2002-10-02 20:33:52 +00:00
Juli Mallett
8dd2eb05bf List valid keywords, ala kill(1), rather than the csh builtin kill, which
tells people to type kill -l, when no valid ones are specified.

Sponsored by:	Bright Path Solutions
MFC after:	4 days
2002-09-27 01:44:30 +00:00
Juli Mallett
36b025da93 Ala kill(1), tell people to type 'ps -L' for a list of format keywords.
Sponsored by:	Rachel Hestilow <rachel@jerkcity.com>
MFC after:	2 weeks
2002-09-27 01:40:30 +00:00
Juli Mallett
362d62ba07 Rename new PLONG type to PGTOK as the conversion is more important than the
size (which is mostly undefined anyway).

Submitted by:	bde
2002-09-17 17:13:52 +00:00
Juli Mallett
760bbf7d6d Conglomerate printing of ps_pgtok'd data into a PLONG type. I couldn't think
of a better name, except PINT, but I decided to go with assuming LONG to
be safe, rather than assuming INT.
2002-09-17 02:52:44 +00:00
Juli Mallett
f3073b05b7 Perform keyword.c:1.27 properly, implement -orss in the New World Order of
ps(1) formatting, using pgtok() to get the value in K, rather than printing
it in pages.  This is consistent with behaviour before keyword.c:1.26 (et al)
which exists in STABLE today, and which uses the same metric as VSZ.

Submitted by:	bde
2002-09-16 20:19:51 +00:00
Juli Mallett
4086fd8e70 Remove some NOTINUSE stuff. Good housekeeping. 2002-09-16 20:06:04 +00:00
Peter Wemm
6327ab9cd1 Do not risk using the kernel pgtok() which assumes the page size is
constant.
2002-09-13 07:13:33 +00:00
Juli Mallett
daed3ad661 Prevent ps(1) from doing idiotic munging of things in a -ofmt= string.
God I hate the backwards compatability crap here.
2002-09-03 05:44:00 +00:00
Tom Rhodes
7d971bbf29 s/filesystem/file system/ as discussed on -developers 2002-08-21 17:32:44 +00:00
Ruslan Ermilov
43cf90aa10 mdoc(7) police: whitespace nits. 2002-08-09 10:49:50 +00:00
Bruce Evans
c1f903a031 Fixed a printf format error that was fatal on alphas. Adding WFORMAT=0
to the Makefile didn't affect this bug because WFORMAT only controls
higher- level format checking (not the -Wformat that is implicit in
-Wall).

Fixed a nearby printf format error that was benign and 3 nearby style bugs.
2002-07-11 17:28:29 +00:00
Matthew Dillon
5ad9e45f96 err() is documented as allowing NULL for the format string but GCC isn't
happy about it any more so change the usage to make buildworld work again.
2002-07-10 20:44:55 +00:00
Juli Mallett
7ed0457457 Bring back WFORMAT=0. 2002-07-08 15:48:39 +00:00
Robert Drehmel
a755f1c9d0 - Use (MAXLOGNAME - 1) where UT_NAMESIZE was used to be able to
(-)remove the inclusions of <utmp.h>.
2002-07-08 09:08:51 +00:00
Juli Mallett
ffe25988bd Make printval() take a 'void *' thus negating any assumptions the compiler
may try to make about the alignment of the dereferenced datum.
2002-07-07 21:45:59 +00:00
Mike Barcroft
0ad736e62b Don't depend on pollution in <limits.h> for the definition of
<stdint.h> macros.
2002-07-05 15:58:27 +00:00
David E. O'Brien
2749b14129 Consistently use FBSDID 2002-06-30 05:15:05 +00:00
Maxim Sobolev
41623b2d75 Don't try to decode old-style options if the argv[1] begins with `-' and the
second character represents some option taking an argument. This fixes
problem when ps(1) is invoked for examply as follows:

$ ps -Ufoobar1234

the above example results in option string being interpreted as
-U foobarp1234 - note extra `p'.

Reported by:	Vladimir Sotnikov <vovan@kyivstar.net>
MFC after:	2 weeks
2002-06-20 14:55:53 +00:00
Juli Mallett
7140a0e9f1 ps(1) appeared in v4
Submitted by:	grog
2002-06-10 22:48:51 +00:00
Juli Mallett
a13d4e42c2 Note early appearence of some commands. These actually appeared in PWB, but
it seems we don't have a macro for that yet, so list them in the first UNIX
release since then that we have a .At for: v7.
2002-06-10 05:03:20 +00:00
Juli Mallett
2dda9fe910 Allow whitespace to act as a delimiter in the keywords list given to the -o,
again, but also allow it in the user-specified header, too.  This is far more
backwards compatible and SUSv3-happy than allowing only comma to seperate the
keywords list.

Submitted by:	tjr
2002-06-08 18:11:52 +00:00
Bruce Evans
b3a3c64940 Fixed unsorting. 2002-06-08 06:49:15 +00:00
Juli Mallett
50355bb408 Don't say that the list of formats can be space delimited, it no longer can be.
Mention that more than one -o will concatenate formats.

Submitted by:	Jun Kuriyama <kuriyama@imgsrc.co.jp>
2002-06-08 05:47:46 +00:00
Juli Mallett
6bb72963c0 Back out previous back out of previously correct code.
Double-plus-pointy-hat to:	jmallett
Submitted by:			bde
2002-06-07 01:14:05 +00:00
Juli Mallett
eb7891df6c Remove tunables to hide warnings that no longer exist. 2002-06-07 00:01:00 +00:00
Juli Mallett
c3f1b5a9db Cast to long to match format. Hidden by revision 1.18 of Makefile. 2002-06-07 00:00:29 +00:00
Juli Mallett
ba2cd77062 Use a global `now' variable for the current time, and initialise it at
startup, right after calling setlocale(3).
2002-06-06 21:21:25 +00:00
Juli Mallett
76e1a9fe48 Implement a SUSv3-ignorant but "time"-similar format for "etime", elapsed
run time (NOT cpu time).  cputime() and elapsed() both need to honour SUSv3
now.
2002-06-06 21:18:37 +00:00
Juli Mallett
4049699b95 sysctlbyname(3) returns -1 on failure, not any other value < 0. 2002-06-06 20:59:15 +00:00
Juli Mallett
e8eef4bb45 Support the SUSv3 `rgroup' format.
Clean up some local style bogons.
2002-06-06 20:42:16 +00:00
Juli Mallett
3d0d5dccc1 Cast arg_max to size_t when comparing it (times 4, plus 1) against SIZE_MAX. I
was worried about truncation of arg_max by this cast, but if it gets truncated,
we know it'll obviously be greater than SIZE_MAX anyway.

Big pointy hat to:	jmallett
Submitted by:		keramida
2002-06-06 20:29:39 +00:00
Juli Mallett
033340171a SUSv3 conform on the "comm" and "args" formats, and make correct the "command"
format, since it's BSDlike, and "comm" is actually different.
2002-06-06 20:21:47 +00:00
Juli Mallett
badfdad910 Refer to the command format by its SUSv3 name (comm), and list command as an
alias.
2002-06-06 18:10:12 +00:00
Juli Mallett
40fea9c3a5 As per behaviour on SVR4 systems, to allow any desirable type of header in the
override, seperate by comma (',') only, rather than any type of whitespace
(the literal space character (' ') had already been removed from this list).

This allows things like:
miamivice# ps -opid='Process
> Identifier'
Process
Identifier
              1350
              1445
              1450

To work.
2002-06-06 18:04:46 +00:00
Juli Mallett
4fa7d7880d Widen the scope of fmt.c::1.19 and consistently use errx(3) if malloc(3) [or
realloc(3)] happens to fail, everywhere in ps(1).

Discussed with:	bde, charnier (a while ago)

fmt_argv() can no longer return NULL, so don't bother checking.

Submitted by:	bde
2002-06-05 18:11:25 +00:00
Juli Mallett
c0716492d4 Comma seperate format lists, since space is no longer up to the task.
Poked by:	David Wolfskill <david@catwhisker.org>
Pointy hat to:	jmallett
2002-06-05 17:31:44 +00:00
Juli Mallett
d9cd71b6e1 Support the 'comm' keyword, which is equivalent to our 'command', but
specified by SUSv3.
2002-06-05 02:05:24 +00:00
Juli Mallett
cf77c2ce9c A space cannot be a header string seperator it appears given the SUSv3
description of ps(1), which uses them.  I question whether newline and tab
can be either, but I'm not touching them.  Yet.
2002-06-05 02:01:46 +00:00
Juli Mallett
6d041cc856 To comply with SUSv3, duplicate the variable contents for each given format,
so that multiple -ovar=header lines do not overwrite eachother.

This means that ps -ouser=USERNAME -ouser=WHO would now possibly print:
USERNAME WHO
juli     juli

Whereas before it would be:
WHO WHO
juli juli
2002-06-05 01:58:36 +00:00
Juli Mallett
05051e2898 Returning NULL here if malloc(3) fails is silly, at this point in the codepath
we have't malloc(3)'d nearly as much as we probably will, so errx(3) away,
instead of waiting for something to fail yet again later on.
2002-06-05 01:36:30 +00:00
Juli Mallett
86f54b9fb8 Remove an XXX comment that seems to be a tiny bit no longer pertinent. This
function seems to do the right thing, and is not a "stub", and whoever "marc"
is, he's had plenty of time to do "the real one", so don't wait around for
him any longer.
2002-06-05 01:33:54 +00:00
Juli Mallett
b69566d8e1 Use of zero here meant many things, NULL, '\0' (NUL), and 0. Sort it out. 2002-06-05 01:32:21 +00:00
Juli Mallett
fdbec39885 Use a const char * where it is meant to be used. There's no reason to try
to discard the const qualifier here.
2002-06-05 01:02:13 +00:00
Juli Mallett
a89d0c4dbc Duplicate the pointer to the string containing the header so it does not get
frobbed when/if the pointer it is actually a part of gets freed.
2002-06-05 01:01:20 +00:00