1 /* globals.cc - Define global variables here.
3 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 2006, 2007, 2008, 2009 Red Hat, Inc.
6 This file is part of Cygwin.
8 This software is a copyrighted work licensed under the terms of the
9 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
15 #include "perprocess.h"
18 #include <cygwin/version.h>
20 HANDLE NO_COPY hMainProc = (HANDLE) -1;
21 HANDLE NO_COPY hMainThread;
22 HANDLE NO_COPY hProcToken;
23 HANDLE NO_COPY hProcImpToken;
24 HMODULE NO_COPY cygwin_hmodule;
27 /* program exit the program */
45 exit_states NO_COPY exit_state;
47 SYSTEM_INFO system_info;
49 /* Set in init.cc. Used to check if Cygwin DLL is dynamically loaded. */
50 int NO_COPY dynamically_loaded;
53 bool strip_title_path;
54 bool allow_glob = true;
55 bool NO_COPY in_forkee;
61 vfork_save NO_COPY *main_vfork;
64 _cygtls NO_COPY *_main_tls /* !globals.h */;
66 bool NO_COPY cygwin_finished_initializing;
68 bool NO_COPY _cygwin_testing;
70 char NO_COPY almost_null[1];
74 /* Heavily-used const UNICODE_STRINGs are defined here once. The idea is a
75 speed improvement by not having to initialize a UNICODE_STRING every time
76 we make a string comparison. The strings are not defined as const,
77 because the respective NT functions are not taking const arguments
78 and doing so here results in lots of extra casts for no good reason.
79 Rather, the strings are placed in the R/O section .rdata, so we get
80 a SEGV if some code erroneously tries to overwrite these strings. */
82 { Length: sizeof (_s) - sizeof (WCHAR), \
83 MaximumLength: sizeof (_s), \
84 Buffer: (PWSTR) (_s) }
85 #define _RDATA __attribute__ ((section(".rdata")))
86 UNICODE_STRING _RDATA ro_u_empty = _ROU (L"");
87 UNICODE_STRING _RDATA ro_u_lnk = _ROU (L".lnk");
88 UNICODE_STRING _RDATA ro_u_exe = _ROU (L".exe");
89 UNICODE_STRING _RDATA ro_u_com = _ROU (L".com");
90 UNICODE_STRING _RDATA ro_u_proc = _ROU (L"proc");
91 UNICODE_STRING _RDATA ro_u_pmem = _ROU (L"\\device\\physicalmemory");
92 UNICODE_STRING _RDATA ro_u_natp = _ROU (L"\\??\\");
93 UNICODE_STRING _RDATA ro_u_uncp = _ROU (L"\\??\\UNC\\");
94 UNICODE_STRING _RDATA ro_u_mtx = _ROU (L"mtx");
95 UNICODE_STRING _RDATA ro_u_csc = _ROU (L"CSC-CACHE");
96 UNICODE_STRING _RDATA ro_u_fat = _ROU (L"FAT");
97 UNICODE_STRING _RDATA ro_u_mvfs = _ROU (L"MVFS");
98 UNICODE_STRING _RDATA ro_u_nfs = _ROU (L"NFS");
99 UNICODE_STRING _RDATA ro_u_ntfs = _ROU (L"NTFS");
100 UNICODE_STRING _RDATA ro_u_sunwnfs = _ROU (L"SUNWNFS");
101 UNICODE_STRING _RDATA ro_u_udf = _ROU (L"UDF");
102 UNICODE_STRING _RDATA ro_u_unixfs = _ROU (L"UNIXFS");
108 /* This is an exported copy of environ which can be used by DLLs
109 which use cygwin.dll. */
110 char **__cygwin_environ;
111 char ***main_environ = &__cygwin_environ;
112 /* __progname used in getopt error message */
114 static MTinterface _mtinterf;
115 struct per_process __cygwin_user_data =
116 {/* initial_sp */ 0, /* magic_biscuit */ 0,
117 /* dll_major */ CYGWIN_VERSION_DLL_MAJOR,
118 /* dll_major */ CYGWIN_VERSION_DLL_MINOR,
119 /* impure_ptr_ptr */ NULL, /* envptr */ NULL,
120 /* malloc */ malloc, /* free */ free,
121 /* realloc */ realloc,
122 /* fmode_ptr */ NULL, /* main */ NULL, /* ctors */ NULL,
123 /* dtors */ NULL, /* data_start */ NULL, /* data_end */ NULL,
124 /* bss_start */ NULL, /* bss_end */ NULL,
126 /* premain */ {NULL, NULL, NULL, NULL},
128 /* unused */ {0, 0, 0, 0, 0, 0, 0},
129 /* cxx_malloc */ &default_cygwin_cxx_malloc,
131 /* api_major */ CYGWIN_VERSION_API_MAJOR,
132 /* api_minor */ CYGWIN_VERSION_API_MINOR,
133 /* unused2 */ {0, 0, 0, 0, 0, 0},
134 /* threadinterface */ &_mtinterf,
135 /* impure_ptr */ _GLOBAL_REENT,
137 bool ignore_case_with_glob;
138 int _check_for_executable = true;
141 int NO_COPY __api_fatal_exit_val = 1;