Commit Graph

315 Commits

Author SHA1 Message Date
Maxim Sobolev
6f15bc16ed Fix slight disorder that broke sorting. Put in bold warning about the
fact that in this case order matters.

Submitted by:	Peter Edwards <pmedwards@eircom.net>
2003-02-05 19:22:39 +00:00
Philippe Charnier
eaed5652bf Display elapsed time (-o etime) using [[dd-]hh:]mm:ss, which according to
Solaris man page is the POSIX way.

Reviewed by:	jmallett
2003-02-05 13:18:17 +00:00
Juli Mallett
78b1878a16 Per-variable\ entry headers, to allow the 'ps -otime -otime=FOO' or similar
case to do the right thing and affect exactly one column.  This is consistent
with GNU ps(1) in BSD mode, and POLA.
2003-01-19 00:31:16 +00:00
Juli Mallett
fde411d5a1 When inserting a non-user-specified (e.g. not via -o or -O) format, don't dupe
one that is already there.  This is consistent with GNU ps(1)'s BSD mode, and
POLA.

Reported by:	Andy Farkas <andyf@speednet.com.au>
Tested by:	Andy Farkas <andyf@speednet.com.au>
2003-01-19 00:22:34 +00:00
Juli Mallett
775bba9fd8 Refer to the process label as proclabel, as there is a function called label,
and that's what these locals were called before.
2003-01-18 03:31:30 +00:00
Ruslan Ermilov
463cfa804d Fixed the abuses of .Ql visible on stderr in troff mode.
PR:		docs/37176
2002-12-23 16:04:51 +00:00
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
Tim J. Robbins
4f18100d73 Respect setting of the COLUMNS environment variable (SUSv3) 2002-06-04 10:20:10 +00:00
Josef Karthauser
d883e289b9 The sysctl has changed from 'kern.ps_showallprocs' to
'security.bsd.see_other_uids'.
2002-05-16 11:51:05 +00:00
Tom Rhodes
ebd4324457 Consistancy check s/file system/filesystem/
Reviewed by:	brian
2002-05-16 01:57:20 +00:00
Josef Karthauser
1063e12617 Replace /kernel with /boot/kernel/kernel.
PR:		docs/37757
Submitted by:	Hiten Pandya <hiten@uk.FreeBSD.org>
2002-05-09 11:47:42 +00:00
Juli Mallett
634d96e194 Check for possible overflow from sysconf _SC_ARG_MAX and error out in a
correct manner.  Revert my incorrect change to use err(3) for malloc(3)
failing.  Use a size_t variable to store the size of the argument buffer
we allocate, and remove silly casts as the result of having this around.
Modify the math in some of the paranoid checks for buffer overflow to
account for the fact we now are dealing with the actual size of the
buffer.  Remove the static qualifier for arg_max, and the bogus setting
of it to -1.

Include <limits.h> for the definitions we use to check for possible
overflows.

Submitted by:	bde
2002-05-05 04:42:50 +00:00
Juli Mallett
3d674c947c Don't cast incorrectly to malloc(3), and don't use errx(3) if malloc(3)
returns NULL, as malloc(3) sets errno.  Use err(3).
2002-05-02 05:46:37 +00:00
Philippe Charnier
e004acc891 Use `The .Nm utility' 2002-04-16 20:08:06 +00:00
Chris D. Faulhaber
a5b0f3020c errx()/strerror() -> err() 2002-04-07 04:59:13 +00:00
Ruslan Ermilov
9f1207d517 Install sys/security/lomac/*.h to /usr/include/security/lomac/.
Install sys/<arch>/include/pc/*.h to /usr/include/machine/pc/.

PR:		docs/29534

Install sys/netatm/*/*.h to /usr/include/netatm/*/.

Don't install compatibility symlinks for <machine/soundcard.h>
and <machine/joystick.h>.  Three years is enough to be aware of
the change, and these weren't visible in the SHARED=symlinks
case.

Back out include/Makefile,v 1.160 that was a null change anyway
due to the bug in the path, and we now don't want to install
these headers because they would otherwise be invisible in the
SHARED=symlinks case.

Don't install IPFILTER headers.  Userland utilities fetch them
directly, and they were not visible in the SHARED=symlinks case.

Resurrect SHARED=symlinks in Makefile.inc1.

PR:		bin/28002

Prodded by:	bde
MFC after:	2 weeks
2002-03-26 16:05:14 +00:00
Robert Watson
7774db9751 NAI DBA update. 2002-03-14 21:51:00 +00:00
Bruce Evans
9880a81276 Fixed unsorting. 2002-02-23 21:00:14 +00:00
Mark Murray
a3dbc1d804 ANSIfy. 2002-02-22 23:31:57 +00:00
Matthew Dillon
d9a5f8900a Revert wchan functionality. Add 'mwchan' to supply new duel mutex/msleep
functionality and make it the default.

With additional improvements by: Mark Peek <mp@FreeBSD.org>
2002-02-21 18:27:16 +00:00
Warner Losh
576541a9e6 Fixed divots that I created when I moved prototypes of group_from_gid
and user_from_uid to grp.h and pwd.h.  Update the man pages.

Submitted by: David Malone
Pointy hat to: imp
2002-02-19 00:05:59 +00:00
Matthew Dillon
ebc1fff946 When blocked on a mutex, display the mutex name via the wchan string field
so we can at least tell the difference between being blocked in Giant
and being blocked in some other mutex.
2002-02-16 20:10:00 +00:00
Dag-Erling Smørgrav
3ab6656108 Document the 'M' state. 2002-02-16 18:47:22 +00:00
Kris Kennaway
6a99036a7f Correct inadvertent style botches in previous commit. 2002-02-04 03:06:51 +00:00
Kris Kennaway
afe781faa2 Lock down with WFORMAT=1 except those directories with unfixed warnings.
Tested on i386 and alpha.
2002-02-04 02:49:19 +00:00
Mark Murray
871e8d8c59 WARNS=4 fixes (incomplete, so set NO_WERROR), and lots of extra
cleanup courtesy of automatic checking (lint).
2002-02-03 14:43:04 +00:00
Warner Losh
46251dde8f o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
  they already are.
2002-02-02 06:48:10 +00:00
Ruslan Ermilov
9e1c120c8e Remove a stray :' after v' in the getopt() call.
Submitted by:	bde
2002-01-28 13:43:22 +00:00
Ruslan Ermilov
831c910a30 GC the -W option. kvm(3) doesn't read swap for almost 10 years.
PR:		docs/34134
Reviewed by:	bde, peter
MFC after:	1 month
2002-01-28 09:43:26 +00:00
Mike Heffner
6b8a6a6e6c Prevent overflowing the buffer that stores the command arguments.
PR:		bin/19422
Not objected to by: -audit
MFC after:	3 weeks
2002-01-20 01:30:40 +00:00
Maxim Sobolev
f1ff35aecb Add missed includes.
Reviewed by:	md5
2002-01-15 12:23:52 +00:00
Peter Wemm
a2e4c36a49 Put the "mtxname" keyword in alphabetical order (t comes after s) so
that the keyword is recognized.
2002-01-05 12:19:51 +00:00
Ruslan Ermilov
b5f8218042 mdoc(7) police: s/LKM/KLD/, sort xrefs. 2001-12-04 14:17:52 +00:00
David E. O'Brien
a748290789 Default to WARNS=2. Binary builds that cannot handle this must explicitly
set WARNS=0.

Reviewed by:	mike
2001-12-04 01:57:47 +00:00
Brian Feldman
7304f61f9e Add LOMAC options (the "Z" flag in both cases) to display extra information
in ls(1) and ps(1).

Sponsored by:	DARPA, NAI Labs
2001-11-26 22:21:15 +00:00
Julian Elischer
b40ce4165d KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha
2001-09-12 08:38:13 +00:00
Peter Wemm
85012e7c95 UPAGES as a constant is gone in KSE. We are going to have to trust
and/or fix ki_rssize.
2001-09-10 07:19:26 +00:00
Peter Wemm
7d1192a784 On today's kernels masking with ~KERNBASE is turning out to be less
than useful.  It still hits at least 8 digits. Adjust for reality.

This is still not satisfactory for the alpha if you add "-O paddr".
2001-08-24 09:56:44 +00:00
Peter Wemm
fbb75ab833 Handle kvm_getprocs() returning nothing. Dont pass -1 to a size
for malloc().
2001-08-24 09:53:26 +00:00
Brian Somers
380434d488 Only capitalise the last `t' in ps's first argument when it's
actually part of an option argument.

Submitted by:	Chris Costello <chris@calldei.com>
MFC after:	6 weeks
2001-08-16 02:41:42 +00:00
Ruslan Ermilov
caa2db3be9 mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 10:04:09 +00:00
Tor Egge
564efb8fec Check for the PS_SINTR flag in the right field of struct kinfo_proc
(ki_sflag).
2001-06-16 21:39:29 +00:00
Dima Dorfman
7fa34c1180 Correct a typo.
Submitted by:	Alexey V. Neyman <avn@any.ru>
2001-06-08 04:41:21 +00:00
Dima Dorfman
6b8212280b Mention the kern.ps_showallprocs sysctl.
PR:		24804
Submitted by:	Mike Meyer <mwm@mired.org>
2001-06-02 04:02:36 +00:00
Warner Losh
5782e27253 Use PATH_MAX rather than MAXPATHLEN. 2001-05-30 03:27:07 +00:00
Ruslan Ermilov
3ab9a9d0e0 Removed -I${.CURDIR}/.../sys from CFLAGS. 2001-05-18 13:41:42 +00:00
Mark Murray
25bba4f6ad Depollute headers now that the VM headers DTRT. 2001-05-03 11:49:44 +00:00
Mark Murray
325a83b456 Compensate for header dethreading. 2001-05-01 08:39:23 +00:00
Brian Somers
cdf6f0b1ae Correct some markup
Submitted by:	bde
2001-04-12 20:04:54 +00:00
Brian Somers
ff1b168b6e Introduce -osid and -otsid
Submitted by: dd
2001-04-11 22:42:54 +00:00
Brian Somers
48b2c871df Remove tsess for now.
This (and sess) may come back shortly.
2001-04-07 11:22:26 +00:00
Brian Somers
86aca2117b Update documentation in line with what the code does
PR:		25435
Submitted by:	dd
Forgotten by:	mckusick
2001-04-07 11:16:41 +00:00
Brian Somers
52f8369e69 The sess column went away last December with v1.26 of keyword.c
Remove it from ``jfmt''.

Forgotten by: mckusick
2001-04-07 02:53:35 +00:00
Andrey A. Chernov
f59105eedb Small optimization: set use_ampm only when needed 2001-03-03 01:46:58 +00:00
Andrey A. Chernov
080175194f Use AM/PM time only when available in locale 2001-03-02 23:53:36 +00:00
David E. O'Brien
3f83ed9d1c Fix style bug I introduced with rev 1.13 (rcsid after includes).
Along with CSRG id lossage in rev 1.11.

Submitted by:	bde
2001-02-28 11:06:04 +00:00
David E. O'Brien
f0ba626a0d Add rcsid. 2001-02-27 10:50:06 +00:00
Jonathan Lemon
f6213d478d Do not coredump if no options are supplied. (ps -o,)
Submitted by: rgrimes
Obtained from: NetBSD
2001-02-14 18:54:34 +00:00
Jake Burkholder
4c85452ba9 Catch up to new priority interface. 2001-02-12 00:21:38 +00:00
Andrey A. Chernov
8073a93c76 Use decimal point from locale 2001-02-11 02:25:56 +00:00
Ruslan Ermilov
d0353b836e mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:38:02 +00:00
John Baldwin
e0aa5ab718 - Catch up to new proc flags. 2001-01-24 12:59:50 +00:00
Kirk McKusick
640b0e0895 Restore the rss (-u) keyword that got deleted in my somewhat over-zealous
cleanup effort.

Submitted by:	Mark Peek <mark@whistle.com>
2000-12-16 02:01:05 +00:00
Ruslan Ermilov
12e720d78b Prepare for mdoc(7)NG. 2000-12-15 17:37:31 +00:00
Kirk McKusick
1f7d250182 Change the proc information returned from the kernel so that it
no longer contains kernel specific data structures, but rather
only scalar values and structures that are already part of the
kernel/user interface, specifically rusage and rtprio. It no
longer contains proc, session, pcred, ucred, procsig, vmspace,
pstats, mtx, sigiolst, klist, callout, pasleep, or mdproc. If
any of these changed in size, ps, w, fstat, gcore, systat, and
top would all stop working. The new structure has over 200 bytes
of unassigned space for future values to be added, yet is nearly
100 bytes smaller per entry than the structure that it replaced.
2000-12-12 07:25:57 +00:00
John Baldwin
9b67ac593b Document the mtxname keyword.
Reviewed by:	sheldonh
2000-11-30 19:17:56 +00:00
John Baldwin
fd5f30bf38 Introduce a 'mtxname' keyword that displays the current mutex that a
process is blocked on or '-'.
2000-11-29 21:09:21 +00:00
Ruslan Ermilov
be8b149795 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 11:39:41 +00:00
Chris D. Faulhaber
2d45aed6bc Remove obsolete /dev/drum references
Reviewed by:	alex, asmodai, billf
2000-10-29 12:19:52 +00:00
Kris Kennaway
63743cbd8c No need to work around SCCS variable expansion any more. 2000-09-28 02:54:44 +00:00
Brian Somers
cf22dcfc33 Support multiple (comma separated) names as arguments to -U
PR: 11051
2000-09-26 01:03:16 +00:00
Jason Evans
0384fff8c5 Major update to the way synchronization is done in the kernel. Highlights
include:

* Mutual exclusion is used instead of spl*().  See mutex(9).  (Note: The
  alpha port is still in transition and currently uses both.)

* Per-CPU idle processes.

* Interrupts are run in their own separate kernel threads and can be
  preempted (i386 only).

Partially contributed by:	BSDi (BSD/OS)
Submissions by (at least):	cp, dfr, dillon, grog, jake, jhb, sheldonh
2000-09-07 01:33:02 +00:00
Will Andrews
f8c9c11c5c Fix the exit code for the case where nentries == 0; if a PID doesn't exist,
ps(1) should not be returning a success code (0), it should return an
error code (1).  This was fixed on OpenBSD over 3 years ago.

PR:		19069
Submitted by:	Jim Sloan <odinn@atlantabiker.net>
Reviewed by:	rwatson
2000-07-08 05:13:10 +00:00
Peter Wemm
821079e9be I'm probably jumping the gun, but what the heck, this is -current.
Turn off setgid-kmem for /bin/ps, it's now quite functional without it.
ps no longer needs /dev/*mem or /proc.  (It will still use some /proc
files if they are available for -e, but it's not required, so it'll
happily run in a jail or chroot).

The proc stats are now part of eproc (obtained via sysctl) and no longer
needs to beat up the u-page reading code and the problems with that.

This also has the side effect of disabling 'ps -e' for normal users
*EXCEPT* when looking at their own processes.  ie: they can see
environments in processes with their uid, enforced by the ownership of
/proc/*/mem.  Root can still see them all, as it can open all /proc/*/mem.
1999-11-17 13:37:30 +00:00
Peter Wemm
602a69d61e Use eproc.e_stats, not a series of crude hacks to fetch it from the u-area.
Also, fix some indentation that got messed up somehow..
1999-11-17 12:52:42 +00:00
Poul-Henning Kamp
b9df5231ca Introduce commandline caching in the kernel.
This fixes some nasty procfs problems for SMP, makes ps(1) run much faster,
and makes ps(1) even less dependent on /proc which will aid chroot and
jails alike.

To disable this facility and revert to previous behaviour:
        sysctl -w kern.ps_arg_cache_limit=0

For full details see the current@FreeBSD.org mail-archives.
1999-11-16 20:31:58 +00:00
Kris Kennaway
bdfebd8480 Typo (appropiate -> appropriate)
Obtained from:	OpenBSD (inspired by)
1999-11-15 03:37:57 +00:00
Peter Wemm
2a4562393f $Id$ -> $FreeBSD$ 1999-08-27 23:15:48 +00:00
Kris Kennaway
f58bcbc97e Correct reference to the obsolete vadvise() to madvise() (with appropriate
arguments)

PR:		11586
Submitted by:	David Gilbert <dgilbert@velocet.ca>
Reviewed by:	Doug Rabson
1999-06-30 11:50:09 +00:00
Kris Kennaway
46be34b902 Various spelling/formatting changes.
Submitted by: Philippe Charnier <charnier@xp11.frmug.org>
1999-05-08 10:22:15 +00:00
Poul-Henning Kamp
75c1354190 This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing.  The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.

For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact:  "real virtual servers".

Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.

Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.

It generally does what one would expect, but setting up a jail
still takes a little knowledge.

A few notes:

   I have no scripts for setting up a jail, don't ask me for them.

   The IP number should be an alias on one of the interfaces.

   mount a /proc in each jail, it will make ps more useable.

   /proc/<pid>/status tells the hostname of the prison for
   jailed processes.

   Quotas are only sensible if you have a mountpoint per prison.

   There are no privisions for stopping resource-hogging.

   Some "#ifdef INET" and similar may be missing (send patches!)

If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!

Tools, comments, patches & documentation most welcome.

Have fun...

Sponsored by:   http://www.rndassociates.com/
Run for almost a year by:       http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
Peter Wemm
3d28e3ed4e Update p_flags doc. 1999-04-06 03:18:57 +00:00
Peter Wemm
4a40c5e7ee Look at p_lock instead of P_NOSWAP etc as an indicator of unswappability.
(While here, put a #ifndef pgtok around the macro that gets a redefinition
 warning)
1999-04-06 03:17:57 +00:00
Bill Paul
bb22740673 On FreeBSD/alpha, ps(1) does not correctly report process start times
and CPU runtime because it can't access the user area via /proc/<pid>/mem.
This is because the uarea is not mapped into the process address space
at USRSTACK on the alpha like it is on the x86.

Since I'm haven't been able to wrap my brain around the VM system enough
to be able to figure out how to achieve this mapping, and since it's
questionable that such an architectural change is correct, I implemented
a workaround to allow ps(1) to read the uarea from /dev/kmem using
kvm_read() instead of from the process address space via kvm_uread().
The kludge is hidden inside #ifdef __alpha__/#endif so as not to impact
the x86. (Note that top(1) probably uses this same gimmick since it works
on FreeBSD/alpha.)

Reviewed by: dfr
1999-04-01 14:45:18 +00:00
Julian Elischer
88c5ea4574 Enable Linux threads support by default.
This takes the conditionals out of the code that has been tested by
various people for a while.
ps and friends (libkvm) will need a recompile as some proc structure
changes are made.

Submitted by:	"Richard Seaman, Jr." <dick@tar.com>
1999-01-26 02:38:12 +00:00
Julian Elischer
d8c85307b2 Re-enable the options in ps(1) that were disabled with the Linux
threads support.

Submitted by:	"Richard Seaman, Jr." <dick@tar.com>
1999-01-13 03:11:43 +00:00
Julian Elischer
6626c6045c Reviewed by: Luoqi Chen, Jordan Hubbard
Submitted by:	 "Richard Seaman, Jr." <lists@tar.com>
Obtained from:	linux :-)

Code to allow Linux Threads to run under FreeBSD.

By default not enabled
This code is dependent on the conditional
COMPAT_LINUX_THREADS (suggested by Garret)
This is not yet a 'real' option but will be within some number of hours.
1998-12-19 02:55:34 +00:00
Bruce Evans
b98f433d36 Fixed -Wall regression (broken in rev.1.12). Removed unused includes. 1998-12-07 10:25:48 +00:00
Doug Rabson
eb235b13c7 Fix formatting of %CPU value on alpha.
Submitted by: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
1998-11-25 09:34:00 +00:00
Doug Rabson
3929d51888 Portability fixes when sizeof(int) != sizeof(long). 1998-09-14 08:32:20 +00:00
Bruce Evans
e36039e731 Fixed breakage of %CPU and %MEM in the previous commit. sysctlbyname()
was called with wrong args so it always failed.

PR:		7881
1998-09-10 18:06:28 +00:00
Poul-Henning Kamp
85082fc3c3 Pick up kernel variables/constants using sysctl rather than through /dev/mem
Use /dev/null for opening the kvm library, we don't need access to /dev/mem
anymore.

ps can now run without the setgid(kmem) bit.  If it does it will not be
able to show argv/envp for another uid's processes unless you are root.
1998-06-30 21:34:14 +00:00
Bruce Evans
ce0cab88c1 Fixed printf format errors (second round with non-i386 typedefs). 1998-06-28 21:05:48 +00:00
Bruce Evans
86e14119e9 Oops, the previous log message should have read "Fixed type mismatches -
don't assume that time_t is long".
1998-06-28 18:26:18 +00:00
Bruce Evans
f8ec5fe282 Fixed printf format errors. 1998-06-28 18:19:13 +00:00
Joseph Koshy
c7bca09356 Remove compile time dependency on ARG_MAX.
PR: 1791 (partial)
Reviewed by: Bruce Evans <bde@freebsd.org>, Tor Egge <tegge@freebsd.org>
1998-06-17 11:33:10 +00:00
Joseph Koshy
55cb6cf5fb Fix errors that crept into the previous commit. 1998-06-04 07:02:59 +00:00
Joseph Koshy
77027e301b 1. ps' output now shows 3 characters in the TT' field, not 2, after
rev 1.6 of "ps.c".
2. Reword description of `-f' option.

PR: 5340
Submitted by: Jorge Goncalves <j@bug.fe.up.pt>
1998-06-04 06:46:13 +00:00
Bruce Evans
5832a75246 Fixed imperfections in previous commit (a poor variable name,
excessive 64-bit arithmetic, and excessive changes).
1998-05-31 12:09:50 +00:00
Poul-Henning Kamp
e796e00de3 Some cleanups related to timecounters and weird ifdefs in <sys/time.h>.
Clean up (or if antipodic: down) some of the msgbuf stuff.

Use an inline function rather than a macro for timecounter delta.

Maintain process "on-cpu" time as 64 bits of microseconds to avoid
needless second rollover overhead.

Avoid calling microuptime the second time in mi_switch() if we do
not pass through _idle in cpu_switch()

This should reduce our context-switch overhead a bit, in particular
on pre-P5 and SMP systems.

WARNING:  Programs which muck about with struct proc in userland
will have to be fixed.

Reviewed, but found imperfect by:       bde
1998-05-28 09:30:28 +00:00
Steve Price
ad863cac06 If no value is present for the login name set it to '-'.
Also pretty-up the display of 'ps -Ortprio'.

PR:		4947
Submitted by:	Martin Kammerhofer <dada@sbox.tu-graz.ac.at>
1998-05-25 05:07:18 +00:00