OSDN Git Service

Rename cygWFMO to cygwait throughout and use the magic of polymorphism to "wait
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygwin / shared_info.h
1 /* shared_info.h: shared info for cygwin
2
3    Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009,
4    2010, 2011 Red Hat, Inc.
5
6 This file is part of Cygwin.
7
8 This software is a copyrighted work licensed under the terms of the
9 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
10 details. */
11
12 #include "tty.h"
13 #include "security.h"
14 #include "mtinfo.h"
15 #include "limits.h"
16 #include "mount.h"
17
18 #define CURR_USER_MAGIC 0x6467403bU
19
20 class user_info
21 {
22   void initialize ();
23 public:
24   LONG version;
25   DWORD cb;
26   bool warned_msdos;
27   bool warned_notty;
28   mount_info mountinfo;
29   friend void dll_crt0_1 (void *);
30   static void create (bool);
31 };
32
33 /******** Shared Info ********/
34 /* Data accessible to all tasks */
35
36
37 #define CURR_SHARED_MAGIC 0x8fe4d9eeU
38
39 #define USER_VERSION   1
40
41 /* NOTE: Do not make gratuitous changes to the names or organization of the
42    below class.  The layout is checksummed to determine compatibility between
43    different cygwin versions. */
44 class shared_info
45 {
46   LONG version;
47   DWORD cb;
48  public:
49   tty_list tty;
50   LONG last_used_bindresvport;
51   DWORD obcaseinsensitive;
52   mtinfo mt;
53
54   void initialize ();
55   void init_obcaseinsensitive ();
56   unsigned heap_chunk_size ();
57   static void create ();
58 };
59
60 extern shared_info *cygwin_shared;
61 extern user_info *user_shared;
62 #define mount_table (&(user_shared->mountinfo))
63 extern HANDLE cygwin_user_h;
64
65 enum shared_locations
66 {
67   SH_CYGWIN_SHARED,
68   SH_USER_SHARED,
69   SH_MYSELF,
70   SH_SHARED_CONSOLE,
71   SH_TOTAL_SIZE,
72   SH_JUSTCREATE,
73   SH_JUSTOPEN
74
75 };
76
77 void memory_init (bool) __attribute__ ((regparm(1)));
78 void __stdcall shared_destroy ();
79
80 #define shared_align_past(p) \
81   ((char *) (system_info.dwAllocationGranularity * \
82              (((DWORD) ((p) + 1) + system_info.dwAllocationGranularity - 1) / \
83               system_info.dwAllocationGranularity)))
84
85 HANDLE get_shared_parent_dir ();
86 HANDLE get_session_parent_dir ();
87 char *__stdcall shared_name (char *, const char *, int);
88 WCHAR *__stdcall shared_name (WCHAR *, const WCHAR *, int);
89 void *__stdcall open_shared (const WCHAR *, int, HANDLE&, DWORD,
90                              shared_locations, PSECURITY_ATTRIBUTES = &sec_all,
91                              DWORD = FILE_MAP_READ | FILE_MAP_WRITE);
92 void *__stdcall open_shared (const WCHAR *, int, HANDLE&, DWORD,
93                              shared_locations *, PSECURITY_ATTRIBUTES = &sec_all,
94                              DWORD = FILE_MAP_READ | FILE_MAP_WRITE);
95 extern void user_shared_create (bool reinit);
96 extern void init_installation_root ();
97 extern WCHAR installation_root[PATH_MAX];
98 extern UNICODE_STRING installation_key;