mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-27 19:17:18 +08:00
* 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.
This commit is contained in:
parent
2955fd7669
commit
a0d3c309e4
@ -1,3 +1,24 @@
|
|||||||
|
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>
|
2002-11-22 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* include/cygwin/version.h: Fix comment.
|
* include/cygwin/version.h: Fix comment.
|
||||||
|
@ -568,6 +568,7 @@ stack (void)
|
|||||||
int __stdcall
|
int __stdcall
|
||||||
handle_sigsuspend (sigset_t tempmask)
|
handle_sigsuspend (sigset_t tempmask)
|
||||||
{
|
{
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
sigset_t oldmask = myself->getsigmask (); // Remember for restoration
|
sigset_t oldmask = myself->getsigmask (); // Remember for restoration
|
||||||
|
|
||||||
|
@ -576,6 +576,7 @@ cygwin_sendto (int fd, const void *buf, int len, int flags,
|
|||||||
const struct sockaddr *to, int tolen)
|
const struct sockaddr *to, int tolen)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
fhandler_socket *fh = get (fd);
|
fhandler_socket *fh = get (fd);
|
||||||
@ -599,6 +600,7 @@ cygwin_recvfrom (int fd, void *buf, int len, int flags,
|
|||||||
struct sockaddr *from, int *fromlen)
|
struct sockaddr *from, int *fromlen)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
fhandler_socket *fh = get (fd);
|
fhandler_socket *fh = get (fd);
|
||||||
@ -755,6 +757,7 @@ extern "C" int
|
|||||||
cygwin_connect (int fd, const struct sockaddr *name, int namelen)
|
cygwin_connect (int fd, const struct sockaddr *name, int namelen)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
fhandler_socket *fh = get (fd);
|
fhandler_socket *fh = get (fd);
|
||||||
@ -843,6 +846,7 @@ static struct servent *servent_buf = NULL;
|
|||||||
extern "C" struct servent *
|
extern "C" struct servent *
|
||||||
cygwin_getservbyname (const char *name, const char *proto)
|
cygwin_getservbyname (const char *name, const char *proto)
|
||||||
{
|
{
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
if (check_null_str_errno (name)
|
if (check_null_str_errno (name)
|
||||||
|| (proto != NULL && check_null_str_errno (proto)))
|
|| (proto != NULL && check_null_str_errno (proto)))
|
||||||
@ -861,6 +865,7 @@ cygwin_getservbyname (const char *name, const char *proto)
|
|||||||
extern "C" struct servent *
|
extern "C" struct servent *
|
||||||
cygwin_getservbyport (int port, const char *proto)
|
cygwin_getservbyport (int port, const char *proto)
|
||||||
{
|
{
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
if (proto != NULL && check_null_str_errno (proto))
|
if (proto != NULL && check_null_str_errno (proto))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -879,6 +884,7 @@ cygwin_gethostname (char *name, size_t len)
|
|||||||
{
|
{
|
||||||
int PASCAL win32_gethostname (char *, int);
|
int PASCAL win32_gethostname (char *, int);
|
||||||
|
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
if (__check_null_invalid_struct_errno (name, len))
|
if (__check_null_invalid_struct_errno (name, len))
|
||||||
return -1;
|
return -1;
|
||||||
@ -961,6 +967,7 @@ cygwin_gethostbyname (const char *name)
|
|||||||
static char *tmp_addr_list[2];
|
static char *tmp_addr_list[2];
|
||||||
static int a, b, c, d;
|
static int a, b, c, d;
|
||||||
|
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
if (check_null_str_errno (name))
|
if (check_null_str_errno (name))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1001,6 +1008,7 @@ cygwin_gethostbyname (const char *name)
|
|||||||
extern "C" struct hostent *
|
extern "C" struct hostent *
|
||||||
cygwin_gethostbyaddr (const char *addr, int len, int type)
|
cygwin_gethostbyaddr (const char *addr, int len, int type)
|
||||||
{
|
{
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
if (__check_invalid_read_ptr_errno (addr, len))
|
if (__check_invalid_read_ptr_errno (addr, len))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1025,6 +1033,7 @@ extern "C" int
|
|||||||
cygwin_accept (int fd, struct sockaddr *peer, int *len)
|
cygwin_accept (int fd, struct sockaddr *peer, int *len)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
fhandler_socket *fh = get (fd);
|
fhandler_socket *fh = get (fd);
|
||||||
@ -1045,6 +1054,7 @@ extern "C" int
|
|||||||
cygwin_bind (int fd, const struct sockaddr *my_addr, int addrlen)
|
cygwin_bind (int fd, const struct sockaddr *my_addr, int addrlen)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
fhandler_socket *fh = get (fd);
|
fhandler_socket *fh = get (fd);
|
||||||
|
|
||||||
@ -1062,6 +1072,7 @@ extern "C" int
|
|||||||
cygwin_getsockname (int fd, struct sockaddr *addr, int *namelen)
|
cygwin_getsockname (int fd, struct sockaddr *addr, int *namelen)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
fhandler_socket *fh = get (fd);
|
fhandler_socket *fh = get (fd);
|
||||||
@ -1082,6 +1093,7 @@ extern "C" int
|
|||||||
cygwin_listen (int fd, int backlog)
|
cygwin_listen (int fd, int backlog)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
fhandler_socket *fh = get (fd);
|
fhandler_socket *fh = get (fd);
|
||||||
|
|
||||||
@ -1099,6 +1111,7 @@ extern "C" int
|
|||||||
cygwin_shutdown (int fd, int how)
|
cygwin_shutdown (int fd, int how)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
fhandler_socket *fh = get (fd);
|
fhandler_socket *fh = get (fd);
|
||||||
@ -1164,6 +1177,7 @@ extern "C" int
|
|||||||
cygwin_getpeername (int fd, struct sockaddr *name, int *len)
|
cygwin_getpeername (int fd, struct sockaddr *name, int *len)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
fhandler_socket *fh = get (fd);
|
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 ?
|
* in use and include paths for the Domain name in each ?
|
||||||
* Punt for now and assume MS-TCP on Win95.
|
* Punt for now and assume MS-TCP on Win95.
|
||||||
*/
|
*/
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
if (__check_null_invalid_struct_errno (domain, len))
|
if (__check_null_invalid_struct_errno (domain, len))
|
||||||
return -1;
|
return -1;
|
||||||
@ -1798,6 +1813,7 @@ get_ifconf (struct ifconf *ifc, int what)
|
|||||||
unsigned long lip, lnp;
|
unsigned long lip, lnp;
|
||||||
struct sockaddr_in *sa;
|
struct sockaddr_in *sa;
|
||||||
|
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
if (check_null_invalid_struct_errno (ifc))
|
if (check_null_invalid_struct_errno (ifc))
|
||||||
return -1;
|
return -1;
|
||||||
@ -1875,6 +1891,7 @@ cygwin_rcmd (char **ahost, unsigned short inport, char *locuser,
|
|||||||
{
|
{
|
||||||
int res = -1;
|
int res = -1;
|
||||||
SOCKET fd2s;
|
SOCKET fd2s;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
if (check_null_invalid_struct_errno (ahost) ||
|
if (check_null_invalid_struct_errno (ahost) ||
|
||||||
@ -1919,6 +1936,7 @@ extern "C" int
|
|||||||
cygwin_rresvport (int *port)
|
cygwin_rresvport (int *port)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
if (check_null_invalid_struct_errno (port))
|
if (check_null_invalid_struct_errno (port))
|
||||||
@ -1950,6 +1968,7 @@ cygwin_rexec (char **ahost, unsigned short inport, char *locuser,
|
|||||||
{
|
{
|
||||||
int res = -1;
|
int res = -1;
|
||||||
SOCKET fd2s;
|
SOCKET fd2s;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
if (check_null_invalid_struct_errno (ahost) ||
|
if (check_null_invalid_struct_errno (ahost) ||
|
||||||
@ -1998,6 +2017,7 @@ socketpair (int family, int type, int protocol, int *sb)
|
|||||||
cygheap_fdnew sb0;
|
cygheap_fdnew sb0;
|
||||||
fhandler_socket *fh;
|
fhandler_socket *fh;
|
||||||
|
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
if (__check_null_invalid_struct_errno (sb, 2 * sizeof (int)))
|
if (__check_null_invalid_struct_errno (sb, 2 * sizeof (int)))
|
||||||
return -1;
|
return -1;
|
||||||
@ -2197,6 +2217,7 @@ extern "C" int
|
|||||||
cygwin_recvmsg (int fd, struct msghdr *msg, int flags)
|
cygwin_recvmsg (int fd, struct msghdr *msg, int flags)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
fhandler_socket *fh = get (fd);
|
fhandler_socket *fh = get (fd);
|
||||||
@ -2223,6 +2244,7 @@ extern "C" int
|
|||||||
cygwin_sendmsg (int fd, const struct msghdr *msg, int flags)
|
cygwin_sendmsg (int fd, const struct msghdr *msg, int flags)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
fhandler_socket *fh = get (fd);
|
fhandler_socket *fh = get (fd);
|
||||||
|
@ -43,6 +43,7 @@ set_sigcatchers (void (*oldsig) (int), void (*cursig) (int))
|
|||||||
extern "C" _sig_func_ptr
|
extern "C" _sig_func_ptr
|
||||||
signal (int sig, _sig_func_ptr func)
|
signal (int sig, _sig_func_ptr func)
|
||||||
{
|
{
|
||||||
|
sig_dispatch_pending (0);
|
||||||
_sig_func_ptr prev;
|
_sig_func_ptr prev;
|
||||||
|
|
||||||
/* check that sig is in right range */
|
/* check that sig is in right range */
|
||||||
@ -69,6 +70,7 @@ extern "C" unsigned int
|
|||||||
sleep (unsigned int seconds)
|
sleep (unsigned int seconds)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
DWORD ms, start_time, end_time;
|
DWORD ms, start_time, end_time;
|
||||||
|
|
||||||
@ -95,6 +97,7 @@ sleep (unsigned int seconds)
|
|||||||
extern "C" unsigned int
|
extern "C" unsigned int
|
||||||
usleep (unsigned int useconds)
|
usleep (unsigned int useconds)
|
||||||
{
|
{
|
||||||
|
sig_dispatch_pending (0);
|
||||||
syscall_printf ("usleep (%d)", useconds);
|
syscall_printf ("usleep (%d)", useconds);
|
||||||
WaitForSingleObject (signal_arrived, (useconds + 500) / 1000);
|
WaitForSingleObject (signal_arrived, (useconds + 500) / 1000);
|
||||||
syscall_printf ("0 = usleep (%d)", useconds);
|
syscall_printf ("0 = usleep (%d)", useconds);
|
||||||
@ -104,6 +107,7 @@ usleep (unsigned int useconds)
|
|||||||
extern "C" int
|
extern "C" int
|
||||||
sigprocmask (int sig, const sigset_t *set, sigset_t *oldset)
|
sigprocmask (int sig, const sigset_t *set, sigset_t *oldset)
|
||||||
{
|
{
|
||||||
|
sig_dispatch_pending (0);
|
||||||
/* check that sig is in right range */
|
/* check that sig is in right range */
|
||||||
if (sig < 0 || sig >= NSIG)
|
if (sig < 0 || sig >= NSIG)
|
||||||
{
|
{
|
||||||
@ -143,6 +147,8 @@ sigprocmask (int sig, const sigset_t *set, sigset_t *oldset)
|
|||||||
static int
|
static int
|
||||||
kill_worker (pid_t pid, int sig)
|
kill_worker (pid_t pid, int sig)
|
||||||
{
|
{
|
||||||
|
sig_dispatch_pending (0);
|
||||||
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
pinfo dest (pid);
|
pinfo dest (pid);
|
||||||
BOOL sendSIGCONT;
|
BOOL sendSIGCONT;
|
||||||
@ -261,6 +267,7 @@ killpg (pid_t pgrp, int sig)
|
|||||||
extern "C" void
|
extern "C" void
|
||||||
abort (void)
|
abort (void)
|
||||||
{
|
{
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
/* Flush all streams as per SUSv2.
|
/* Flush all streams as per SUSv2.
|
||||||
From my reading of this document, this isn't strictly correct.
|
From my reading of this document, this isn't strictly correct.
|
||||||
@ -286,6 +293,7 @@ abort (void)
|
|||||||
extern "C" int
|
extern "C" int
|
||||||
sigaction (int sig, const struct sigaction *newact, struct sigaction *oldact)
|
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);
|
sigproc_printf ("signal %d, newact %p, oldact %p", sig, newact, oldact);
|
||||||
/* check that sig is in right range */
|
/* check that sig is in right range */
|
||||||
if (sig < 0 || sig >= NSIG)
|
if (sig < 0 || sig >= NSIG)
|
||||||
|
@ -516,6 +516,12 @@ sig_dispatch_pending (int justwake)
|
|||||||
{
|
{
|
||||||
if (!hwait_sig)
|
if (!hwait_sig)
|
||||||
return 0;
|
return 0;
|
||||||
|
DWORD tid = GetCurrentThreadId ();
|
||||||
|
|
||||||
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
|
if (tid == sigtid && !justwake)
|
||||||
|
justwake = 1;
|
||||||
|
|
||||||
int was_pending = pending_signals;
|
int was_pending = pending_signals;
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
@ -544,6 +550,9 @@ sig_dispatch_pending (int justwake)
|
|||||||
system_printf ("%E releasing sigcatch_nosync(%p)", sigcatch_nosync);
|
system_printf ("%E releasing sigcatch_nosync(%p)", sigcatch_nosync);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (was_pending && !justwake)
|
||||||
|
thisframe.call_signal_handler ();
|
||||||
|
|
||||||
return was_pending;
|
return was_pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,6 +384,7 @@ readv (int fd, const struct iovec *const iov, const int iovcnt)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
cygheap_fdget cfd (fd);
|
cygheap_fdget cfd (fd);
|
||||||
@ -455,6 +456,7 @@ extern "C" ssize_t
|
|||||||
writev (const int fd, const struct iovec *const iov, const int iovcnt)
|
writev (const int fd, const struct iovec *const iov, const int iovcnt)
|
||||||
{
|
{
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
const ssize_t tot = check_iovec_for_write (iov, iovcnt);
|
const ssize_t tot = check_iovec_for_write (iov, iovcnt);
|
||||||
|
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
@ -510,6 +512,7 @@ open (const char *unix_path, int flags, ...)
|
|||||||
int res = -1;
|
int res = -1;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
mode_t mode = 0;
|
mode_t mode = 0;
|
||||||
|
sig_dispatch_pending (0);
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
|
|
||||||
syscall_printf ("open (%s, %p)", unix_path, flags);
|
syscall_printf ("open (%s, %p)", unix_path, flags);
|
||||||
|
@ -358,7 +358,7 @@ tty::make_pipes (fhandler_pty_master *ptym)
|
|||||||
/* Create communication pipes */
|
/* Create communication pipes */
|
||||||
|
|
||||||
/* FIXME: should this be sec_none_nih? */
|
/* 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");
|
termios_printf ("can't create input pipe");
|
||||||
set_errno (ENOENT);
|
set_errno (ENOENT);
|
||||||
@ -366,7 +366,7 @@ tty::make_pipes (fhandler_pty_master *ptym)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ProtectHandle1INH (to_slave, to_pty);
|
// 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");
|
termios_printf ("can't create output pipe");
|
||||||
set_errno (ENOENT);
|
set_errno (ENOENT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user