3 * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 * by Larry Wall and others
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Artistic License, as specified in the README file.
15 /* Don't forget to re-run embed.pl to propagate changes! */
17 /* This file describes the "global" variables used by perl
18 * This used to be in perl.h directly but we want to abstract out into
19 * distinct files which are per-thread, per-interpreter or really global,
20 * and how they're initialized.
22 * The 'G' prefix is only needed for vars that need appropriate #defines
23 * generated in embed*.h. Such symbols are also used to generate
24 * the appropriate export list for win32. */
27 PERLVAR(Gcurinterp, PerlInterpreter *)
28 /* currently running interpreter
29 * (initial parent interpreter under
31 #if defined(USE_ITHREADS)
32 PERLVAR(Gthr_key, perl_key) /* key to retrieve per-thread struct */
35 /* constants (these are not literals to facilitate pointer comparisons)
36 * (PERLVARISC really does create variables, despite its looks) */
39 PERLVARISC(Ghexdigit, "0123456789abcdef0123456789ABCDEF")
40 PERLVARISC(Gpatleave, "\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}")
42 /* XXX does anyone even use this? */
43 PERLVARI(Gdo_undump, bool, FALSE) /* -u or dump seen? */
45 #if defined(MYMALLOC) && defined(USE_ITHREADS)
46 PERLVAR(Gmalloc_mutex, perl_mutex) /* Mutex for malloc */
49 #if defined(USE_ITHREADS)
50 PERLVAR(Gop_mutex, perl_mutex) /* Mutex for op refcounting */
54 PERLVAR(Gdollarzero_mutex, perl_mutex) /* Modifying $0 */
58 /* This is constant on most architectures, a global on OS/2 */
62 # define PERL___C const
64 PERLVARI(Gsh_path, PERL___C char *, SH_PATH) /* full path of shell */
68 /* If Perl has to ignore SIGPFE, this is its saved state.
69 * See perl.h macros PERL_FPU_INIT and PERL_FPU_{PRE,POST}_EXEC. */
70 PERLVAR(Gsigfpe_saved, Sighandler_t)
73 /* Restricted hashes placeholder value.
74 * The contents are never used, only the address. */
75 PERLVAR(Gsv_placeholder, SV)
78 PERLVARI(Gcsighandlerp, Sighandler_t, Perl_csighandler) /* Pointer to C-level sighandler */
81 #ifndef PERL_USE_SAFE_PUTENV
82 PERLVARI(Guse_safe_putenv, int, 1)
86 PERLVARI(Gperlio_fd_refcnt, int*, 0) /* Pointer to array of fd refcounts. */
87 PERLVARI(Gperlio_fd_refcnt_size, int, 0) /* Size of the array */
88 PERLVARI(Gperlio_debug_fd, int, 0) /* the fd to write perlio debug into, 0 means not set yet */
92 PERLVARI(Gmmap_page_size, IV, 0)
95 #if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS)||defined(FAKE_DEFAULT_SIGNAL_HANDLERS)
96 PERLVARI(Gsig_handlers_initted, int, 0)
98 #ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS
99 PERLVARA(Gsig_ignoring, SIG_SIZE, int) /* which signals we are ignoring */
101 #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
102 PERLVARA(Gsig_defaulting, SIG_SIZE, int)
105 #ifndef PERL_IMPLICIT_CONTEXT
106 PERLVAR(Gsig_sv, SV*)
109 /* XXX signals are process-wide anyway, so we
110 * ignore the implications of this for threading */
111 #ifndef HAS_SIGACTION
112 PERLVARI(Gsig_trapped, int, 0)
116 PERLVAR(Gwatch_pvx, char*)
119 #ifdef PERL_GLOBAL_STRUCT
120 PERLVAR(Gppaddr, Perl_ppaddr_t*) /* or opcode.h */
121 PERLVAR(Gcheck, Perl_check_t *) /* or opcode.h */
122 PERLVARA(Gfold_locale, 256, unsigned char) /* or perl.h */
125 #ifdef PERL_NEED_APPCTX
126 PERLVAR(Gappctx, void*) /* the application context */
129 PERLVAR(Gop_sequence, HV*) /* dump.c */
130 PERLVARI(Gop_seq, UV, 0) /* dump.c */
132 #if defined(HAS_TIMES) && defined(PERL_NEED_TIMESBASE)
133 PERLVAR(Gtimesbase, struct tms)
136 /* allocate a unique index to every module that calls MY_CXT_INIT */
138 #ifdef PERL_IMPLICIT_CONTEXT
140 PERLVAR(Gmy_ctx_mutex, perl_mutex)
142 PERLVARI(Gmy_cxt_index, int, 0)
145 #if defined(USE_ITHREADS)
146 PERLVAR(Ghints_mutex, perl_mutex) /* Mutex for refcounted he refcounting */
149 #if defined(USE_ITHREADS)
150 PERLVAR(Gperlio_mutex, perl_mutex) /* Mutex for perlio fd refcounts */
153 /* this is currently set without MUTEX protection, so keep it a type which
154 * can be set atomically (ie not a bit field) */
155 PERLVARI(Gveto_cleanup, int, FALSE) /* exit without cleanup */
157 /* dummy variables that hold pointers to both runops functions, thus forcing
158 * them *both* to get linked in (useful for Peek.xs, debugging etc) */
160 PERLVARI(Grunops_std, runops_proc_t, MEMBER_TO_FPTR(Perl_runops_standard))
161 PERLVARI(Grunops_dbg, runops_proc_t, MEMBER_TO_FPTR(Perl_runops_debug))
164 /* These are baked at compile time into any shared perl library.
165 In future 5.10.x releases this will allow us in main() to sanity test the
166 library we're linking against. */
168 PERLVARI(Grevision, U8, PERL_REVISION)
169 PERLVARI(Gversion, U8, PERL_VERSION)
170 PERLVARI(Gsubversion, U8, PERL_SUBVERSION)
172 #if defined(MULTIPLICITY)
173 # define PERL_INTERPRETER_SIZE_UPTO_MEMBER(member) \
174 STRUCT_OFFSET(struct interpreter, member) + \
175 sizeof(((struct interpreter*)0)->member)
177 /* These might be useful. */
178 PERLVARI(Ginterp_size, U16, sizeof(struct interpreter))
179 #if defined(PERL_GLOBAL_STRUCT)
180 PERLVARI(Gglobal_struct_size, U16, sizeof(struct perl_vars))
183 /* This will be useful for subsequent releases, because this has to be the
184 same in your libperl as in main(), else you have a mismatch and must abort.
186 PERLVARI(Ginterp_size_5_10_0, U16,
187 PERL_INTERPRETER_SIZE_UPTO_MEMBER(PERL_LAST_5_10_0_INTERP_MEMBER))