Commit Graph

106 Commits

Author SHA1 Message Date
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
Philippe Charnier c9a8d1f4dd Correct use of .Nm. Add rcsid. 1998-05-15 06:30:58 +00:00
Dima Ruban 0e3b741814 Add 'f' flag to the optstring. 1998-02-18 22:49:58 +00:00
Dima Ruban 6425bb4314 cosmetic change for optstring 1998-02-18 22:45:22 +00:00
John Dyson dc8ab2b64b Display VSZ much more accurately now. 1998-02-02 05:16:42 +00:00
John Dyson b548141b9b Document the new -f flag.
PR:	5196
Submitted by:	Matt Dillon <dillon@best.net>
1997-12-05 07:35:31 +00:00
John Dyson 3ac5e95583 Add an option to building PS, so that the upages are explicitly paged in only
for users who are root, or in group wheel.  This is useful on large timesharing
systems where a PS command can cause the system to grind to a halt.  The
ability to get the information isn't diminished for those who really need the
additional detail (administrators.)  Normal users won't see any difference unless
the processes are swapped out.  The "really get it mode" is invoked by the
use of an additional flag in the command string "-f".  New/old behavior is
selectable with a compile option.

PR:		5196
Submitted by:	Matt Dillon <dillon@best.net>
1997-12-05 07:33:40 +00:00
Jonathan Lemon 7d4774d0ab Document correct option in manual page.
PR:		3769
Submitted by:	johnp@lodgenet.com
1997-08-19 21:52:07 +00:00
Steve Price 6ad175c69e Use -I${.CURDIR}/../../sys so that the path is relative
to the source code directory.

Submitted by:	bde
1997-08-13 17:35:00 +00:00
Steve Price c1cee2f62b Oops, add #include's (forgotten in last commit) to make this
compile again.
1997-08-11 02:41:02 +00:00