This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Avoid most getprotobyname/number calls in IO::Socket::INET
[perl5.git] / perlvars.h
1 /*    perlvars.h
2  *
3  *    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
4  *    by Larry Wall and others
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
11 /****************/
12 /* Truly global */
13 /****************/
14
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
23  * generated in embed*.h.  Such symbols are also used to generate
24  * the appropriate export list for win32. */
25
26 /* global state */
27 PERLVAR(Gcurinterp,     PerlInterpreter *)
28                                         /* currently running interpreter
29                                          * (initial parent interpreter under
30                                          * useithreads) */
31 #if defined(USE_ITHREADS)
32 PERLVAR(Gthr_key,       perl_key)       /* key to retrieve per-thread struct */
33 #endif
34
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[{]}")
41
42 /* XXX does anyone even use this? */
43 PERLVARI(Gdo_undump,    bool,   FALSE)  /* -u or dump seen? */
44
45 #if defined(MYMALLOC) && defined(USE_ITHREADS)
46 PERLVAR(Gmalloc_mutex,  perl_mutex)     /* Mutex for malloc */
47 #endif
48
49 #if defined(USE_ITHREADS)
50 PERLVAR(Gop_mutex,      perl_mutex)     /* Mutex for op refcounting */
51 #endif
52
53 #ifdef USE_ITHREADS
54 PERLVAR(Gdollarzero_mutex, perl_mutex)  /* Modifying $0 */
55 #endif
56
57 /* This is constant on most architectures, a global on OS/2 */
58 PERLVARI(Gsh_path,      const char *,   SH_PATH)/* full path of shell */
59
60 #ifndef PERL_MICRO
61 /* If Perl has to ignore SIGPFE, this is its saved state.
62  * See perl.h macros PERL_FPU_INIT and PERL_FPU_{PRE,POST}_EXEC. */
63 PERLVAR(Gsigfpe_saved,  Sighandler_t)
64 #endif
65
66 /* Restricted hashes placeholder value.
67  * The contents are never used, only the address. */
68 PERLVAR(Gsv_placeholder, SV)
69
70 #ifndef PERL_MICRO
71 PERLVARI(Gcsighandlerp, Sighandler_t, Perl_csighandler) /* Pointer to C-level sighandler */
72 #endif
73
74 #ifndef PERL_USE_SAFE_PUTENV
75 PERLVARI(Guse_safe_putenv, int, 1)
76 #endif
77
78 #ifdef USE_PERLIO
79 PERLVARA(Gperlio_fd_refcnt, 2048, int) /* PERLIO_MAX_REFCOUNTABLE_FD */
80 PERLVARI(Gperlio_debug_fd, int, 0) /* the fd to write perlio debug into, 0 means not set yet */
81 #endif
82
83 #ifdef HAS_MMAP
84 PERLVARI(Gmmap_page_size, IV, 0)
85 #endif
86
87 #if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS)||defined(FAKE_DEFAULT_SIGNAL_HANDLERS)
88 PERLVARI(Gsig_handlers_initted, int, 0)
89 #endif
90 #ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS
91 PERLVARA(Gsig_ignoring, SIG_SIZE, int)  /* which signals we are ignoring */
92 #endif
93 #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
94 PERLVARA(Gsig_defaulting, SIG_SIZE, int)
95 #endif
96
97 #ifndef PERL_IMPLICIT_CONTEXT
98 PERLVAR(Gsig_sv, SV*)
99 #endif
100
101 /* XXX signals are process-wide anyway, so we
102  * ignore the implications of this for threading */
103 #ifndef HAS_SIGACTION
104 PERLVARI(Gsig_trapped, int, 0)
105 #endif
106
107 #ifdef DEBUGGING
108 PERLVAR(Gwatch_pvx, char*)
109 #endif
110
111 #ifdef PERL_GLOBAL_STRUCT 
112 PERLVAR(Gppaddr, Perl_ppaddr_t*) /* or opcode.h */
113 PERLVAR(Gcheck,  Perl_check_t *) /* or opcode.h */
114 PERLVARA(Gfold_locale, 256, unsigned char) /* or perl.h */
115 #endif
116
117 #ifdef PERL_NEED_APPCTX
118 PERLVAR(Gappctx, void*) /* the application context */
119 #endif
120
121 PERLVAR(Gop_sequence, HV*) /* dump.c */
122 PERLVARI(Gop_seq, UV, 0) /* dump.c */
123
124 #if defined(HAS_TIMES) && defined(PERL_NEED_TIMESBASE)
125 PERLVAR(Gtimesbase, struct tms)
126 #endif
127
128 /* allocate a unique index to every module that calls MY_CXT_INIT */
129
130 #ifdef PERL_IMPLICIT_CONTEXT
131 # ifdef USE_ITHREADS
132 PERLVAR(Gmy_ctx_mutex, perl_mutex)
133 # endif
134 PERLVARI(Gmy_cxt_index, int, 0)
135 #endif