Vendor supplied patches to fix procname ($0)

This commit is contained in:
markm 2000-08-20 08:43:07 +00:00
parent 2618fad5bb
commit 259bd53c06
5 changed files with 67 additions and 1 deletions

View File

@ -487,6 +487,7 @@ d_setpgrp2=''
d_bsdsetpgrp=''
d_setpgrp=''
d_setprior=''
d_setproctitle=''
d_setpwent=''
d_setregid=''
d_setresgid=''
@ -620,6 +621,7 @@ i_grp=''
i_iconv=''
i_ieeefp=''
i_inttypes=''
i_libutil=''
i_limits=''
i_locale=''
i_machcthr=''
@ -995,7 +997,7 @@ defvoidused=15
libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
libswanted="$libswanted dld ld sun m c cposix posix"
libswanted="$libswanted ndir dir crypt sec"
libswanted="$libswanted ucb bsd BSD PW x iconv"
libswanted="$libswanted ucb bsd BSD PW x iconv util"
: We probably want to search /usr/shlib before most other libraries.
: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
@ -10934,6 +10936,10 @@ eval $inlibc
set setpriority d_setprior
eval $inlibc
: see if setproctitle exists
set setproctitle d_setproctitle
eval $inlibc
: see if setpwent exists
set setpwent d_setpwent
eval $inlibc
@ -14175,6 +14181,10 @@ eval $inhdr
set ieeefp.h i_ieeefp
eval $inhdr
: see if this is a libutil.h system
set libutil.h i_libutil
eval $inhdr
: see if locale.h is available
set locale.h i_locale
eval $inhdr
@ -15321,6 +15331,7 @@ d_setpgid='$d_setpgid'
d_setpgrp2='$d_setpgrp2'
d_setpgrp='$d_setpgrp'
d_setprior='$d_setprior'
d_setproctitle='$d_setproctitle'
d_setpwent='$d_setpwent'
d_setregid='$d_setregid'
d_setresgid='$d_setresgid'
@ -15467,6 +15478,7 @@ i_grp='$i_grp'
i_iconv='$i_iconv'
i_ieeefp='$i_ieeefp'
i_inttypes='$i_inttypes'
i_libutil='$i_libutil'
i_limits='$i_limits'
i_locale='$i_locale'
i_machcthr='$i_machcthr'

View File

@ -1837,6 +1837,12 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un-
*/
#$d_setpent HAS_SETPROTOENT /**/
/* HAS_SETPROCTITLE:
* This symbol, if defined, indicates that the setproctitle routine is
* available to set process title.
*/
#$d_setproctitle HAS_SETPROCTITLE /**/
/* HAS_SETPWENT:
* This symbol, if defined, indicates that the setpwent routine is
* available for initializing sequential access of the passwd database.
@ -3099,5 +3105,11 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un-
*/
#$d_flexfnam FLEXFILENAMES /**/
/* I_LIBUTIL:
* This symbol, if defined, indicates that <libutil.h> exists and
* should be included.
*/
#$i_libutil I_LIBUTIL /**/
#endif
!GROK!THIS!

View File

@ -1994,6 +1994,30 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
break;
#ifndef MACOS_TRADITIONAL
case '0':
#ifdef HAS_SETPROCTITLE
/* The BSDs don't show the argv[] in ps(1) output, they
* show a string from the process struct and provide
* the setproctitle() routine to manipulate that. */
{
s = SvPV(sv, len);
# if __FreeBSD_version >= 410001
/* The leading "-" removes the "perl: " prefix,
* but not the "(perl) suffix from the ps(1)
* output, because that's what ps(1) shows if the
* argv[] is modified. */
setproctitle("-%s", s, len + 1);
# else /* old FreeBSDs, NetBSD, OpenBSD, anyBSD */
/* This doesn't really work if you assume that
* $0 = 'foobar'; will wipe out 'perl' from the $0
* because in ps(1) output the result will be like
* sprintf("perl: %s (perl)", s)
* I guess this is a security feature:
* one (a user process) cannot get rid of the original name.
* --jhi */
setproctitle("%s", s);
# endif
}
#endif
if (!PL_origalen) {
s = PL_origargv[0];
s += strlen(s);

View File

@ -486,6 +486,15 @@ register struct op *Perl_op asm(stringify(OP_IN_REGISTER));
# include <sys/param.h>
#endif
/* needed for IAMSUID case for 4.4BSD systems
* XXX there should probably be a Configure variable
*/
#ifdef I_SYS_PARAM
#if (defined (BSD) && (BSD >= 199306))
# include <sys/mount.h>
#endif /* !BSD */
#endif /* !I_SYS_PARAM */
/* Use all the "standard" definitions? */
#if defined(STANDARD_C) && defined(I_STDLIB)
@ -3296,6 +3305,10 @@ typedef struct am_table_short AMTS;
#endif /* IAMSUID */
#ifdef I_LIBUTIL
# include <libutil.h> /* setproctitle() in some FreeBSDs */
#endif
/* and finally... */
#define PERL_PATCHLEVEL_H_IMPLICIT
#include "patchlevel.h"

View File

@ -687,6 +687,11 @@ program sees. This is more useful as a way of indicating the current
program state than it is for hiding the program you're running.
(Mnemonic: same as B<sh> and B<ksh>.)
Note for BSD users: setting C<$0> does not completely remove "perl"
from the ps(1) output. For example, setting C<$0> to C<"foobar"> will
result in C<"perl: foobar (perl)">. This is an operating system
feature.
=item $[
The index of the first element in an array, and of the first character