diff options
author | Christopher Faylor <me@cgf.cx> | 2000-11-02 02:15:02 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-11-02 02:15:02 +0000 |
commit | e2fa502354e32466425ae03ebf2aa269835f2956 (patch) | |
tree | 3599d065f6c7fa7b9a3ed87d6794c55cb1c7de65 /winsup | |
parent | 69f9407faa093d08788c25d6a2190d0054dc31c3 (diff) | |
download | newlib-e2fa502354e32466425ae03ebf2aa269835f2956.zip newlib-e2fa502354e32466425ae03ebf2aa269835f2956.tar.gz newlib-e2fa502354e32466425ae03ebf2aa269835f2956.tar.bz2 |
* exceptions.cc (interruptible): Remove obsolete tests.
(sigreturn): Construct pseudo-frame-pointer so that signal handler can figure
out where to put return address when signals are coming in quickly.
* path.cc (cwdstuff::get): Allow length 0 buffer length when buffer when NULL.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 9 | ||||
-rw-r--r-- | winsup/cygwin/exceptions.cc | 66 | ||||
-rw-r--r-- | winsup/cygwin/path.cc | 6 |
3 files changed, 46 insertions, 35 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index dd1e1aa..0d4ef61 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +Wed Nov 1 21:08:23 2000 Christopher Faylor <cgf@cygnus.com> + + * exceptions.cc (interruptible): Remove obsolete tests. + (sigreturn): Construct pseudo-frame-pointer so that signal handler can + figure out where to put return address when signals are coming in + quickly. + * path.cc (cwdstuff::get): Allow length 0 buffer length when buffer + when NULL. + Tue Oct 31 18:12:56 2000 Christopher Faylor <cgf@cygnus.com> * path.h (has_exec_chars): Standard function for checking for diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index d9ce5b5..88b1957 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -30,7 +30,6 @@ static int handle_exceptions (EXCEPTION_RECORD *, void *, CONTEXT *, void *); extern void sigreturn (); extern void sigdelayed (); extern void siglast (); -extern DWORD __sigfirst, __siglast; }; extern DWORD sigtid; @@ -580,37 +579,34 @@ int interruptible (DWORD pc, int testvalid = 0) { int res; - if ((pc >= (DWORD) &__sigfirst) && (pc <= (DWORD) &__siglast)) + MEMORY_BASIC_INFORMATION m; + + memset (&m, 0, sizeof m); + if (!VirtualQuery ((LPCVOID) pc, &m, sizeof m)) + sigproc_printf ("couldn't get memory info, pc %p, %E", pc); + + char *checkdir = (char *) alloca (windows_system_directory_length + 4); + memset (checkdir, 0, sizeof (checkdir)); + +# define h ((HMODULE) m.AllocationBase) + /* Apparently Windows 95 can sometimes return bogus addresses from + GetThreadContext. These resolve to an allocation base == 0. + These should *never* be treated as interruptible. */ + if (!h || m.State != MEM_COMMIT) + res = 0; + else if (testvalid) + res = 1; /* All we wanted to know was if this was a valid module. */ + else if (h == user_data->hmodule) + res = 1; + else if (h == cygwin_hmodule) + res = 0; + else if (!GetModuleFileName (h, checkdir, windows_system_directory_length + 2)) res = 0; else - { - MEMORY_BASIC_INFORMATION m; - memset (&m, 0, sizeof m); - if (!VirtualQuery ((LPCVOID) pc, &m, sizeof m)) - sigproc_printf ("couldn't get memory info, pc %p, %E", pc); - - char *checkdir = (char *) alloca (windows_system_directory_length + 4); - memset (checkdir, 0, sizeof (checkdir)); -# define h ((HMODULE) m.AllocationBase) - /* Apparently Windows 95 can sometimes return bogus addresses from - GetThreadContext. These resolve to an allocation base == 0. - These should *never* be treated as interruptible. */ - if (!h || m.State != MEM_COMMIT) - res = 0; - else if (testvalid) - res = 1; /* All we wanted to know was if this was a valid module. */ - else if (h == user_data->hmodule) - res = 1; - else if (h == cygwin_hmodule) - res = 0; - else if (!GetModuleFileName (h, checkdir, windows_system_directory_length + 2)) - res = 0; - else - res = !strncasematch (windows_system_directory, checkdir, - windows_system_directory_length); - minimal_printf ("h %p", h); -# undef h - } + res = !strncasematch (windows_system_directory, checkdir, + windows_system_directory_length); + minimal_printf ("h %p", h); +# undef h minimal_printf ("interruptible %d", res); return res; @@ -1040,6 +1036,7 @@ signal_exit (int rc) if (hExeced) TerminateProcess (hExeced, rc); + sigproc_printf ("about to call do_exit (%x)", rc); do_exit (rc); } @@ -1082,8 +1079,7 @@ events_terminate (void) #define pid_offset (unsigned)(((_pinfo *)NULL)->pid) extern "C" { -static void __stdcall -reset_signal_arrived () __attribute__ ((unused)); +static void __stdcall reset_signal_arrived () __attribute__ ((unused)); static void __stdcall reset_signal_arrived () { @@ -1102,6 +1098,8 @@ __asm__ volatile (" _sigreturn: addl $4,%%esp + movl %%esp,%%ebp + addl $36,%%ebp call _set_process_mask@4 popl %%eax # saved errno testl %%eax,%%eax # Is it < 0 @@ -1114,12 +1112,14 @@ _sigreturn: popl %%edx popl %%edi popl %%esi + popl %%ebp popf ret _sigdelayed: pushl %2 # original return address pushf + pushl %%ebp pushl %%esi pushl %%edi pushl %%edx @@ -1136,10 +1136,8 @@ _sigdelayed: cmpl $0,_pending_signals je 2f -___sigfirst: pushl $0 call _sig_dispatch_pending@4 -___siglast: 2: jmp *%5 diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 9303219..8e7d586 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -2899,7 +2899,11 @@ cwdstuff::get (char *buf, int need_posix, int with_chroot, unsigned ulen) { MALLOC_CHECK; - if (ulen == 0) + if (ulen) + /* nothing */; + else if (buf == NULL) + ulen = (unsigned) -1; + else { set_errno (EINVAL); goto out; |