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