From 09b0109620d0a6f1122844868ad30d3e66d11e94 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 5 Dec 2005 20:20:18 +0000 Subject: [PATCH] Remove unneeded whitespace. * cygtls.cc (_cygtls::set_state): Delete. (_cygtls::reset_exception): Ditto. (_cygtls::init_thread): Set initialized state directly here. (_cygtls::push): Remove exception argument. Don't treat exceptions specially. * cygtls.h (_cygtls::push): Ditto. (_cygtls::isinitialized): Don't treat exceptions specially. (_cygtls::reset_exception): Delete. (_cygtls::set_state): Ditto. (_cygtls::handle_exceptions): Don't push ebp on the stack prior to calling sig_send. Just set incyg instead. (_cygtls::interrupt_setup): Accommodate _cygtls::push argument change. (_cygtls::interrupt_now): Ditto. (setup_handler): Don't treat exceptions specially. * gendef (longjmp): Always zero incyg flag. --- winsup/cygwin/ChangeLog | 19 +++++++++++++++++++ winsup/cygwin/cygheap.cc | 2 +- winsup/cygwin/cygtls.cc | 27 ++------------------------- winsup/cygwin/cygtls.h | 8 ++------ winsup/cygwin/dir.cc | 4 ++++ winsup/cygwin/exceptions.cc | 22 +++++++++++----------- winsup/cygwin/gendef | 2 ++ winsup/cygwin/mmap.cc | 12 ++++++------ winsup/cygwin/net.cc | 2 +- 9 files changed, 48 insertions(+), 50 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d3f906f37..93a0b93b4 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,22 @@ +2005-12-05 Christopher Faylor + + Remove unneeded whitespace. + * cygtls.cc (_cygtls::set_state): Delete. + (_cygtls::reset_exception): Ditto. + (_cygtls::init_thread): Set initialized state directly here. + (_cygtls::push): Remove exception argument. Don't treat exceptions + specially. + * cygtls.h (_cygtls::push): Ditto. + (_cygtls::isinitialized): Don't treat exceptions specially. + (_cygtls::reset_exception): Delete. + (_cygtls::set_state): Ditto. + (_cygtls::handle_exceptions): Don't push ebp on the stack prior to + calling sig_send. Just set incyg instead. + (_cygtls::interrupt_setup): Accommodate _cygtls::push argument change. + (_cygtls::interrupt_now): Ditto. + (setup_handler): Don't treat exceptions specially. + * gendef (longjmp): Always zero incyg flag. + 2005-12-04 Corinna Vinschen * environ.cc (spenvs): Add "windir" as an "always export" variable diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index 5a93c75be..cf64684b1 100644 --- a/winsup/cygwin/cygheap.cc +++ b/winsup/cygwin/cygheap.cc @@ -103,7 +103,7 @@ init_cygheap::manage_console_count (const char *something, int amount, bool avoi } return console_count; } - + void init_cygheap::close_ctty () { diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc index fa755168c..568c5af23 100644 --- a/winsup/cygwin/cygtls.cc +++ b/winsup/cygwin/cygtls.cc @@ -59,24 +59,6 @@ _cygtls::init () sentry::lock.init ("sentry_lock"); } -void -_cygtls::set_state (bool is_exception) -{ - initialized = CYGTLS_INITIALIZED + is_exception; -} - -void -_cygtls::reset_exception () -{ - if (initialized == CYGTLS_EXCEPTION) - { -#ifdef DEBUGGING - debug_printf ("resetting stack after an exception stack %p, stackptr %p", stack, stackptr); -#endif - set_state (false); - } -} - /* Two calls to get the stack right... */ void _cygtls::call (DWORD (*func) (void *, void *), void *arg) @@ -118,8 +100,8 @@ _cygtls::init_thread (void *x, DWORD (*func) (void *, void *)) init_exception_handler (handle_exceptions); } + initialized = CYGTLS_INITIALIZED; locals.exitsock = INVALID_SOCKET; - set_state (false); errno_addr = &(local_clib._errno); if ((void *) func == (void *) cygthread::stub @@ -202,14 +184,9 @@ _cygtls::remove (DWORD wait) } void -_cygtls::push (__stack_t addr, bool exception) +_cygtls::push (__stack_t addr) { - if (exception) - lock (); *stackptr++ = (__stack_t) addr; - if (exception) - unlock (); - set_state (exception); } #define BAD_IX ((size_t) -1) diff --git a/winsup/cygwin/cygtls.h b/winsup/cygwin/cygtls.h index 9d863df18..7ce70e04b 100644 --- a/winsup/cygwin/cygtls.h +++ b/winsup/cygwin/cygtls.h @@ -47,7 +47,6 @@ typedef unsigned int SOCKET; #endif #define CYGTLS_INITIALIZED 0x43227 -#define CYGTLS_EXCEPTION (0x43227 + true) #define CYGTLSMAGIC "D0Ub313v31nm&G1c?"; #ifndef CYG_MAX_PATH @@ -203,12 +202,9 @@ struct _cygtls static void call2 (DWORD (*) (void *, void *), void *, void *) __attribute__ ((regparm (3))); static struct _cygtls *find_tls (int sig); void remove (DWORD); - void push (__stack_t, bool) __attribute__ ((regparm (3))); + void push (__stack_t) __attribute__ ((regparm (2))); __stack_t pop () __attribute__ ((regparm (1))); - bool isinitialized () const {return initialized == CYGTLS_INITIALIZED || initialized == CYGTLS_EXCEPTION;} - bool in_exception () const {return initialized == CYGTLS_EXCEPTION;} - void set_state (bool); - void reset_exception (); + bool isinitialized () const {return initialized == CYGTLS_INITIALIZED;} bool interrupt_now (CONTEXT *, int, void *, struct sigaction&) __attribute__((regparm(3))); void __stdcall interrupt_setup (int sig, void *handler, diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index 6faddf37b..121b5a4a9 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -99,6 +99,9 @@ readdir_worker (DIR *dir, dirent *de) } if (!res) +#if 1 + de->d_ino = 0; +#else { /* Compute d_ino by combining filename hash with the directory hash (which was stored in dir->__d_dirhash when opendir was called). */ @@ -136,6 +139,7 @@ readdir_worker (DIR *dir, dirent *de) } de->__ino32 = de->d_ino; // for legacy applications } +#endif return res; } diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 66f111ef8..2307eb5a9 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -569,8 +569,9 @@ _cygtls::handle_exceptions (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT si.si_addr = (void *) in->Eip; si.si_errno = si.si_pid = si.si_uid = 0; - me.push ((__stack_t) ebp, true); + me.incyg++; sig_send (NULL, si, &me); // Signal myself + me.incyg--; e->ExceptionFlags = 0; return 0; } @@ -683,7 +684,7 @@ interruptible (DWORD pc) void __stdcall _cygtls::interrupt_setup (int sig, void *handler, struct sigaction& siga) { - push ((__stack_t) sigdelayed, false); + push ((__stack_t) sigdelayed); deltamask = (siga.sa_mask | SIGTOMASK (sig)) & ~SIG_NONMASKABLE; sa_flags = siga.sa_flags; func = (void (*) (int)) handler; @@ -707,7 +708,7 @@ bool _cygtls::interrupt_now (CONTEXT *ctx, int sig, void *handler, struct sigaction& siga) { - push ((__stack_t) ctx->Eip, false); + push ((__stack_t) ctx->Eip); interrupt_setup (sig, handler, siga); ctx->Eip = pop (); SetThreadContext (*this, ctx); /* Restart the thread in a new location */ @@ -740,11 +741,10 @@ setup_handler (int sig, void *handler, struct sigaction& siga, _cygtls *tls) for (int i = 0; i < CALL_HANDLER_RETRY; i++) { tls->lock (); - if (tls->incyg || tls->in_exception ()) + if (tls->incyg) { - sigproc_printf ("controlled interrupt. incyg %d, exception %d, stackptr %p, stack %p, stackptr[-1] %p", - tls->incyg, tls->in_exception (), tls->stackptr, tls->stack, tls->stackptr[-1]); - tls->reset_exception (); + sigproc_printf ("controlled interrupt. stackptr %p, stack %p, stackptr[-1] %p", + tls->stackptr, tls->stack, tls->stackptr[-1]); tls->interrupt_setup (sig, handler, siga); interrupted = true; tls->unlock (); @@ -779,9 +779,9 @@ setup_handler (int sig, void *handler, struct sigaction& siga, _cygtls *tls) ResumeThread (hth); break; } - if (tls->incyg || tls->in_exception () || tls->spinning || tls->locked ()) - sigproc_printf ("incyg %d, in_exception %d, spinning %d, locked %d\n", - tls->incyg, tls->in_exception (), tls->spinning, tls->locked ()); + if (tls->incyg || tls->spinning || tls->locked ()) + sigproc_printf ("incyg %d, spinning %d, locked %d\n", + tls->incyg, tls->spinning, tls->locked ()); else { cx.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER; @@ -1052,7 +1052,7 @@ sigpacket::process () handler = (void *) thissig.sa_handler; else if (tls) return 1; - else + else handler = NULL; if (si.si_signo == SIGKILL) diff --git a/winsup/cygwin/gendef b/winsup/cygwin/gendef index a12b024d3..727d4bb5d 100755 --- a/winsup/cygwin/gendef +++ b/winsup/cygwin/gendef @@ -386,6 +386,8 @@ _longjmp: movl 44(%edi),%eax # get old signal stack movl %eax,$tls::stackptr(%ebx) # restore decl $tls::stacklock(%ebx) # relinquish lock + xorl %eax,%eax + movl %eax,$tls::incyg(%ebx) # we're definitely not in cygwin anymore movl 12(%ebp),%eax testl %eax,%eax diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index cec1599c9..dc150fbe0 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -326,7 +326,7 @@ struct mmap_func_t BOOL (*VirtualProtEx)(HANDLE, PVOID, SIZE_T, DWORD, PDWORD); }; -mmap_func_t mmap_funcs_9x = +mmap_func_t mmap_funcs_9x = { CreateMapping9x, MapView9x, @@ -334,7 +334,7 @@ mmap_func_t mmap_funcs_9x = VirtualProtEx9x }; -mmap_func_t mmap_funcs_nt = +mmap_func_t mmap_funcs_nt = { CreateMappingNT, MapViewNT, @@ -424,7 +424,7 @@ class mmap_record fhandler_base *alloc_fh (); void free_fh (fhandler_base *fh); - + DWORD gen_protect (bool create = false) const { return ::gen_protect (get_prot (), get_flags (), create); } DWORD gen_access () const @@ -1138,7 +1138,7 @@ mprotect (void *addr, size_t len, int prot) bool ret = false; SetResourceLock (LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "mprotect"); - + /* Iterate through the map, protect pages between addr and addr+len in all maps. */ list *map_list; @@ -1252,7 +1252,7 @@ mlock (const void *addr, size_t len) requested locking region fits in. Unfortunately I don't know any function which would return the currently locked pages of a process (no go with NtQueryVirtualMemory). - + So, except for the border cases, what we do here is something really embarrassing. We raise the working set by 64K at a time and retry, until either we fail to raise the working set size @@ -1715,7 +1715,7 @@ fixup_mmaps_after_fork (HANDLE parent) && (mbi.Protect == PAGE_READWRITE || mbi.Protect == PAGE_EXECUTE_READWRITE)) { - /* A PAGE_WRITECOPY page which has been written to is + /* A PAGE_WRITECOPY page which has been written to is set to PAGE_READWRITE, but that's an incompatible protection to set the page to. */ mbi.Protect &= ~PAGE_READWRITE; diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 456da37e2..655cb1105 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -693,7 +693,7 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval, The workaround is described in KB article 248611. Add a new registry DWORD value HKLM/System/CurrentControlSet/Services/... ... Tcpip/Parameters/DisableUserTOSSetting, set to 0, and reboot. - + FIXME: Maybe we should simply fake that IP_TOS could be set successfully, if DisableUserTOSSetting is not set to 0 on W2K and above? */ -- 2.43.5