2000-09-08 10:56:55 +08:00
|
|
|
/* shared_info.h: shared info for cygwin
|
2000-09-08 00:23:51 +08:00
|
|
|
|
2009-01-03 13:12:22 +08:00
|
|
|
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 Red Hat, Inc.
|
2000-09-08 00:23:51 +08:00
|
|
|
|
|
|
|
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. */
|
|
|
|
|
2000-09-08 10:56:55 +08:00
|
|
|
#include "tty.h"
|
2003-09-10 10:12:26 +08:00
|
|
|
#include "security.h"
|
2008-04-19 04:13:37 +08:00
|
|
|
#include "mtinfo.h"
|
2008-07-25 02:25:52 +08:00
|
|
|
#include "limits.h"
|
2008-12-25 23:55:31 +08:00
|
|
|
#include "mount.h"
|
2000-09-08 00:23:51 +08:00
|
|
|
|
2003-09-25 10:29:05 +08:00
|
|
|
class user_info
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DWORD version;
|
|
|
|
DWORD cb;
|
2006-08-02 02:00:44 +08:00
|
|
|
bool warned_msdos;
|
2003-09-25 10:29:05 +08:00
|
|
|
mount_info mountinfo;
|
|
|
|
};
|
2000-09-08 00:23:51 +08:00
|
|
|
/******** Shared Info ********/
|
|
|
|
/* Data accessible to all tasks */
|
|
|
|
|
2001-12-26 12:53:34 +08:00
|
|
|
#define SHARED_VERSION (unsigned)(cygwin_version.api_major << 8 | \
|
|
|
|
cygwin_version.api_minor)
|
|
|
|
#define SHARED_VERSION_MAGIC CYGWIN_VERSION_MAGIC (SHARED_MAGIC, SHARED_VERSION)
|
|
|
|
|
2008-07-25 02:25:52 +08:00
|
|
|
#define SHARED_INFO_CB 39328
|
2001-12-27 05:35:16 +08:00
|
|
|
|
2009-04-06 00:49:15 +08:00
|
|
|
#define CURR_SHARED_MAGIC 0x22f9ff0bU
|
2001-12-26 12:53:34 +08:00
|
|
|
|
2009-01-03 13:12:22 +08:00
|
|
|
#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
|
|
|
|
|
2001-12-26 14:18:41 +08:00
|
|
|
/* 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. */
|
2000-09-08 00:23:51 +08:00
|
|
|
class shared_info
|
|
|
|
{
|
2001-12-27 05:35:16 +08:00
|
|
|
DWORD version;
|
|
|
|
DWORD cb;
|
2001-05-25 11:13:14 +08:00
|
|
|
public:
|
2002-10-23 00:18:55 +08:00
|
|
|
unsigned heap_chunk;
|
2007-06-28 01:08:19 +08:00
|
|
|
bool heap_slop_inited;
|
2006-11-01 02:41:16 +08:00
|
|
|
unsigned heap_slop;
|
2001-01-28 14:23:42 +08:00
|
|
|
DWORD sys_mount_table_counter;
|
2000-09-08 00:23:51 +08:00
|
|
|
tty_list tty;
|
2008-04-19 04:13:37 +08:00
|
|
|
LONG last_used_bindresvport;
|
2008-07-25 02:25:52 +08:00
|
|
|
WCHAR installation_root[PATH_MAX];
|
2008-07-17 04:20:45 +08:00
|
|
|
DWORD obcaseinsensitive;
|
2008-04-19 04:13:37 +08:00
|
|
|
mtinfo mt;
|
|
|
|
|
2003-09-11 05:01:40 +08:00
|
|
|
void initialize ();
|
2008-07-25 02:25:52 +08:00
|
|
|
void init_installation_root ();
|
2008-07-17 04:20:45 +08:00
|
|
|
void init_obcaseinsensitive ();
|
2001-09-10 03:06:50 +08:00
|
|
|
unsigned heap_chunk_size ();
|
2006-11-01 02:41:16 +08:00
|
|
|
unsigned heap_slop_size ();
|
2000-09-08 00:23:51 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern shared_info *cygwin_shared;
|
2005-02-14 02:17:29 +08:00
|
|
|
extern user_info *user_shared;
|
2003-09-25 10:29:05 +08:00
|
|
|
#define mount_table (&(user_shared->mountinfo))
|
|
|
|
extern HANDLE cygwin_user_h;
|
2000-09-08 00:23:51 +08:00
|
|
|
|
2002-10-15 15:03:45 +08:00
|
|
|
enum shared_locations
|
|
|
|
{
|
2008-04-19 04:13:37 +08:00
|
|
|
SH_CYGWIN_SHARED,
|
2003-09-25 10:29:05 +08:00
|
|
|
SH_USER_SHARED,
|
2002-10-15 15:03:45 +08:00
|
|
|
SH_SHARED_CONSOLE,
|
|
|
|
SH_MYSELF,
|
2005-04-29 07:59:44 +08:00
|
|
|
SH_TOTAL_SIZE,
|
|
|
|
SH_JUSTCREATE,
|
|
|
|
SH_JUSTOPEN
|
|
|
|
|
2002-10-15 15:03:45 +08:00
|
|
|
};
|
2008-07-28 06:31:48 +08:00
|
|
|
|
2009-06-08 11:53:40 +08:00
|
|
|
void memory_init (bool) __attribute__ ((regparm(1)));
|
2008-07-27 22:52:46 +08:00
|
|
|
void __stdcall shared_destroy ();
|
2000-09-08 00:23:51 +08:00
|
|
|
|
2001-01-28 13:51:15 +08:00
|
|
|
#define shared_align_past(p) \
|
|
|
|
((char *) (system_info.dwAllocationGranularity * \
|
|
|
|
(((DWORD) ((p) + 1) + system_info.dwAllocationGranularity - 1) / \
|
|
|
|
system_info.dwAllocationGranularity)))
|
|
|
|
|
2004-04-09 16:43:29 +08:00
|
|
|
#ifdef _FHANDLER_H_
|
2002-10-15 15:03:45 +08:00
|
|
|
struct console_state
|
|
|
|
{
|
|
|
|
tty_min tty_min_state;
|
|
|
|
dev_console dev_state;
|
|
|
|
};
|
|
|
|
#endif
|
2001-01-28 13:51:15 +08:00
|
|
|
|
2008-04-19 04:13:37 +08:00
|
|
|
HANDLE get_shared_parent_dir ();
|
2008-04-21 20:46:58 +08:00
|
|
|
HANDLE get_session_parent_dir ();
|
2008-04-19 04:13:37 +08:00
|
|
|
char *__stdcall shared_name (char *, const char *, int);
|
2009-01-26 21:42:37 +08:00
|
|
|
WCHAR *__stdcall shared_name (WCHAR *, const WCHAR *, int);
|
|
|
|
void *__stdcall open_shared (const WCHAR *name, int n, HANDLE &shared_h,
|
|
|
|
DWORD size, shared_locations&,
|
|
|
|
PSECURITY_ATTRIBUTES psa = &sec_all,
|
2005-04-29 07:59:44 +08:00
|
|
|
DWORD access = FILE_MAP_READ | FILE_MAP_WRITE);
|
2008-07-28 06:31:48 +08:00
|
|
|
extern void user_shared_create (bool reinit);
|
|
|
|
extern void user_shared_initialize ();
|
2008-07-25 23:23:56 +08:00
|
|
|
|