summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2000-08-20 08:43:07 +0000
committermarkm <markm@FreeBSD.org>2000-08-20 08:43:07 +0000
commit259bd53c06712c4ffb0ab7e06898c19ebf221b21 (patch)
treeb35fc9696f76d59de3a8783dea4af9ab1db15e96 /contrib
parent2618fad5bbb2d0182eb31ed805c41b543c513940 (diff)
downloadFreeBSD-src-259bd53c06712c4ffb0ab7e06898c19ebf221b21.zip
FreeBSD-src-259bd53c06712c4ffb0ab7e06898c19ebf221b21.tar.gz
Vendor supplied patches to fix procname ($0)
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/perl5/Configure14
-rwxr-xr-xcontrib/perl5/config_h.SH12
-rw-r--r--contrib/perl5/mg.c24
-rw-r--r--contrib/perl5/perl.h13
-rw-r--r--contrib/perl5/pod/perlvar.pod5
5 files changed, 67 insertions, 1 deletions
diff --git a/contrib/perl5/Configure b/contrib/perl5/Configure
index ddec97c..3e7ac45 100755
--- a/contrib/perl5/Configure
+++ b/contrib/perl5/Configure
@@ -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'
diff --git a/contrib/perl5/config_h.SH b/contrib/perl5/config_h.SH
index 0f6f19a..70f220e 100755
--- a/contrib/perl5/config_h.SH
+++ b/contrib/perl5/config_h.SH
@@ -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!
diff --git a/contrib/perl5/mg.c b/contrib/perl5/mg.c
index 27039fa..3941639 100644
--- a/contrib/perl5/mg.c
+++ b/contrib/perl5/mg.c
@@ -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);
diff --git a/contrib/perl5/perl.h b/contrib/perl5/perl.h
index 2f30218..d2aae98 100644
--- a/contrib/perl5/perl.h
+++ b/contrib/perl5/perl.h
@@ -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"
diff --git a/contrib/perl5/pod/perlvar.pod b/contrib/perl5/pod/perlvar.pod
index 04fb3fe..e6b6b92 100644
--- a/contrib/perl5/pod/perlvar.pod
+++ b/contrib/perl5/pod/perlvar.pod
@@ -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
OpenPOWER on IntegriCloud