/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* mg.c
*
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
* 2000, 2001, 2002, 2003, 2004, by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*
*/
/*
* "Sam sat on the ground and put his head in his hands. 'I wish I had never
* come here, and I don't want to see no more magic,' he said, and fell silent."
*/
/*
=head1 Magical Functions
*/
#include "EXTERN.h"
#define PERL_IN_MG_C
#include "perl.h"
#if defined(HAS_GETGROUPS) || defined(HAS_SETGROUPS)
# ifndef NGROUPS
# endif
# ifdef I_GRP
# include <grp.h>
# endif
#ifdef __sun
#include <alloca.h>
#include <unistd.h>
#endif
#endif
#ifdef __hpux
#endif
/* if you only have signal() and it resets on each signal, FAKE_PERSISTENT_SIGNAL_HANDLERS fixes */
#if !defined(HAS_SIGACTION) && defined(VMS)
# define FAKE_PERSISTENT_SIGNAL_HANDLERS
#endif
/* if we're doing kill() with sys$sigprc on VMS, FAKE_DEFAULT_SIGNAL_HANDLERS */
#if defined(KILL_BY_SIGPRC)
# define FAKE_DEFAULT_SIGNAL_HANDLERS
#endif
static void restore_magic(pTHX_ void *p);
static void unwind_handler_stack(pTHX_ void *p);
#ifdef __Lynx__
/* Missing protos on LynxOS */
#endif
/*
* Use the "DESTRUCTOR" scope cleanup to reinstate magic.
*/
struct magic_state {
};
/* MGS is typedef'ed to struct magic_state in perl.h */
STATIC void
{
}
/*
=for apidoc mg_magical
Turns on the magical status of an SV. See C<sv_magic>.
=cut
*/
void
{
if (vtbl) {
}
}
}
/*
=for apidoc mg_get
Do magic after a value is retrieved from the SV. See C<sv_magic>.
=cut
*/
int
{
int new = 0;
/* We must call svt_get(sv, mg) for each valid entry in the linked
list of magic. svt_get() may delete the current entry, add new
magic to the head of the list, or upgrade the SV. AMS 20010810 */
while (mg) {
/* guard against sv having been freed */
}
/* guard against magic having been deleted - eg FETCH calling
* untie */
break;
/* Don't restore the flags for this entry if it was deleted. */
}
if (new) {
/* Have we finished with the new entries we saw? Start again
where we left off (unless there are more new entries). */
new = 0;
}
}
/* Were any new entries added? */
new = 1;
}
}
return 0;
}
/*
=for apidoc mg_set
Do magic after a value is assigned to the SV. See C<sv_magic>.
=cut
*/
int
{
}
}
return 0;
}
/*
=for apidoc mg_length
Report on the SV's length. See C<sv_magic>.
=cut
*/
{
/* omit MGf_GSKIP -- not changed here */
return len;
}
}
{
}
else
return len;
}
{
/* omit MGf_GSKIP -- not changed here */
return len;
}
}
case SVt_PVAV:
return len;
case SVt_PVHV:
/* FIXME */
default:
break;
}
return 0;
}
/*
=for apidoc mg_clear
Clear something magical that the SV represents. See C<sv_magic>.
=cut
*/
int
{
/* omit GSKIP -- never set here */
}
return 0;
}
/*
=for apidoc mg_find
Finds the magic pointer for type matching the SV. See C<sv_magic>.
=cut
*/
{
if (!sv)
return 0;
return mg;
}
return 0;
}
/*
=for apidoc mg_copy
Copies the magic from one SV to another. See C<sv_magic>.
=cut
*/
int
{
int count = 0;
}
count++;
}
}
return count;
}
/*
=for apidoc mg_free
Free any magic storage used by the SV. See C<sv_magic>.
=cut
*/
int
{
}
}
return 0;
}
#include <signal.h>
{
else /* @- */
}
return (U32)-1;
}
int
{
register I32 s;
register I32 i;
I32 t;
if (paren < 0)
return 0;
{
i = t;
else /* @- */
i = s;
if (i > 0 && RX_MATCH_UTF8(rx)) {
if (b)
}
}
}
return 0;
}
int
{
/* NOT REACHED */
return 0;
}
{
register I32 i;
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '&':
{
if (i > 0 && RX_MATCH_UTF8(rx)) {
if (is_utf8_string((U8*)s, i))
}
if (i < 0)
return i;
}
else {
if (ckWARN(WARN_UNINITIALIZED))
}
}
else {
if (ckWARN(WARN_UNINITIALIZED))
}
return 0;
case '+':
if (paren)
goto getparen;
}
return 0;
case '\016': /* ^N */
if (paren)
goto getparen;
}
return 0;
case '`':
if (i > 0) {
s1 = 0;
t1 = i;
goto getlen;
}
}
}
return 0;
case '\'':
if (i > 0) {
goto getlen;
}
}
}
return 0;
}
}
return 0;
}
int
{
register char *s = NULL;
register I32 i;
case '\001': /* ^A */
break;
case '\003': /* ^C */
break;
case '\004': /* ^D */
#endif
break;
case '\005': /* ^E */
#ifdef MACOS_TRADITIONAL
{
}
#else
#ifdef VMS
{
# include <descrip.h>
# include <starlet.h>
char msg[255];
else
}
#else
#ifdef OS2
} else {
if (errno != errno_isOS2) {
if (tmp) /* 2nd call to _syserrno() makes it 0 */
}
}
#else
#ifdef WIN32
{
if (dwErr)
{
}
else
}
#else
{
}
#endif
#endif
#endif
#endif
}
break;
case '\006': /* ^F */
break;
case '\010': /* ^H */
break;
case '\011': /* ^I */ /* NOT \t in EBCDIC */
if (PL_inplace)
else
break;
case '\017': /* ^O & ^OPEN */
}
if (!PL_compiling.cop_io)
else {
}
}
break;
case '\020': /* ^P */
break;
case '\023': /* ^S */
if (PL_lex_state != LEX_NOTPARSING)
else if (PL_in_eval)
else
}
break;
case '\024': /* ^T */
#ifdef BIG_TIME
#else
#endif
}
: 0);
break;
case '\025': /* $^UNICODE */
break;
case '\027': /* ^W & $^WARNING_BITS */
{
}
}
else {
}
SvPOK_only(sv);
}
break;
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '&':
/*
* Pre-threads, this was paren = atoi(GvENAME((GV*)mg->mg_obj));
* XXX Does the new way break anything?
*/
{
break;
if (i >= 0) {
else
SvUTF8_off(sv);
if (PL_tainting) {
if (RX_MATCH_TAINTED(rx)) {
PL_tainted = 1;
}
} else
}
break;
}
}
}
break;
case '+':
if (paren)
goto getparen;
}
break;
case '\016': /* ^N */
if (paren)
goto getparen;
}
break;
case '`':
goto getrx;
}
}
break;
case '\'':
goto getrx;
}
}
break;
case '.':
#ifndef lint
if (GvIO(PL_last_in_gv)) {
}
#endif
break;
case '?':
{
#ifdef COMPLEX_STATUS
#endif
}
break;
case '^':
if (GvIOp(PL_defoutgv))
if (s)
else {
}
break;
case '~':
if (GvIOp(PL_defoutgv))
if (!s)
s = GvENAME(PL_defoutgv);
break;
#ifndef lint
case '=':
if (GvIOp(PL_defoutgv))
break;
case '-':
if (GvIOp(PL_defoutgv))
break;
case '%':
if (GvIOp(PL_defoutgv))
break;
#endif
case ':':
break;
case '/':
break;
case '[':
break;
case '|':
if (GvIOp(PL_defoutgv))
break;
case ',':
break;
case '\\':
if (PL_ors_sv)
break;
case '#':
break;
case '!':
#ifdef VMS
#else
{
#ifdef OS2
else
#endif
}
#endif
break;
case '<':
break;
case '>':
break;
case '(':
#ifdef HAS_GETGROUPS
#endif
goto add_groups;
case ')':
#ifdef HAS_GETGROUPS
#endif
#ifdef HAS_GETGROUPS
{
#ifdef __sun
#else
#endif
while (--i >= 0)
}
#endif
break;
case '*':
break;
#ifndef MACOS_TRADITIONAL
case '0':
break;
#endif
#ifdef USE_5005THREADS
case '@':
break;
#endif /* USE_5005THREADS */
}
return 0;
}
int
{
return 0;
}
int
{
register char *s;
char *ptr;
#ifdef DYNAMIC_ENV_FETCH
/* We just undefd an environment var. Is a replacement */
/* waiting in the wings? */
if (!len) {
}
#endif
/* And you'll never guess what the dog had */
/* in its mouth... */
if (PL_tainting) {
#ifdef VMS
int i = 0, j = 0;
do { /* DCL$PATH may be a search list */
while (1) { /* as may dev portion of any element */
return 0;
}
}
*cp = '\0';
else
break;
}
j = 0;
}
#endif /* VMS */
while (s < strend) {
I32 i;
s, strend, ':', &i);
s++;
if (i >= sizeof tmpbuf /* too long -- assume the worst */
|| *tmpbuf != '/'
return 0;
}
}
}
}
#endif /* neither OS2 nor AMIGAOS nor WIN32 nor MSDOS */
return 0;
}
int
{
return 0;
}
int
{
#if defined(VMS)
#else
if (PL_localizing) {
}
}
#endif
return 0;
}
int
{
#ifndef PERL_MICRO
#else
# if defined(PERL_IMPLICIT_SYS) || defined(WIN32)
# else
# ifdef USE_ENVIRON_ARRAY
# if defined(USE_ITHREADS)
/* only the parent thread can clobber the process environment */
if (PL_curinterp == aTHX)
# endif
{
# ifndef PERL_USE_SAFE_PUTENV
I32 i;
if (environ == PL_origenviron)
environ = (char**)safesysmalloc(sizeof(char*));
else
for (i = 0; environ[i]; i++)
safesysfree(environ[i]);
# endif /* PERL_USE_SAFE_PUTENV */
}
# endif /* USE_ENVIRON_ARRAY */
# endif /* PERL_IMPLICIT_SYS || WIN32 */
#endif /* VMS || EPOC */
#endif /* !PERL_MICRO */
return 0;
}
#if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS)||defined(FAKE_DEFAULT_SIGNAL_HANDLERS)
static int sig_handlers_initted = 0;
#endif
#endif
#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
#endif
#ifndef PERL_MICRO
#ifdef HAS_SIGPROCMASK
static void
{
}
#endif
int
{
I32 i;
/* Are we fetching a signal entry? */
if (i > 0) {
if(PL_psig_ptr[i])
else {
sigstate = rsignal_state(i);
#endif
#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
#endif
/* cache state so we don't fetch it again */
else
SvTEMP_off(sv);
}
}
return 0;
}
int
{
/* XXX Some of this code was copied from Perl_magic_setsig. A little
* refactoring might be in order.
*/
register char *s;
if (*s == '_') {
if (strEQ(s,"__DIE__"))
svp = &PL_diehook;
else if (strEQ(s,"__WARN__"))
svp = &PL_warnhook;
else
if (*svp) {
*svp = 0;
}
}
else {
I32 i;
/* Are we clearing a signal entry? */
i = whichsig(s);
if (i > 0) {
#ifdef HAS_SIGPROCMASK
/* Avoid having the signal arrive at a bad time, if possible. */
sigemptyset(&set);
#endif
#if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS) || defined(FAKE_DEFAULT_SIGNAL_HANDLERS)
#endif
#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
sig_defaulting[i] = 1;
(void)rsignal(i, PL_csighandlerp);
#else
#endif
if(PL_psig_name[i]) {
SvREFCNT_dec(PL_psig_name[i]);
PL_psig_name[i]=0;
}
if(PL_psig_ptr[i]) {
to_dec=PL_psig_ptr[i];
PL_psig_ptr[i]=0;
}
else
}
}
return 0;
}
void
{
/* Set a flag to say this signal is pending */
PL_psig_pend[sig]++;
/* And one to say _a_ signal is pending */
PL_sig_pending = 1;
}
{
#ifdef PERL_GET_SIG_CONTEXT
#else
dTHX;
#endif
if (sig_ignoring[sig]) return;
#endif
#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
if (sig_defaulting[sig])
#ifdef KILL_BY_SIGPRC
#else
exit(1);
#endif
#endif
/* Call the perl level handler now--
* with risk we may be in malloc() etc. */
(*PL_sighandlerp)(sig);
else
}
#if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS) || defined(FAKE_DEFAULT_SIGNAL_HANDLERS)
void
Perl_csighandler_init(void)
{
int sig;
if (sig_handlers_initted) return;
#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
dTHX;
#endif
sig_ignoring[sig] = 0;
#endif
}
sig_handlers_initted = 1;
}
#endif
void
{
int sig;
PL_sig_pending = 0;
if (PL_psig_pend[sig]) {
PL_psig_pend[sig] = 0;
(*PL_sighandlerp)(sig);
}
}
}
int
{
register char *s;
I32 i;
/* Need to be careful with SvREFCNT_dec(), because that can have side
* effects (due to closures). We must make sure that the new disposition
* is in place before it is called.
*/
#ifdef HAS_SIGPROCMASK
#endif
if (*s == '_') {
if (strEQ(s,"__DIE__"))
svp = &PL_diehook;
else if (strEQ(s,"__WARN__"))
svp = &PL_warnhook;
else
i = 0;
if (*svp) {
*svp = 0;
}
}
else {
i = whichsig(s); /* ...no, a brick */
if (i < 0) {
if (ckWARN(WARN_SIGNAL))
return 0;
}
#ifdef HAS_SIGPROCMASK
/* Avoid having the signal arrive at a bad time, if possible. */
sigemptyset(&set);
#endif
#if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS) || defined(FAKE_DEFAULT_SIGNAL_HANDLERS)
#endif
sig_ignoring[i] = 0;
#endif
#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
sig_defaulting[i] = 0;
#endif
SvREFCNT_dec(PL_psig_name[i]);
to_dec = PL_psig_ptr[i];
}
if (i) {
(void)rsignal(i, PL_csighandlerp);
#ifdef HAS_SIGPROCMASK
#endif
}
else
if(to_dec)
return 0;
}
if (strEQ(s,"IGNORE")) {
if (i) {
sig_ignoring[i] = 1;
(void)rsignal(i, PL_csighandlerp);
#else
#endif
}
}
else if (strEQ(s,"DEFAULT") || !*s) {
if (i)
#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
{
sig_defaulting[i] = 1;
(void)rsignal(i, PL_csighandlerp);
}
#else
#endif
}
else {
/*
* We should warn if HINT_STRICT_REFS, but without
* access to a known hint bit in a known OP, we can't
* tell whether HINT_STRICT_REFS is in force or not.
*/
if (i)
(void)rsignal(i, PL_csighandlerp);
else
}
#ifdef HAS_SIGPROCMASK
if(i)
#endif
if(to_dec)
return 0;
}
#endif /* !PERL_MICRO */
int
{
return 0;
}
int
{
/* HV_badAMAGIC_on(Sv_STASH(sv)); */
return 0;
}
int
{
I32 i = 0;
if (hv) {
(void) hv_iterinit(hv);
else {
while (hv_iternext(hv))
i++;
}
}
return 0;
}
int
{
}
return 0;
}
STATIC int
{
dSP;
if (n > 1) {
}
}
}
if (n > 2) {
}
}
STATIC int
{
dSP;
}
return 0;
}
int
{
return 0;
}
int
{
dSP;
return 0;
}
int
{
}
{
dSP;
sv = *PL_stack_sp--;
}
return retval;
}
int
{
dSP;
return 0;
}
int
{
dSP;
return 0;
}
int
{
}
SV *
{
dSP;
/* we are in an iteration so the hash cannot be empty */
return &PL_sv_yes;
/* no xhv_eiter so now use FIRSTKEY */
key = sv_newmortal();
}
/* there is a SCALAR method that we can call */
retval = *PL_stack_sp--;
return retval;
}
int
{
OP *o;
I32 i;
/* set or clear breakpoint in the relevant control op */
if (i)
o->op_flags |= OPf_SPECIAL;
else
o->op_flags &= ~OPf_SPECIAL;
}
return 0;
}
int
{
return 0;
}
int
{
return 0;
}
int
{
sv_pos_b2u(lsv, &i);
return 0;
}
}
return 0;
}
int
{
mg = 0;
if (!mg) {
return 0;
}
return 0;
}
if (ulen)
}
if (pos < 0) {
if (pos < 0)
pos = 0;
}
if (ulen) {
sv_pos_u2b(lsv, &p, 0);
pos = p;
}
return 0;
}
int
{
SvFAKE_off(sv);
}
else
return 0;
}
int
{
register char *s;
return 0;
if (*s == '*' && s[1])
s++;
return 0;
return 0;
}
int
{
return 0;
}
int
{
}
}
else
return 0;
}
int
{
return 0;
}
int
{
if (PL_localizing) {
if (PL_localizing == 1)
else
}
else if (PL_tainted)
else
return 0;
}
int
{
if (!lsv) {
return 0;
}
return 0;
}
int
{
return 0;
}
int
{
if (he)
}
else {
if (svp)
}
}
else {
}
/* somebody else defined it for us */
}
}
else
return 0;
}
int
{
}
return 0;
}
void
{
return;
if (he)
}
else {
if (svp)
}
}
else {
else {
}
}
(void)SvREFCNT_inc(value);
}
int
{
while (i >= 0) {
/* XXX Should we check that it hasn't changed? */
SvWEAKREF_off(svp[i]);
svp[i] = &PL_sv_undef;
}
i--;
}
return 0;
}
int
{
return 0;
}
int
{
return 0;
}
int
{
return 0;
}
int
{
return 0;
}
int
{
return 0;
}
int
{
return 0;
}
#ifdef USE_LOCALE_COLLATE
int
{
/*
* RenE<eacute> Descartes said "I think not."
* and vanished with a faint plop.
*/
}
return 0;
}
#endif /* USE_LOCALE_COLLATE */
/* Just clear the UTF-8 cache data. */
int
{
return 0;
}
int
{
register char *s;
I32 i;
case '\001': /* ^A */
break;
case '\003': /* ^C */
break;
case '\004': /* ^D */
#ifdef DEBUGGING
s = SvPV_nolen(sv);
#else
#endif
break;
case '\005': /* ^E */
#ifdef MACOS_TRADITIONAL
#else
# ifdef VMS
# else
# ifdef WIN32
# else
# ifdef OS2
# else
/* will anyone ever use this? */
# endif
# endif
# endif
#endif
}
if (PL_encoding)
}
else {
}
}
break;
case '\006': /* ^F */
break;
case '\010': /* ^H */
break;
case '\011': /* ^I */ /* NOT \t in EBCDIC */
if (PL_inplace)
else
PL_inplace = Nullch;
break;
case '\017': /* ^O */
if (PL_osname) {
}
TAINT_PROPER("assigning to $^O");
}
}
if (!PL_compiling.cop_io)
else
}
break;
case '\020': /* ^P */
&& !PL_DBsingle)
break;
case '\024': /* ^T */
#ifdef BIG_TIME
#else
#endif
break;
case '\027': /* ^W & $^WARNING_BITS */
if ( ! (PL_dowarn & G_WARN_ALL_MASK)) {
| (i ? G_WARN_ON : G_WARN_OFF) ;
}
}
if ( ! (PL_dowarn & G_WARN_ALL_MASK)) {
break;
}
{
int accumulate = 0 ;
int any_fatals = 0 ;
for (i = 0 ; i < len ; ++i) {
accumulate |= ptr[i] ;
}
if (!accumulate)
PL_dowarn |= G_WARN_ONCE ;
}
else {
else
PL_dowarn |= G_WARN_ONCE ;
}
}
}
}
break;
case '.':
if (PL_localizing) {
if (PL_localizing == 1)
}
break;
case '^':
break;
case '~':
break;
case '=':
break;
case '-':
break;
case '%':
break;
case '|':
{
if(!io)
break;
else {
if (ofp)
(void)PerlIO_flush(ofp);
}
}
}
break;
case '*':
PL_multiline = (i != 0);
break;
case '/':
break;
case '\\':
if (PL_ors_sv)
}
else {
}
break;
case ',':
if (PL_ofs_sv)
}
else {
}
break;
case '#':
if (PL_ofmt)
break;
case '[':
break;
case '?':
#ifdef COMPLEX_STATUS
if (PL_localizing == 2) {
}
else
#endif
#ifdef VMSISH_STATUS
if (VMSISH_STATUS)
else
#endif
break;
case '!':
{
#ifdef VMS
#else
# define PERL_VMS_BANG 0
#endif
}
break;
case '<':
if (PL_delaymagic) {
PL_delaymagic |= DM_RUID;
break; /* don't do magic till later */
}
#ifdef HAS_SETRUID
#else
#ifdef HAS_SETREUID
#else
#ifdef HAS_SETRESUID
#else
#ifdef PERL_DARWIN
/* workaround for Darwin's setuid peculiarity, cf [perl #24122] */
if (PL_uid != 0 && PerlProc_getuid() == 0)
(void)PerlProc_setuid(0);
#endif
(void)PerlProc_setuid(PL_uid);
} else {
PL_uid = PerlProc_getuid();
}
#endif
#endif
#endif
PL_uid = PerlProc_getuid();
break;
case '>':
if (PL_delaymagic) {
PL_delaymagic |= DM_EUID;
break; /* don't do magic till later */
}
#ifdef HAS_SETEUID
#else
#ifdef HAS_SETREUID
#else
#ifdef HAS_SETRESUID
#else
else {
PL_euid = PerlProc_geteuid();
}
#endif
#endif
#endif
PL_euid = PerlProc_geteuid();
break;
case '(':
if (PL_delaymagic) {
PL_delaymagic |= DM_RGID;
break; /* don't do magic till later */
}
#ifdef HAS_SETRGID
#else
#ifdef HAS_SETREGID
#else
#ifdef HAS_SETRESGID
#else
(void)PerlProc_setgid(PL_gid);
else {
PL_gid = PerlProc_getgid();
}
#endif
#endif
#endif
PL_gid = PerlProc_getgid();
break;
case ')':
#ifdef HAS_SETGROUPS
{
#ifdef _SC_NGROUPS_MAX
#else
#endif
while (isSPACE(*p))
++p;
for (i = 0; i < maxgrp; ++i) {
while (*p && !isSPACE(*p))
++p;
while (isSPACE(*p))
++p;
if (!*p)
break;
}
if (i)
}
#else /* HAS_SETGROUPS */
#endif /* HAS_SETGROUPS */
if (PL_delaymagic) {
PL_delaymagic |= DM_EGID;
break; /* don't do magic till later */
}
#ifdef HAS_SETEGID
#else
#ifdef HAS_SETREGID
#else
#ifdef HAS_SETRESGID
#else
(void)PerlProc_setgid(PL_egid);
else {
PL_egid = PerlProc_getegid();
}
#endif
#endif
#endif
PL_egid = PerlProc_getegid();
break;
case ':':
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. */
{
# 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);
# 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 defined(__hpux) && defined(PSTAT_SETCMD)
{
un.pst_command = s;
}
#endif
/* PL_origalen is set in perl_parse(). */
/* Longer than original, will be truncated. */
}
else {
/* Shorter than original, will be padded. */
PL_origargv[0][len] = 0;
/* Is the space counterintuitive? Yes.
* (You were expecting \0?)
* Does it work? Seems to. (In Linux 2.4.20 at least.)
* --jhi */
(int)' ',
for (i = 1; i < PL_origargc; i++)
PL_origargv[i] = 0;
}
break;
#endif
#ifdef USE_5005THREADS
case '@':
break;
#endif /* USE_5005THREADS */
}
return 0;
}
#ifdef USE_5005THREADS
int
{
return 0;
}
#endif /* USE_5005THREADS */
{
register char **sigv;
#ifdef SIGCLD
return SIGCLD;
#endif
#ifdef SIGCHLD
return SIGCHLD;
#endif
return -1;
}
#if !defined(PERL_IMPLICIT_CONTEXT)
#endif
{
#ifdef PERL_GET_SIG_CONTEXT
#else
dTHX;
#endif
dSP;
flags |= 1;
flags |= 4;
flags |= 8;
flags |= 16;
if (!PL_psig_ptr[sig]) {
PL_sig_name[sig]);
}
/* Max number of items pushed there is 3*n or 4. We cannot fix
infinity, so we fix 4 (in fact 5): */
if (flags & 1) {
}
if (flags & 4)
PL_markstack_ptr++; /* Protect mark. */
if (flags & 8) {
}
if (flags & 16)
PL_scopestack_ix += 1;
/* sv_2cv is too complicated, try a simpler variant first: */
if (ckWARN(WARN_SIGNAL))
: "__ANON__")));
goto cleanup;
}
if(PL_psig_name[sig]) {
flags |= 64;
#if !defined(PERL_IMPLICIT_CONTEXT)
#endif
} else {
sv = sv_newmortal();
}
#ifndef PERL_MICRO
#ifdef HAS_SIGPROCMASK
/* Handler "died", for example to get out of a restart-able read().
* Before we re-do that on its behalf re-enable the signal which was
* blocked by the system when we entered.
*/
sigemptyset(&set);
#else
/* Not clear if this will work */
#endif
#endif /* !PERL_MICRO */
}
if (flags & 1)
if (flags & 4)
if (flags & 8)
if (flags & 16)
PL_scopestack_ix -= 1;
if (flags & 64)
return;
}
static void
{
if (!sv)
return;
{
else
mg_magical(sv);
if (SvGMAGICAL(sv))
}
/* If we're still on top of the stack, pop us off. (That condition
* will be satisfied if restore_magic was called explicitly, but *not*
* if it's being called via leave_scope.)
* The reason for doing this is that otherwise, things like sv_2cv()
* may leave alloc gunk on the savestack, and some code
* (e.g. sighandler) doesn't expect that...
*/
{
PL_savestack_ix -= 2;
}
}
static void
{
if (flags & 1)
/* cxstack_ix-- Not needed, die already unwound it. */
#if !defined(PERL_IMPLICIT_CONTEXT)
if (flags & 64)
#endif
}