newlib-cygwin/winsup/cygwin/globals.cc

116 lines
2.8 KiB
C++
Raw Normal View History

Remove unneeded header files from source files throughout. Update copyrights where appropriate. * globals.cc: New file for generic global variables. * mkglobals_h: New file to generate globals.h. * mkstatic: New Script used to build a (currently non-working) static libcygwin_s.a. * Makefile.in: Add unused rule to build a non-working libcygwin_s.a. (DLL_OFILES): Add globals.o. Make all objects rely on globals.h. (globals.h): New target. Generate globals.h. * cygtls.h: Honor new CYGTLS_HANDLE define to control when the HANDLE operator is allowed in _cygtls. * dcrt0.cc: Move most globals to globals.cc. * init.cc: Ditto. * environ.cc (strip_title_path): Remove now-unneeded extern. * fhandler_serial.cc (fhandler_serial::open): Ditto. * pinfo.cc: Ditto. (commune_process): Ditto. * shared.cc: Ditto. * glob.cc: Ditto. * strace.cc: Ditto. * exceptions.cc: Define CYGTLS_HANDLE before including winsup.h. * path.cc (stat_suffixes): Move here. * security.h: Add forward class path_conv declaration. * smallprint.cc (__small_vsprintf): Make a true c++ function. (__small_sprintf): Ditto. (small_printf): Ditto. (console_printf): Ditto. (__small_vswprintf): Ditto. (__small_swprintf): Ditto. * spawn.cc (spawn_guts): Remove _stdcall decoration in favor of regparm. (hExeced): Move to globals.cc * strfuncs.cc (current_codepage): Ditto. (active_codepage): Ditto. * sync.cc (lock_process::locker): Move here from dcrt0.cc. * syscalls.cc (stat_suffixes): Move to path.cc. * tty.cc (tty::create_master): Uncapitalize fatal warning for consistency. * winsup.h: Include globals.h to declare most of the grab bag list of globals which were previously defined here. * mount.h: Move USER_* defines back to shared_info.h. * speclib: Force temporary directory cleanup.
2009-01-03 13:12:22 +08:00
/* globals.cc - Define global variables here.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009 Red Hat, Inc.
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#define _GLOBALS_H 1
#include "winsup.h"
#include "cygtls.h"
#include "perprocess.h"
#include "thread.h"
#include <malloc.h>
#include <cygwin/version.h>
HANDLE NO_COPY hMainProc = (HANDLE) -1;
HANDLE NO_COPY hMainThread;
HANDLE NO_COPY hProcToken;
HANDLE NO_COPY hProcImpToken;
HMODULE NO_COPY cygwin_hmodule;
HANDLE hExeced;
/* Codepage and multibyte string specific stuff. */
enum codepage_type {ansi_cp, oem_cp, utf8_cp};
codepage_type current_codepage = ansi_cp;
UINT active_codepage;
/* program exit the program */
enum exit_states
{
ES_NOT_EXITING = 0,
ES_PROCESS_LOCKED,
ES_GLOBAL_DTORS,
ES_EVENTS_TERMINATE,
ES_THREADTERM,
ES_SIGNAL,
ES_CLOSEALL,
ES_HUP_PGRP,
ES_HUP_SID,
ES_EXEC_EXIT,
ES_TITLE,
ES_TTY_TERMINATE,
ES_FINAL
};
exit_states NO_COPY exit_state;
SYSTEM_INFO system_info;
/* Set in init.cc. Used to check if Cygwin DLL is dynamically loaded. */
int NO_COPY dynamically_loaded;
bool display_title;
bool strip_title_path;
bool allow_glob = true;
bool NO_COPY in_forkee;
int __argc_safe;
int __argc;
char **__argv;
#ifdef NEWVFORK
vfork_save NO_COPY *main_vfork;
#endif
_cygtls NO_COPY *_main_tls /* !globals.h */;
bool NO_COPY cygwin_finished_initializing;
bool NO_COPY _cygwin_testing;
char NO_COPY almost_null[1];
char *old_title;
extern "C"
{
/* This is an exported copy of environ which can be used by DLLs
which use cygwin.dll. */
char **__cygwin_environ;
char ***main_environ = &__cygwin_environ;
/* __progname used in getopt error message */
char *__progname;
static MTinterface _mtinterf;
struct per_process __cygwin_user_data =
{/* initial_sp */ 0, /* magic_biscuit */ 0,
/* dll_major */ CYGWIN_VERSION_DLL_MAJOR,
/* dll_major */ CYGWIN_VERSION_DLL_MINOR,
/* impure_ptr_ptr */ NULL, /* envptr */ NULL,
/* malloc */ malloc, /* free */ free,
/* realloc */ realloc,
/* fmode_ptr */ NULL, /* main */ NULL, /* ctors */ NULL,
/* dtors */ NULL, /* data_start */ NULL, /* data_end */ NULL,
/* bss_start */ NULL, /* bss_end */ NULL,
/* calloc */ calloc,
/* premain */ {NULL, NULL, NULL, NULL},
/* run_ctors_p */ 0,
/* unused */ {0, 0, 0, 0, 0, 0, 0},
/* UNUSED forkee */ 0,
/* hmodule */ NULL,
/* api_major */ CYGWIN_VERSION_API_MAJOR,
/* api_minor */ CYGWIN_VERSION_API_MINOR,
/* unused2 */ {0, 0, 0, 0, 0, 0},
/* threadinterface */ &_mtinterf,
/* impure_ptr */ _GLOBAL_REENT,
};
bool ignore_case_with_glob;
int _check_for_executable = true;
};
int NO_COPY __api_fatal_exit_val = 1;