aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-11-22 20:51:13 +0000
committerChristopher Faylor <me@cgf.cx>2002-11-22 20:51:13 +0000
commita0d3c309e4e9ea6aab9b058c2e3c68b8deff9c71 (patch)
treea83399354edc1487e7b6663be693d146869d5c0c
parent2955fd7669437cb13d2b228b5f1b6c1dda58fa34 (diff)
downloadnewlib-a0d3c309e4e9ea6aab9b058c2e3c68b8deff9c71.zip
newlib-a0d3c309e4e9ea6aab9b058c2e3c68b8deff9c71.tar.gz
newlib-a0d3c309e4e9ea6aab9b058c2e3c68b8deff9c71.tar.bz2
* exceptions.cc (handle_sigsuspend): Force pending signal delivery before
waiting for signals to happen. * signal.cc (sleep): Force pending signal delivery before sleeping. (usleep): Ditto. (signal): Force pending signal delivery before manipulating signal stuff. (sigprocmask): Ditto. (kill_worker): Ditto. (abort): Ditto. (sigaction): Ditto. * syscalls.cc (readv): Force pending signal delivery before I/O. (writev): Ditto. (open): Ditto. * net.cc: Ditto, throughout. * sigproc.cc (sig_dispatch_pending): Deliver any pending signals prior to returning. * tty.cc (tty::make_pipes): Increase pipe buffer size.
-rw-r--r--winsup/cygwin/ChangeLog21
-rw-r--r--winsup/cygwin/exceptions.cc1
-rw-r--r--winsup/cygwin/net.cc22
-rw-r--r--winsup/cygwin/signal.cc8
-rw-r--r--winsup/cygwin/sigproc.cc9
-rw-r--r--winsup/cygwin/syscalls.cc3
-rw-r--r--winsup/cygwin/tty.cc4
7 files changed, 66 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 35ae60b..1a46ad8 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,26 @@
2002-11-22 Christopher Faylor <cgf@redhat.com>
+ * exceptions.cc (handle_sigsuspend): Force pending signal delivery
+ before waiting for signals to happen.
+ * signal.cc (sleep): Force pending signal delivery before sleeping.
+ (usleep): Ditto.
+ (signal): Force pending signal delivery before manipulating signal
+ stuff.
+ (sigprocmask): Ditto.
+ (kill_worker): Ditto.
+ (abort): Ditto.
+ (sigaction): Ditto.
+ * syscalls.cc (readv): Force pending signal delivery before I/O.
+ (writev): Ditto.
+ (open): Ditto.
+ * net.cc: Ditto, throughout.
+ * sigproc.cc (sig_dispatch_pending): Deliver any pending signals prior
+ to returning.
+
+ * tty.cc (tty::make_pipes): Increase pipe buffer size.
+
+2002-11-22 Christopher Faylor <cgf@redhat.com>
+
* include/cygwin/version.h: Fix comment.
2002-11-21 Igor Pechtchanski <pechtcha@cs.nyu.edu>
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index b18c61f..380697e 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -568,6 +568,7 @@ stack (void)
int __stdcall
handle_sigsuspend (sigset_t tempmask)
{
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
sigset_t oldmask = myself->getsigmask (); // Remember for restoration
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 91c3c1f..a02d45f 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -576,6 +576,7 @@ cygwin_sendto (int fd, const void *buf, int len, int flags,
const struct sockaddr *to, int tolen)
{
int res;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
fhandler_socket *fh = get (fd);
@@ -599,6 +600,7 @@ cygwin_recvfrom (int fd, void *buf, int len, int flags,
struct sockaddr *from, int *fromlen)
{
int res;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
fhandler_socket *fh = get (fd);
@@ -755,6 +757,7 @@ extern "C" int
cygwin_connect (int fd, const struct sockaddr *name, int namelen)
{
int res;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
fhandler_socket *fh = get (fd);
@@ -843,6 +846,7 @@ static struct servent *servent_buf = NULL;
extern "C" struct servent *
cygwin_getservbyname (const char *name, const char *proto)
{
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
if (check_null_str_errno (name)
|| (proto != NULL && check_null_str_errno (proto)))
@@ -861,6 +865,7 @@ cygwin_getservbyname (const char *name, const char *proto)
extern "C" struct servent *
cygwin_getservbyport (int port, const char *proto)
{
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
if (proto != NULL && check_null_str_errno (proto))
return NULL;
@@ -879,6 +884,7 @@ cygwin_gethostname (char *name, size_t len)
{
int PASCAL win32_gethostname (char *, int);
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
if (__check_null_invalid_struct_errno (name, len))
return -1;
@@ -961,6 +967,7 @@ cygwin_gethostbyname (const char *name)
static char *tmp_addr_list[2];
static int a, b, c, d;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
if (check_null_str_errno (name))
return NULL;
@@ -1001,6 +1008,7 @@ cygwin_gethostbyname (const char *name)
extern "C" struct hostent *
cygwin_gethostbyaddr (const char *addr, int len, int type)
{
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
if (__check_invalid_read_ptr_errno (addr, len))
return NULL;
@@ -1025,6 +1033,7 @@ extern "C" int
cygwin_accept (int fd, struct sockaddr *peer, int *len)
{
int res;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
fhandler_socket *fh = get (fd);
@@ -1045,6 +1054,7 @@ extern "C" int
cygwin_bind (int fd, const struct sockaddr *my_addr, int addrlen)
{
int res;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
fhandler_socket *fh = get (fd);
@@ -1062,6 +1072,7 @@ extern "C" int
cygwin_getsockname (int fd, struct sockaddr *addr, int *namelen)
{
int res;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
fhandler_socket *fh = get (fd);
@@ -1082,6 +1093,7 @@ extern "C" int
cygwin_listen (int fd, int backlog)
{
int res;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
fhandler_socket *fh = get (fd);
@@ -1099,6 +1111,7 @@ extern "C" int
cygwin_shutdown (int fd, int how)
{
int res;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
fhandler_socket *fh = get (fd);
@@ -1164,6 +1177,7 @@ extern "C" int
cygwin_getpeername (int fd, struct sockaddr *name, int *len)
{
int res;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
fhandler_socket *fh = get (fd);
@@ -1204,6 +1218,7 @@ getdomainname (char *domain, size_t len)
* in use and include paths for the Domain name in each ?
* Punt for now and assume MS-TCP on Win95.
*/
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
if (__check_null_invalid_struct_errno (domain, len))
return -1;
@@ -1798,6 +1813,7 @@ get_ifconf (struct ifconf *ifc, int what)
unsigned long lip, lnp;
struct sockaddr_in *sa;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
if (check_null_invalid_struct_errno (ifc))
return -1;
@@ -1875,6 +1891,7 @@ cygwin_rcmd (char **ahost, unsigned short inport, char *locuser,
{
int res = -1;
SOCKET fd2s;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
if (check_null_invalid_struct_errno (ahost) ||
@@ -1919,6 +1936,7 @@ extern "C" int
cygwin_rresvport (int *port)
{
int res;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
if (check_null_invalid_struct_errno (port))
@@ -1950,6 +1968,7 @@ cygwin_rexec (char **ahost, unsigned short inport, char *locuser,
{
int res = -1;
SOCKET fd2s;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
if (check_null_invalid_struct_errno (ahost) ||
@@ -1998,6 +2017,7 @@ socketpair (int family, int type, int protocol, int *sb)
cygheap_fdnew sb0;
fhandler_socket *fh;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
if (__check_null_invalid_struct_errno (sb, 2 * sizeof (int)))
return -1;
@@ -2197,6 +2217,7 @@ extern "C" int
cygwin_recvmsg (int fd, struct msghdr *msg, int flags)
{
int res;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
fhandler_socket *fh = get (fd);
@@ -2223,6 +2244,7 @@ extern "C" int
cygwin_sendmsg (int fd, const struct msghdr *msg, int flags)
{
int res;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
fhandler_socket *fh = get (fd);
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index 010df9b..a23487f 100644
--- a/winsup/cygwin/signal.cc
+++ b/winsup/cygwin/signal.cc
@@ -43,6 +43,7 @@ set_sigcatchers (void (*oldsig) (int), void (*cursig) (int))
extern "C" _sig_func_ptr
signal (int sig, _sig_func_ptr func)
{
+ sig_dispatch_pending (0);
_sig_func_ptr prev;
/* check that sig is in right range */
@@ -69,6 +70,7 @@ extern "C" unsigned int
sleep (unsigned int seconds)
{
int rc;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
DWORD ms, start_time, end_time;
@@ -95,6 +97,7 @@ sleep (unsigned int seconds)
extern "C" unsigned int
usleep (unsigned int useconds)
{
+ sig_dispatch_pending (0);
syscall_printf ("usleep (%d)", useconds);
WaitForSingleObject (signal_arrived, (useconds + 500) / 1000);
syscall_printf ("0 = usleep (%d)", useconds);
@@ -104,6 +107,7 @@ usleep (unsigned int useconds)
extern "C" int
sigprocmask (int sig, const sigset_t *set, sigset_t *oldset)
{
+ sig_dispatch_pending (0);
/* check that sig is in right range */
if (sig < 0 || sig >= NSIG)
{
@@ -143,6 +147,8 @@ sigprocmask (int sig, const sigset_t *set, sigset_t *oldset)
static int
kill_worker (pid_t pid, int sig)
{
+ sig_dispatch_pending (0);
+
int res = 0;
pinfo dest (pid);
BOOL sendSIGCONT;
@@ -261,6 +267,7 @@ killpg (pid_t pgrp, int sig)
extern "C" void
abort (void)
{
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
/* Flush all streams as per SUSv2.
From my reading of this document, this isn't strictly correct.
@@ -286,6 +293,7 @@ abort (void)
extern "C" int
sigaction (int sig, const struct sigaction *newact, struct sigaction *oldact)
{
+ sig_dispatch_pending (0);
sigproc_printf ("signal %d, newact %p, oldact %p", sig, newact, oldact);
/* check that sig is in right range */
if (sig < 0 || sig >= NSIG)
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index aeb51f2..862093c 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -516,6 +516,12 @@ sig_dispatch_pending (int justwake)
{
if (!hwait_sig)
return 0;
+ DWORD tid = GetCurrentThreadId ();
+
+ sigframe thisframe (mainthread);
+
+ if (tid == sigtid && !justwake)
+ justwake = 1;
int was_pending = pending_signals;
#ifdef DEBUGGING
@@ -544,6 +550,9 @@ sig_dispatch_pending (int justwake)
system_printf ("%E releasing sigcatch_nosync(%p)", sigcatch_nosync);
}
+ if (was_pending && !justwake)
+ thisframe.call_signal_handler ();
+
return was_pending;
}
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 94c4b08..edfa3ed 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -384,6 +384,7 @@ readv (int fd, const struct iovec *const iov, const int iovcnt)
while (1)
{
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
cygheap_fdget cfd (fd);
@@ -455,6 +456,7 @@ extern "C" ssize_t
writev (const int fd, const struct iovec *const iov, const int iovcnt)
{
int res = -1;
+ sig_dispatch_pending (0);
const ssize_t tot = check_iovec_for_write (iov, iovcnt);
sigframe thisframe (mainthread);
@@ -510,6 +512,7 @@ open (const char *unix_path, int flags, ...)
int res = -1;
va_list ap;
mode_t mode = 0;
+ sig_dispatch_pending (0);
sigframe thisframe (mainthread);
syscall_printf ("open (%s, %p)", unix_path, flags);
diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc
index efa0557..448dfda 100644
--- a/winsup/cygwin/tty.cc
+++ b/winsup/cygwin/tty.cc
@@ -358,7 +358,7 @@ tty::make_pipes (fhandler_pty_master *ptym)
/* Create communication pipes */
/* FIXME: should this be sec_none_nih? */
- if (CreatePipe (&from_master, &to_slave, &sec_all, 64 * 1024) == FALSE)
+ if (CreatePipe (&from_master, &to_slave, &sec_all, 128 * 1024) == FALSE)
{
termios_printf ("can't create input pipe");
set_errno (ENOENT);
@@ -366,7 +366,7 @@ tty::make_pipes (fhandler_pty_master *ptym)
}
// ProtectHandle1INH (to_slave, to_pty);
- if (CreatePipe (&from_slave, &to_master, &sec_all, 64 * 1024) == FALSE)
+ if (CreatePipe (&from_slave, &to_master, &sec_all, 128 * 1024) == FALSE)
{
termios_printf ("can't create output pipe");
set_errno (ENOENT);