3 Copyright 2003, 2004, 2005 Red Hat, Inc.
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
16 #define _NOMNTENT_FUNCS
18 #undef _NOMNTENT_FUNCS
19 #define USE_SYS_TYPES_FD_SET
22 #define CYGTLS_INITIALIZED 0x43227
23 #define CYGTLS_EXCEPTION (0x43227 + true)
24 #define CYGTLSMAGIC "D0Ub313v31nm&G1c?";
27 # define CYG_MAX_PATH 260
34 #define TLS_STACK_SIZE 256
36 #include "cygthread.h"
42 Needed for the group functions
57 char pass[_PASSWORD_LEN];
63 unsigned available_drives;
66 char mnt_fsname[CYG_MAX_PATH];
67 char mnt_dir[CYG_MAX_PATH];
71 struct sockaddr_in exitsock_sin;
74 char strerror_buf[20];
77 char *process_ident; // note: malloced
83 char timezone_buf[20];
84 struct tm _localtime_buf;
87 char username[UNLEN + 1];
90 char *ntoa_buf; // note: malloced
91 struct protoent *protoent_buf; // note: malloced
92 struct servent *servent_buf; // note: malloced
93 struct hostent *hostent_buf; // note: malloced
94 char signamebuf[sizeof ("Unknown signal 4294967295 ")];
97 typedef struct struct_waitq
103 void *rusage; /* pointer to potential rusage */
104 struct struct_waitq *next;
108 /* Changes to the below structure may require acompanying changes to the very
109 simple parser in the perl script 'gentls_offsets' (<<-- start parsing here).
110 The union in this structure is used to force alignment between the version
111 of the compiler used to generate tlsoffsets.h and the cygwin cross compiler.
114 typedef __uint32_t __stack_t;
117 void (*func) /*gentls_offsets*/(int)/*gentls_offsets*/;
124 unsigned initialized;
126 sigset_t sigwait_mask;
127 siginfo_t *sigwait_info;
133 struct _reent local_clib;
134 char __dontuse[8 * ((sizeof(struct _reent) + 4) / 8)];
136 struct _local_storage locals;
137 class cygthread *_ctinfo;
139 struct _cygtls *prev, *next;
145 __stack_t stack[TLS_STACK_SIZE];
149 static CRITICAL_SECTION protect_linked_list;
151 void init_thread (void *, DWORD (*) (void *, void *));
152 static void call (DWORD (*) (void *, void *), void *);
153 static void call2 (DWORD (*) (void *, void *), void *, void *) __attribute__ ((regparm (3)));
154 static struct _cygtls *find_tls (int sig);
156 void push (__stack_t, bool) __attribute__ ((regparm (3)));
157 __stack_t pop () __attribute__ ((regparm (1)));
158 bool isinitialized () const {return initialized == CYGTLS_INITIALIZED || initialized == CYGTLS_EXCEPTION;}
159 bool in_exception () const {return initialized == CYGTLS_EXCEPTION;}
160 void set_state (bool);
161 void reset_exception ();
162 bool interrupt_now (CONTEXT *, int, void *, struct sigaction&)
163 __attribute__((regparm(3)));
164 void __stdcall interrupt_setup (int sig, void *handler,
165 struct sigaction& siga)
166 __attribute__((regparm(3)));
167 void init_threadlist_exceptions (struct _exception_list *);
168 operator HANDLE () const {return tid->win32_obj_id;}
169 void set_siginfo (struct sigpacket *) __attribute__ ((regparm (3)));
170 void set_threadkill () {threadkill = true;}
171 void reset_threadkill () {threadkill = false;}
172 int call_signal_handler () __attribute__ ((regparm (1)));
173 void remove_wq (DWORD) __attribute__ ((regparm (1)));
174 void fixup_after_fork () __attribute__ ((regparm (1)));
175 void lock () __attribute__ ((regparm (1)));
176 void unlock () __attribute__ ((regparm (1)));
177 bool locked () __attribute__ ((regparm (1)));
182 extern char *_tlsbase __asm__ ("%fs:4");
183 extern char *_tlstop __asm__ ("%fs:8");
184 #define _my_tls (((_cygtls *) _tlsbase)[-1])
185 extern _cygtls *_main_tls;
187 #define __getreent() (&_my_tls.local_clib)
189 const int CYGTLS_PADSIZE = (((char *) _main_tls->padding) - ((char *) _main_tls));