Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2011-12-13 08:11:48 +0400
committerChristopher Faylor <me@cgf.cx>2011-12-13 08:11:48 +0400
commit8cb58e85662d1a0c3288020780ce2389850dc465 (patch)
tree50aab7377010623e33643cd83deb564e747a5de7
parenta7ea1550ff7a0a1dde12676fdcf25bf05937ca72 (diff)
* cygthread.h (cygthread::name): Very minor formatting tweak.
* exceptions.cc (_cygtls::call_signal_handler): Add paranoid debugging output. * sigproc.h (cygwait): Call signal handler when signal is detected and loop as appropriate. * fhandler.h (fhandler_base_overlapped::wait_return): Remove overlapped_signal. * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Remove restartable signal accommodations in light of cygwait improvements. (fhandler_base_overlapped::raw_read): Remove now-obsolete signal loop behavior. (fhandler_base_overlapped::raw_write): Ditto. * fhandler_console.cc (fhandler_console::read): Ditto. * fhandler_serial.cc (fhandler_serial::raw_read): Ditto. (fhandler_serial::raw_write): Ditto. * fhandler_tty.cc (fhandler_pty_slave::read): Ditto. * ioctl.cc (ioctl): Add standard syscall introducer and leaver debug output.
-rw-r--r--winsup/cygwin/ChangeLog24
-rw-r--r--winsup/cygwin/cygthread.h2
-rw-r--r--winsup/cygwin/exceptions.cc1
-rw-r--r--winsup/cygwin/fhandler.cc18
-rw-r--r--winsup/cygwin/fhandler.h1
-rw-r--r--winsup/cygwin/fhandler_console.cc3
-rw-r--r--winsup/cygwin/fhandler_serial.cc6
-rw-r--r--winsup/cygwin/fhandler_tty.cc4
-rw-r--r--winsup/cygwin/ioctl.cc4
-rw-r--r--winsup/cygwin/sigproc.h19
10 files changed, 46 insertions, 36 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 25ee248aa..9b3cb0276 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,27 @@
+2011-12-12 Christopher Faylor <me.cygwin2011@cgf.cx>
+
+ * cygthread.h (cygthread::name): Very minor formatting tweak.
+
+ * exceptions.cc (_cygtls::call_signal_handler): Add paranoid debugging
+ output.
+
+ * sigproc.h (cygwait): Call signal handler when signal is detected and
+ loop as appropriate.
+ * fhandler.h (fhandler_base_overlapped::wait_return): Remove
+ overlapped_signal.
+ * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Remove
+ restartable signal accommodations in light of cygwait improvements.
+ (fhandler_base_overlapped::raw_read): Remove now-obsolete signal loop
+ behavior.
+ (fhandler_base_overlapped::raw_write): Ditto.
+ * fhandler_console.cc (fhandler_console::read): Ditto.
+ * fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
+ (fhandler_serial::raw_write): Ditto.
+ * fhandler_tty.cc (fhandler_pty_slave::read): Ditto.
+
+ * ioctl.cc (ioctl): Add standard syscall introducer and leaver debug
+ output.
+
2011-12-12 Corinna Vinschen <vinschen@redhat.com>
* fhandler_process.cc (dos_drive_mappings): Partially rewrite to
diff --git a/winsup/cygwin/cygthread.h b/winsup/cygwin/cygthread.h
index a15889add..642604dc8 100644
--- a/winsup/cygwin/cygthread.h
+++ b/winsup/cygwin/cygthread.h
@@ -38,7 +38,7 @@ class cygthread
static DWORD WINAPI stub (VOID *);
static DWORD WINAPI simplestub (VOID *);
static DWORD main_thread_id;
- static const char * name (DWORD = 0);
+ static const char *name (DWORD = 0);
void callfunc (bool) __attribute__ ((noinline, regparm (2)));
void auto_release () {func = NULL;}
void release (bool);
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 351532a5e..97f04b2ec 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1330,6 +1330,7 @@ _cygtls::call_signal_handler ()
_main_tls->lock ();
if (_main_tls->sig)
{
+ paranoid_printf ("Redirecting to main_tls signal %d", _main_tls->sig);
sig = _main_tls->sig;
sa_flags = _main_tls->sa_flags;
func = _main_tls->func;
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 48e114f28..c6388cc64 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -1942,14 +1942,9 @@ fhandler_base_overlapped::wait_overlapped (bool inres, bool writing, DWORD *byte
res = overlapped_success; /* operation succeeded */
else if (wfres == WAIT_OBJECT_0 + 1)
{
- if (_my_tls.call_signal_handler ())
- res = overlapped_signal;
- else
- {
- err = ERROR_INVALID_AT_INTERRUPT_TIME; /* forces an EINTR below */
- debug_printf ("unhandled signal");
- res = overlapped_error;
- }
+ err = ERROR_INVALID_AT_INTERRUPT_TIME; /* forces an EINTR below */
+ debug_printf ("unhandled signal");
+ res = overlapped_error;
}
else if (nonblocking)
res = overlapped_nonblocking_no_data; /* more handling below */
@@ -1964,8 +1959,6 @@ fhandler_base_overlapped::wait_overlapped (bool inres, bool writing, DWORD *byte
if (res == overlapped_success)
debug_printf ("normal %s, %u bytes", writing ? "write" : "read", *bytes);
- else if (res == overlapped_signal)
- debug_printf ("handled signal");
else if (res == overlapped_nonblocking_no_data)
{
*bytes = (DWORD) -1;
@@ -2003,9 +1996,6 @@ fhandler_base_overlapped::raw_read (void *ptr, size_t& len)
get_overlapped ());
switch (wait_overlapped (res, false, &nbytes, is_nonblocking ()))
{
- case overlapped_signal:
- keep_looping = true;
- break;
default: /* Added to quiet gcc */
case overlapped_success:
case overlapped_error:
@@ -2059,8 +2049,6 @@ fhandler_base_overlapped::raw_write (const void *ptr, size_t len)
ptr = ((char *) ptr) + chunk;
nbytes += nbytes_now;
/* fall through intentionally */
- case overlapped_signal:
- break; /* keep looping */
case overlapped_error:
len = 0; /* terminate loop */
case overlapped_unknown:
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index a6e183456..b1324c563 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -620,7 +620,6 @@ protected:
{
overlapped_unknown = 0,
overlapped_success,
- overlapped_signal,
overlapped_nonblocking_no_data,
overlapped_error
};
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index e04e0aad1..6347bd518 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -347,14 +347,11 @@ fhandler_console::read (void *pv, size_t& buflen)
}
set_cursor_maybe (); /* to make cursor appear on the screen immediately */
-restart:
switch (cygwait (h, timeout))
{
case WAIT_OBJECT_0:
break;
case WAIT_OBJECT_0 + 1:
- if (_my_tls.call_signal_handler ())
- goto restart;
goto sig_exit;
case WAIT_OBJECT_0 + 2:
process_state.pop ();
diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc
index 4c33d5e83..5a53a11fd 100644
--- a/winsup/cygwin/fhandler_serial.cc
+++ b/winsup/cygwin/fhandler_serial.cc
@@ -95,7 +95,6 @@ fhandler_serial::raw_read (void *ptr, size_t& ulen)
else
{
overlapped_armed = 1;
-restart:
switch (cygwait (io_status.hEvent))
{
case WAIT_OBJECT_0:
@@ -105,8 +104,6 @@ restart:
debug_printf ("n %d, ev %x", n, ev);
break;
case WAIT_OBJECT_0 + 1:
- if (_my_tls.call_signal_handler ())
- goto restart;
tot = -1;
PurgeComm (get_handle (), PURGE_RXABORT);
overlapped_armed = 0;
@@ -202,14 +199,11 @@ fhandler_serial::raw_write (const void *ptr, size_t len)
if (!is_nonblocking ())
{
- restart:
switch (cygwait (write_status.hEvent))
{
case WAIT_OBJECT_0:
break;
case WAIT_OBJECT_0 + 1:
- if (_my_tls.call_signal_handler ())
- goto restart;
PurgeComm (get_handle (), PURGE_TXABORT);
set_sig_errno (EINTR);
ForceCloseHandle (write_status.hEvent);
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index d8927cf9d..61fb8613d 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -717,8 +717,6 @@ fhandler_pty_slave::read (void *ptr, size_t& len)
case WAIT_OBJECT_0 + 1:
if (totalread > 0)
goto out;
- if (_my_tls.call_signal_handler ())
- continue;
termios_printf ("wait catched signal");
set_sig_errno (EINTR);
totalread = -1;
@@ -754,8 +752,6 @@ fhandler_pty_slave::read (void *ptr, size_t& len)
case WAIT_OBJECT_0 + 1:
if (totalread > 0)
goto out;
- if (_my_tls.call_signal_handler ())
- continue;
termios_printf ("wait for mutex catched signal");
set_sig_errno (EINTR);
totalread = -1;
diff --git a/winsup/cygwin/ioctl.cc b/winsup/cygwin/ioctl.cc
index 25f18af29..fa02db4d4 100644
--- a/winsup/cygwin/ioctl.cc
+++ b/winsup/cygwin/ioctl.cc
@@ -33,7 +33,7 @@ ioctl (int fd, int cmd, ...)
char *argp = va_arg (ap, char *);
va_end (ap);
- debug_printf ("fd %d, cmd %x", fd, cmd);
+ debug_printf ("ioctl(fd %d, cmd %p)", fd, cmd);
int res;
/* FIXME: This stinks. There are collisions between cmd types
depending on whether fd is associated with a pty master or not.
@@ -58,6 +58,6 @@ ioctl (int fd, int cmd, ...)
res = cfd->ioctl (cmd, argp);
out:
- debug_printf ("returning %d", res);
+ syscall_printf ("%R = ioctl(%d, %p, ...)", res, fd, cmd);
return res;
}
diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h
index 72427a4c2..0cfac8699 100644
--- a/winsup/cygwin/sigproc.h
+++ b/winsup/cygwin/sigproc.h
@@ -85,13 +85,24 @@ static inline DWORD __attribute__ ((always_inline))
cygwait (HANDLE h, DWORD howlong = INFINITE)
{
HANDLE w4[3];
- int n = 0;
- if ((w4[n] = h) != NULL)
- n++;
+ DWORD n = 0;
+ DWORD wait_signal;
+ if ((w4[n] = h) == NULL)
+ wait_signal = WAIT_OBJECT_0 + 15; /* Arbitrary. Don't call signal
+ handler if only waiting for signal */
+ else
+ {
+ n++;
+ wait_signal = n;
+ }
w4[n++] = signal_arrived;
if ((w4[n] = pthread::get_cancel_event ()) != NULL)
n++;
- return WaitForMultipleObjects (n, w4, FALSE, howlong);
+ DWORD res;
+ while ((res = WaitForMultipleObjects (n, w4, FALSE, howlong)) == wait_signal
+ && _my_tls.call_signal_handler ())
+ continue;
+ return res;
}
static inline DWORD __attribute__ ((always_inline))