Commit | Line | Data |
eb1102fc |
1 | /* perlvars.h |
2 | * |
54ca4ee7 |
3 | * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
4 | * by Larry Wall and others |
eb1102fc |
5 | * |
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. |
8 | * |
9 | */ |
10 | |
49f531da |
11 | /****************/ |
12 | /* Truly global */ |
13 | /****************/ |
14 | |
cb68f92d |
15 | /* Don't forget to re-run embed.pl to propagate changes! */ |
16 | |
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. |
21 | * |
22 | * The 'G' prefix is only needed for vars that need appropriate #defines |
22c35a8c |
23 | * generated in embed*.h. Such symbols are also used to generate |
14dd3ad8 |
24 | * the appropriate export list for win32. */ |
cb68f92d |
25 | |
49f531da |
26 | /* global state */ |
cb68f92d |
27 | PERLVAR(Gcurinterp, PerlInterpreter *) |
43165c05 |
28 | /* currently running interpreter |
ba869deb |
29 | * (initial parent interpreter under |
30 | * useithreads) */ |
3db8f154 |
31 | #if defined(USE_ITHREADS) |
ba869deb |
32 | PERLVAR(Gthr_key, perl_key) /* key to retrieve per-thread struct */ |
33 | #endif |
a0ed51b3 |
34 | |
27da23d5 |
35 | /* constants (these are not literals to facilitate pointer comparisons) |
36 | * (PERLVARISC really does create variables, despite its looks) */ |
37 | PERLVARISC(GYes, "1") |
38 | PERLVARISC(GNo, "") |
39 | PERLVARISC(Ghexdigit, "0123456789abcdef0123456789ABCDEF") |
40 | PERLVARISC(Gpatleave, "\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}") |
43165c05 |
41 | |
42 | /* XXX does anyone even use this? */ |
43 | PERLVARI(Gdo_undump, bool, FALSE) /* -u or dump seen? */ |
b363f7ed |
44 | |
3db8f154 |
45 | #if defined(MYMALLOC) && defined(USE_ITHREADS) |
b363f7ed |
46 | PERLVAR(Gmalloc_mutex, perl_mutex) /* Mutex for malloc */ |
47 | #endif |
534825c4 |
48 | |
49 | #if defined(USE_ITHREADS) |
50 | PERLVAR(Gop_mutex, perl_mutex) /* Mutex for op refcounting */ |
51 | #endif |
60e4ec2e |
52 | |
d90a703e |
53 | #ifdef USE_ITHREADS |
54 | PERLVAR(Gdollarzero_mutex, perl_mutex) /* Modifying $0 */ |
55 | #endif |
5c728af0 |
56 | |
57 | /* This is constant on most architectures, a global on OS/2 */ |
428eed4a |
58 | #ifdef OS2 |
59 | PERLVARI(Gsh_path, char *, SH_PATH)/* full path of shell */ |
60 | #else |
e1ec3a88 |
61 | PERLVARI(Gsh_path, const char *, SH_PATH)/* full path of shell */ |
428eed4a |
62 | #endif |
af419de7 |
63 | |
2f42fcb0 |
64 | #ifndef PERL_MICRO |
b35112e7 |
65 | /* If Perl has to ignore SIGPFE, this is its saved state. |
66 | * See perl.h macros PERL_FPU_INIT and PERL_FPU_{PRE,POST}_EXEC. */ |
67 | PERLVAR(Gsigfpe_saved, Sighandler_t) |
2f42fcb0 |
68 | #endif |
b35112e7 |
69 | |
643157af |
70 | /* Restricted hashes placeholder value. |
71 | * The contents are never used, only the address. */ |
72 | PERLVAR(Gsv_placeholder, SV) |
73 | |
2f42fcb0 |
74 | #ifndef PERL_MICRO |
1c127fab |
75 | PERLVARI(Gcsighandlerp, Sighandler_t, Perl_csighandler) /* Pointer to C-level sighandler */ |
2f42fcb0 |
76 | #endif |
5c1546dc |
77 | |
50acdf95 |
78 | #ifndef PERL_USE_SAFE_PUTENV |
79 | PERLVARI(Guse_safe_putenv, int, 1) |
80 | #endif |
27da23d5 |
81 | |
82 | #ifdef USE_PERLIO |
22c96fc1 |
83 | PERLVARI(Gperlio_fd_refcnt, int*, 0) /* Pointer to array of fd refcounts. */ |
84 | PERLVARI(Gperlio_fd_refcnt_size, int, 0) /* Size of the array */ |
27da23d5 |
85 | PERLVARI(Gperlio_debug_fd, int, 0) /* the fd to write perlio debug into, 0 means not set yet */ |
86 | #endif |
87 | |
88 | #ifdef HAS_MMAP |
89 | PERLVARI(Gmmap_page_size, IV, 0) |
90 | #endif |
91 | |
92 | #if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS)||defined(FAKE_DEFAULT_SIGNAL_HANDLERS) |
93 | PERLVARI(Gsig_handlers_initted, int, 0) |
94 | #endif |
95 | #ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS |
96 | PERLVARA(Gsig_ignoring, SIG_SIZE, int) /* which signals we are ignoring */ |
97 | #endif |
98 | #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS |
aadb217d |
99 | PERLVARA(Gsig_defaulting, SIG_SIZE, int) |
27da23d5 |
100 | #endif |
101 | |
102 | #ifndef PERL_IMPLICIT_CONTEXT |
103 | PERLVAR(Gsig_sv, SV*) |
104 | #endif |
105 | |
106 | /* XXX signals are process-wide anyway, so we |
107 | * ignore the implications of this for threading */ |
108 | #ifndef HAS_SIGACTION |
109 | PERLVARI(Gsig_trapped, int, 0) |
110 | #endif |
111 | |
112 | #ifdef DEBUGGING |
113 | PERLVAR(Gwatch_pvx, char*) |
114 | #endif |
115 | |
116 | #ifdef PERL_GLOBAL_STRUCT |
117 | PERLVAR(Gppaddr, Perl_ppaddr_t*) /* or opcode.h */ |
118 | PERLVAR(Gcheck, Perl_check_t *) /* or opcode.h */ |
119 | PERLVARA(Gfold_locale, 256, unsigned char) /* or perl.h */ |
120 | #endif |
121 | |
122 | #ifdef PERL_NEED_APPCTX |
123 | PERLVAR(Gappctx, void*) /* the application context */ |
124 | #endif |
125 | |
126 | PERLVAR(Gop_sequence, HV*) /* dump.c */ |
127 | PERLVARI(Gop_seq, UV, 0) /* dump.c */ |
128 | |
129 | #if defined(HAS_TIMES) && defined(PERL_NEED_TIMESBASE) |
130 | PERLVAR(Gtimesbase, struct tms) |
131 | #endif |
132 | |
f16dd614 |
133 | /* allocate a unique index to every module that calls MY_CXT_INIT */ |
27da23d5 |
134 | |
f16dd614 |
135 | #ifdef PERL_IMPLICIT_CONTEXT |
97aff369 |
136 | # ifdef USE_ITHREADS |
f16dd614 |
137 | PERLVAR(Gmy_ctx_mutex, perl_mutex) |
97aff369 |
138 | # endif |
f16dd614 |
139 | PERLVARI(Gmy_cxt_index, int, 0) |
140 | #endif |
71ad1b0c |
141 | |
142 | #if defined(USE_ITHREADS) |
143 | PERLVAR(Ghints_mutex, perl_mutex) /* Mutex for refcounted he refcounting */ |
144 | #endif |
6cb8cb21 |
145 | |
8b84d7dd |
146 | #if defined(USE_ITHREADS) |
6cb8cb21 |
147 | PERLVAR(Gperlio_mutex, perl_mutex) /* Mutex for perlio fd refcounts */ |
148 | #endif |
c301d606 |
149 | |
150 | /* this is currently set without MUTEX protection, so keep it a type which |
151 | * can be set atomically (ie not a bit field) */ |
152 | PERLVARI(Gveto_cleanup, int, FALSE) /* exit without cleanup */ |
153 | |