3 Copyright 2003, 2004 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
20 #define CYGTLS_INITIALIZED 0x43227
21 #define CYGTLS_EXCEPTION (0x43227 + true)
24 # define CYG_MAX_PATH 260
31 #define TLS_STACK_SIZE 256
37 Needed for the group functions
52 char pass[_PASSWORD_LEN];
58 unsigned available_drives;
61 char mnt_fsname[CYG_MAX_PATH];
62 char mnt_dir[CYG_MAX_PATH];
65 char strerror_buf[20];
74 char timezone_buf[20];
75 struct tm _localtime_buf;
78 char username[UNLEN + 1];
82 struct protoent *protoent_buf;
83 struct servent *servent_buf;
84 struct hostent *hostent_buf;
85 char signamebuf[sizeof ("Unknown signal 4294967295 ")];
88 typedef struct struct_waitq
94 void *rusage; /* pointer to potential rusage */
95 struct struct_waitq *next;
99 /* Changes to the below structure may require acompanying changes to the very
100 simple parser in the perl script 'gentls_offsets' (<<-- start parsing here).
103 typedef __uint32_t __stack_t;
106 void (*func) /*gentls_offsets*/(int)/*gentls_offsets*/;
113 unsigned initialized;
115 sigset_t sigwait_mask;
116 siginfo_t *sigwait_info;
120 struct _reent local_clib;
121 struct _local_storage locals;
123 struct _cygtls *prev, *next;
129 __stack_t stack[TLS_STACK_SIZE];
133 static CRITICAL_SECTION protect_linked_list;
135 void init_thread (void *, DWORD (*) (void *, void *));
136 static void call (DWORD (*) (void *, void *), void *);
137 static void call2 (DWORD (*) (void *, void *), void *, void *) __attribute__ ((regparm (3)));
138 static struct _cygtls *find_tls (int sig);
140 void push (__stack_t, bool) __attribute__ ((regparm (3)));
141 __stack_t pop () __attribute__ ((regparm (1)));
142 bool isinitialized () const {return initialized == CYGTLS_INITIALIZED || initialized == CYGTLS_EXCEPTION;}
143 bool in_exception () const {return initialized == CYGTLS_EXCEPTION;}
144 void set_state (bool);
145 void reset_exception ();
146 bool interrupt_now (CONTEXT *, int, void *, struct sigaction&)
147 __attribute__((regparm(3)));
148 void __stdcall interrupt_setup (int sig, void *handler,
149 struct sigaction& siga)
150 __attribute__((regparm(3)));
151 void init_threadlist_exceptions (struct _exception_list *);
152 operator HANDLE () const {return tid->win32_obj_id;}
153 void set_siginfo (struct sigpacket *) __attribute__ ((regparm (3)));
154 void set_threadkill () {threadkill = true;}
155 void reset_threadkill () {threadkill = false;}
156 int call_signal_handler () __attribute__ ((regparm (1)));
157 void remove_wq () __attribute__ ((regparm (1)));
158 void fixup_after_fork () __attribute__ ((regparm (1)));
159 void lock () __attribute__ ((regparm (1)));
160 void unlock () __attribute__ ((regparm (1)));
161 bool locked () __attribute__ ((regparm (1)));
166 extern char *_tlsbase __asm__ ("%fs:4");
167 extern char *_tlstop __asm__ ("%fs:8");
168 #define _my_tls (((_cygtls *) _tlsbase)[-1])
169 extern _cygtls *_main_tls;
171 #define __getreent() (&_my_tls.local_clib)
173 const int CYGTLS_PADSIZE = (((char *) _main_tls->padding) - ((char *) _main_tls));