diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-06-29 15:41:05 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-06-29 15:41:05 +0000 |
commit | 54bfe034ba642318cf2c7d0b37579f30adef144a (patch) | |
tree | 9d4a1a11a7d2ea0e6bab798b52a7d08ff374981a /pod | |
parent | 52d59bef96c881381bce1bcb84a8c08ce48c2544 (diff) | |
download | perl-54bfe034ba642318cf2c7d0b37579f30adef144a.tar.gz |
The joy of $0. Undoing the #16399 makes Andreas'
tests (see [perl #22811]) pass (yes, padding with space instead
of nul makes no sense, but that seems to work, maybe Linux does
some deep magic in ps(1)?); moving the PL_origalen computation
earlier makes also the threaded-first case fully pass.
But in general modifying the argv[] is very non-portable.
(e.g. in Tru64 it seems to be limited to the size of the
original argv[0] since the argv[] are not contiguous?)
Everybody should just have setproctitle().
p4raw-id: //depot/perl@19884
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlvar.pod | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/pod/perlvar.pod b/pod/perlvar.pod index ad791dd71b..7667f1d75d 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -838,16 +838,17 @@ and C<$)> can be swapped only on machines supporting setregid(). =item $0 -Contains the name of the program being executed. On some operating -systems assigning to C<$0> modifies the argument area that the B<ps> -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>.) +Contains the name of the program being executed. On some (read: not +all) operating systems assigning to C<$0> modifies the argument area +that the B<ps> program sees. Also note that depending on the platform, +the maximum length of C<$0> may be limited to the space occupied by +the original C<$0>. 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. +result in C<"perl: foobar (perl)">. This is an operating system feature. In multithreaded scripts Perl coordinates the threads so that any thread may modify its copy of the C<$0> and the change becomes visible |