66a83f3eac
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.
107 lines
2.6 KiB
C++
107 lines
2.6 KiB
C++
/* shared_info.h: shared info for cygwin
|
|
|
|
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 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. */
|
|
|
|
#include "tty.h"
|
|
#include "security.h"
|
|
#include "mtinfo.h"
|
|
#include "limits.h"
|
|
#include "mount.h"
|
|
|
|
class user_info
|
|
{
|
|
public:
|
|
DWORD version;
|
|
DWORD cb;
|
|
bool warned_msdos;
|
|
mount_info mountinfo;
|
|
};
|
|
/******** Shared Info ********/
|
|
/* Data accessible to all tasks */
|
|
|
|
#define SHARED_VERSION (unsigned)(cygwin_version.api_major << 8 | \
|
|
cygwin_version.api_minor)
|
|
#define SHARED_VERSION_MAGIC CYGWIN_VERSION_MAGIC (SHARED_MAGIC, SHARED_VERSION)
|
|
|
|
#define SHARED_INFO_CB 39328
|
|
|
|
#define CURR_SHARED_MAGIC 0x398d8baU
|
|
|
|
#define USER_VERSION 1 // increment when mount table changes and
|
|
#define USER_VERSION_MAGIC CYGWIN_VERSION_MAGIC (USER_MAGIC, USER_VERSION)
|
|
#define CURR_USER_MAGIC 0xb2232e71U
|
|
|
|
/* NOTE: Do not make gratuitous changes to the names or organization of the
|
|
below class. The layout is checksummed to determine compatibility between
|
|
different cygwin versions. */
|
|
class shared_info
|
|
{
|
|
DWORD version;
|
|
DWORD cb;
|
|
public:
|
|
unsigned heap_chunk;
|
|
bool heap_slop_inited;
|
|
unsigned heap_slop;
|
|
DWORD sys_mount_table_counter;
|
|
tty_list tty;
|
|
LONG last_used_bindresvport;
|
|
WCHAR installation_root[PATH_MAX];
|
|
DWORD obcaseinsensitive;
|
|
mtinfo mt;
|
|
|
|
void initialize ();
|
|
void init_installation_root ();
|
|
void init_obcaseinsensitive ();
|
|
unsigned heap_chunk_size ();
|
|
unsigned heap_slop_size ();
|
|
};
|
|
|
|
extern shared_info *cygwin_shared;
|
|
extern user_info *user_shared;
|
|
#define mount_table (&(user_shared->mountinfo))
|
|
extern HANDLE cygwin_user_h;
|
|
|
|
enum shared_locations
|
|
{
|
|
SH_CYGWIN_SHARED,
|
|
SH_USER_SHARED,
|
|
SH_SHARED_CONSOLE,
|
|
SH_MYSELF,
|
|
SH_TOTAL_SIZE,
|
|
SH_JUSTCREATE,
|
|
SH_JUSTOPEN
|
|
|
|
};
|
|
|
|
void __stdcall memory_init ();
|
|
void __stdcall shared_destroy ();
|
|
|
|
#define shared_align_past(p) \
|
|
((char *) (system_info.dwAllocationGranularity * \
|
|
(((DWORD) ((p) + 1) + system_info.dwAllocationGranularity - 1) / \
|
|
system_info.dwAllocationGranularity)))
|
|
|
|
#ifdef _FHANDLER_H_
|
|
struct console_state
|
|
{
|
|
tty_min tty_min_state;
|
|
dev_console dev_state;
|
|
};
|
|
#endif
|
|
|
|
HANDLE get_shared_parent_dir ();
|
|
HANDLE get_session_parent_dir ();
|
|
char *__stdcall shared_name (char *, const char *, int);
|
|
void *__stdcall open_shared (const char *name, int n, HANDLE &shared_h, DWORD size,
|
|
shared_locations&, PSECURITY_ATTRIBUTES psa = &sec_all,
|
|
DWORD access = FILE_MAP_READ | FILE_MAP_WRITE);
|
|
extern void user_shared_create (bool reinit);
|
|
extern void user_shared_initialize ();
|
|
|