Commit Graph

14 Commits

Author SHA1 Message Date
John Polstra
882cdc116d When recording the original arguments, stop short if we encounter
a NULL argument.  Some programs change the contents of the argv
array, typically to remove some special arguments.  They shorten
argv by storing a NULL where an argument pointer used to be.  Such
programs core dumped if they called setproctitle(), because it
would try to apply strlen() to a NULL pointer.
2000-12-04 01:45:57 +00:00
John Polstra
4113386c62 When recording the original arguments, don't (ab)use "nargc" for
iterating over the arguments.  Doing so wipes out the value which
is about to be stored into the ps_strings structure.
2000-12-04 01:26:29 +00:00
Paul Saab
305ad8f908 If the format string passed to setproctitle begins with a '-'
character, skip the program name when setting the process title.
Ansified with extreme prejudice.

Reviewed by:	peter
2000-08-01 06:37:09 +00:00
Brian Somers
0675e24de0 Make setproctitle(NULL) restore all of the original arguments
(if it's able).
1999-11-17 21:12:17 +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
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Bruce Evans
d529713846 Adjust for kern.ps_strings and PS_STRINGS not being a pointer. This is
an unimprovement here.  I thought it would be an improvement, as in libkvm,
but here we can access the strings directly.

Use sysctlbyname() instead of sysctl() and trust it to give a nonzero
address if it succeeds.
1998-12-16 17:34:05 +00:00
David Greenman
ec3a3b4594 Oops, revert part of a diff that wasn't supposed to have been committed. 1998-04-28 07:02:33 +00:00
David Greenman
214bed53a2 Cache the results of the ps_strings sysctl so that it doesn't have to be
redone for every call of setproctitle().
1998-04-28 06:59:14 +00:00
Peter Wemm
7e546392b5 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Jordan K. Hubbard
51295a4d3e General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>
1996-07-12 18:57:58 +00:00
Peter Wemm
7350dd84a0 If the two recently added sysctl variables exist, use those rather than
the statically compiled PS_STRINGS and USRSTACK variables.  This prevents
programs using setproctitle from coredumping if the kernel VM is increased,
and stops libkvm users (w, ps, etc) from needing to be recompiled if only
the VM layout changes.
1996-02-24 14:37:30 +00:00
Peter Wemm
0050777196 Bring in an initial version of setproctitle().. This is intended to
replace the dozen other various hacks in the code that do all sorts
of crude things including spamming the envrionment strings with the new
argv string.

This version is mainly inspired by the sendmail version, with a couple of
ideas taken from the NetBSD implementation as well.
1995-12-26 22:50:08 +00:00