Install msysDVLPR-1.0.0-alpha-1
[msysgit.git] / lib / gcc-lib / i686-pc-msys / 2.95.3-1 / include / sys / cygwin.h
blobfba9d99761ef83c711b8b3055e464fc5f780dd84
1 /* sys/cygwin.h
3 Copyright 1997, 1998, 2000, 2001 Red Hat, Inc.
5 This file is part of Cygwin.
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
9 details. */
11 #ifndef _SYS_CYGWIN_H
12 #define _SYS_CYGWIN_H
14 #include <sys/types.h>
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
20 extern pid_t cygwin32_winpid_to_pid (int);
21 extern void cygwin32_win32_to_posix_path_list (const char *, char *);
22 extern int cygwin32_win32_to_posix_path_list_buf_size (const char *);
23 extern void cygwin32_posix_to_win32_path_list (const char *, char *);
24 extern int cygwin32_posix_to_win32_path_list_buf_size (const char *);
25 extern int cygwin32_conv_to_win32_path (const char *, char *);
26 extern int cygwin32_conv_to_full_win32_path (const char *, char *);
27 extern void cygwin32_conv_to_posix_path (const char *, char *);
28 extern void cygwin32_conv_to_full_posix_path (const char *, char *);
29 extern int cygwin32_posix_path_list_p (const char *);
30 extern void cygwin32_split_path (const char *, char *, char *);
32 extern pid_t cygwin_winpid_to_pid (int);
33 extern int cygwin_win32_to_posix_path_list (const char *, char *);
34 extern int cygwin_win32_to_posix_path_list_buf_size (const char *);
35 extern int cygwin_posix_to_win32_path_list (const char *, char *);
36 extern int cygwin_posix_to_win32_path_list_buf_size (const char *);
37 extern int cygwin_conv_to_win32_path (const char *, char *);
38 extern int cygwin_conv_to_full_win32_path (const char *, char *);
39 extern int cygwin_conv_to_posix_path (const char *, char *);
40 extern int cygwin_conv_to_full_posix_path (const char *, char *);
41 extern int cygwin_posix_path_list_p (const char *);
42 extern void cygwin_split_path (const char *, char *, char *);
44 struct __cygwin_perfile
46 const char *name;
47 unsigned flags;
50 /* External interface stuff */
52 typedef enum
54 CW_LOCK_PINFO,
55 CW_UNLOCK_PINFO,
56 CW_GETTHREADNAME,
57 CW_GETPINFO,
58 CW_SETPINFO,
59 CW_SETTHREADNAME,
60 CW_GETVERSIONINFO,
61 CW_READ_V1_MOUNT_TABLES,
62 CW_USER_DATA,
63 CW_PERFILE,
64 CW_GET_CYGDRIVE_PREFIXES,
65 CW_GETPINFO_FULL,
66 CW_INIT_EXCEPTIONS,
67 CW_GET_CYGDRIVE_INFO
68 } cygwin_getinfo_types;
70 #define CW_NEXTPID 0x80000000
72 /* Flags associated with process_state */
73 enum
75 PID_IN_USE = 0x0001,
76 PID_ZOMBIE = 0x0002,
77 PID_STOPPED = 0x0004,
78 PID_TTYIN = 0x0008,
79 PID_TTYOU = 0x0010,
80 PID_ORPHANED = 0x0020,
81 PID_ACTIVE = 0x0040,
82 PID_CYGPARENT = 0x0080,
83 PID_SPLIT_HEAP = 0x0100,
85 PID_UNUSED = 0x0200,
87 PID_UNUSED1 = 0x0400,
88 PID_INITIALIZING = 0x0800,
89 PID_USETTY = 0x1000,
92 PID_UNUSED2 = 0x2000,
93 PID_EXECED = 0x4000,
94 PID_NOREDIR = 0x8000,
95 PID_EXITED = 0x80000000
98 #ifdef WINVER
99 #ifdef _PATH_PASSWD
100 extern HANDLE cygwin_logon_user (const struct passwd *, const char *);
101 #endif
103 /* This lives in the app and is initialized before jumping into the DLL.
104 It should only contain stuff which the user's process needs to see, or
105 which is needed before the user pointer is initialized, or is needed to
106 carry inheritance information from parent to child. Note that it cannot
107 be used to carry inheritance information across exec!
109 Remember, this structure is linked into the application's executable.
110 Changes to this can invalidate existing executables, so we go to extra
111 lengths to avoid having to do it.
113 When adding/deleting members, remember to adjust {public,internal}_reserved.
114 The size of the class shouldn't change [unless you really are prepared to
115 invalidate all existing executables]. The program does a check (using
116 SIZEOF_PER_PROCESS) to make sure you remember to make the adjustment.
119 #ifdef __cplusplus
120 class ResourceLocks;
121 class MTinterface;
122 #endif
124 struct per_process
126 char *initial_sp;
128 /* The offset of these 3 values can never change. */
129 /* magic_biscuit is the size of this class and should never change. */
130 unsigned long magic_biscuit;
131 unsigned long dll_major;
132 unsigned long dll_minor;
134 struct _reent **impure_ptr_ptr;
135 char ***envptr;
137 /* Used to point to the memory machine we should use. Usually these
138 point back into the dll, but they can be overridden by the user. */
139 void *(*malloc)(size_t);
140 void (*free)(void *);
141 void *(*realloc)(void *, size_t);
143 int *fmode_ptr;
145 int (*main)(int, char **, char **);
146 void (**ctors)(void);
147 void (**dtors)(void);
149 /* For fork */
150 void *data_start;
151 void *data_end;
152 void *bss_start;
153 void *bss_end;
155 void *(*calloc)(size_t, size_t);
156 /* For future expansion of values set by the app. */
157 void (*premain[4]) (int, char **, struct per_process *);
159 /* The rest are *internal* to cygwin.dll.
160 Those that are here because we want the child to inherit the value from
161 the parent (which happens when bss is copied) are marked as such. */
163 /* non-zero of ctors have been run. Inherited from parent. */
164 int run_ctors_p;
166 DWORD unused[7];
168 /* Non-zero means the task was forked. The value is the pid.
169 Inherited from parent. */
170 int forkee;
172 HMODULE hmodule;
174 DWORD api_major; /* API version that this program was */
175 DWORD api_minor; /* linked with */
176 /* For future expansion, so apps won't have to be relinked if we
177 add an item. */
178 DWORD unused2[5];
180 #if defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__)
181 ResourceLocks *resourcelocks;
182 MTinterface *threadinterface;
183 #else
184 void *resourcelocks;
185 void *threadinterface;
186 #endif
187 struct _reent *impure_ptr;
189 #define per_process_overwrite ((unsigned) &(((struct per_process *) NULL)->resourcelocks))
191 extern void cygwin_premain0 (int argc, char **argv, struct per_process *);
192 extern void cygwin_premain1 (int argc, char **argv, struct per_process *);
193 extern void cygwin_premain2 (int argc, char **argv, struct per_process *);
194 extern void cygwin_premain3 (int argc, char **argv, struct per_process *);
196 extern void cygwin_set_impersonation_token (const HANDLE);
198 /* included if <windows.h> is included */
199 extern int cygwin32_attach_handle_to_fd (char *, int, HANDLE, mode_t, DWORD);
200 extern int cygwin_attach_handle_to_fd (char *, int, HANDLE, mode_t, DWORD);
202 #include <sys/resource.h>
204 #define TTY_CONSOLE 0x40000000
206 struct external_pinfo
208 pid_t pid;
209 pid_t ppid;
210 HANDLE hProcess;
211 DWORD dwProcessId, dwSpawnedProcessId;
212 uid_t uid;
213 gid_t gid;
214 pid_t pgid;
215 pid_t sid;
216 int ctty;
217 mode_t umask;
219 long start_time;
220 struct rusage rusage_self;
221 struct rusage rusage_children;
223 char progname[MAX_PATH];
225 DWORD strace_mask;
226 HANDLE strace_file;
228 DWORD process_state;
231 DWORD cygwin_internal (cygwin_getinfo_types, ...);
232 #endif /*WINVER*/
234 #ifdef __cplusplus
236 #endif
238 #endif /* _SYS_CYGWIN_H */