From 04ac9b6529b698fbb0d3be6b43ec214c10507a26 Mon Sep 17 00:00:00 2001 From: scottc Date: Mon, 29 Jul 2002 10:54:14 +0000 Subject: Merged changes from HEAD --- winsup/cygwin/ChangeLog | 21 ++++++++++++ winsup/cygwin/fhandler_console.cc | 2 +- winsup/cygwin/fhandler_registry.cc | 2 +- winsup/cygwin/fhandler_termios.cc | 2 +- winsup/cygwin/include/cygwin/version.h | 3 +- winsup/cygwin/select.cc | 2 +- winsup/cygwin/syscalls.cc | 5 ++- winsup/cygwin/termios.cc | 63 ++++++++++++++++++++++++++-------- 8 files changed, 78 insertions(+), 22 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 0664ce4e9ee..e7454c06110 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,13 @@ +2002-07-28 Christopher Faylor + + * fhandler_console.cc (fhandler_console::read): Use appropriate + kill_pgrp method. + * select.cc (peek_console): Ditto. + * fhandler_termios.cc (fhandler_termios::bg_check): Send "stopped" + signal to entire process group as dictated by SUSv3. + * termios.cc (tcsetattr): Detect when stopped signal sent and force a + stop before setting anything. + 2002-07-28 Conrad Scott * cygserver_shm.cc (class server_shmmgr): Remove `cleanup_t' @@ -149,6 +159,17 @@ (client_shmmgr::shmdt): Ditto. (client_shmmgr::attach): Ditto. +2002-07-26 Christopher Faylor + + * include/cygwin/version.h: Bump API version to indicate that ntsec is + on by default now. + +2002-07-26 Conrad Scott + + * fhandler_registry.cc (fhandler_registry::close): Return any error + result to the caller. + * syscalls.cc (_close): Return result of fhandler::close to the caller. + 2002-07-25 Christopher Faylor * security.cc (allow_ntsec): Default to on. diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index c8f085623c3..4d767daf5a9 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -416,7 +416,7 @@ fhandler_console::read (void *pv, size_t buflen) break; case WINDOW_BUFFER_SIZE_EVENT: - kill_pgrp (tc->getpgid (), SIGWINCH); + tc->kill_pgrp (SIGWINCH); continue; default: diff --git a/winsup/cygwin/fhandler_registry.cc b/winsup/cygwin/fhandler_registry.cc index 4fc875a9b2d..f2e5e21456e 100644 --- a/winsup/cygwin/fhandler_registry.cc +++ b/winsup/cygwin/fhandler_registry.cc @@ -533,7 +533,7 @@ fhandler_registry::close () } if (value_name) cfree (value_name); - return 0; + return res; } bool diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc index 778c0965132..d631fad9acc 100644 --- a/winsup/cygwin/fhandler_termios.cc +++ b/winsup/cygwin/fhandler_termios.cc @@ -169,7 +169,7 @@ fhandler_termios::bg_check (int sig) /* Don't raise a SIGTT* signal if we have already been interrupted by another signal. */ if (WaitForSingleObject (signal_arrived, 0) != WAIT_OBJECT_0) - _raise (sig); + kill_pgrp (myself->pgid, sig); return bg_signalled; setEIO: diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index eb076c2f3ef..aafc2f93264 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -153,12 +153,13 @@ details. */ 53: Export strlcat, strlcpy. 54: Export __fpclassifyd, __fpclassifyf, __signbitd, __signbitf. 55: Export fcloseall, fcloseall_r. + 56: Make ntsec on by default. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 55 +#define CYGWIN_VERSION_API_MINOR 56 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 30e082a2e21..808882d3fd7 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -661,7 +661,7 @@ peek_console (select_record *me, bool) else { if (irec.EventType == WINDOW_BUFFER_SIZE_EVENT) - kill_pgrp (fh->tc->getpgid (), SIGWINCH); + fh->tc->kill_pgrp (SIGWINCH); else if (irec.EventType == MOUSE_EVENT && (irec.Event.MouseEvent.dwEventFlags == 0 || irec.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK)) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index f2d7b1999f1..018f67dc600 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -325,7 +325,7 @@ _read (int fd, void *ptr, size_t len) sending a SIGTTIN, if appropriate */ res = cfd->bg_check (SIGTTIN); - if (!cfd.isopen()) + if (!cfd.isopen ()) return -1; if (res > bg_eof) @@ -578,9 +578,8 @@ _close (int fd) res = -1; else { - cfd->close (); + res = cfd->close (); cfd.release (); - res = 0; } syscall_printf ("%d = close (%d)", res, fd); diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc index c44ccbdc393..706a31a87d4 100644 --- a/winsup/cygwin/termios.cc +++ b/winsup/cygwin/termios.cc @@ -23,6 +23,7 @@ details. */ #include "cygheap.h" #include "cygwin/version.h" #include "perprocess.h" +#include "sigproc.h" #include /* tcsendbreak: POSIX 7.2.2.1 */ @@ -111,21 +112,55 @@ out: extern "C" int tcsetattr (int fd, int a, const struct termios *t) { - int res = -1; - - cygheap_fdget cfd (fd); - if (cfd < 0) - goto out; - + int res; t = __tonew_termios (t); - - if (!cfd->is_tty ()) - set_errno (ENOTTY); - else if ((res = cfd->bg_check (-SIGTTOU)) > bg_eof) - res = cfd->tcsetattr (a, t); - -out: - termios_printf ("iflag %x, oflag %x, cflag %x, lflag %x, VMIN %d, VTIME %d", + int e = get_errno (); + + while (1) + { + sigframe thisframe (mainthread); + + res = -1; + cygheap_fdget cfd (fd); + if (cfd < 0) + { + e = get_errno (); + break; + } + + if (!cfd->is_tty ()) + { + e = ENOTTY; + break; + } + + res = cfd->bg_check (-SIGTTOU); + + switch (res) + { + case bg_eof: + e = get_errno (); + break; + case bg_ok: + if (cfd.isopen ()) + res = cfd->tcsetattr (a, t); + else + e = get_errno (); + break; + case bg_signalled: + if (thisframe.call_signal_handler ()) + continue; + res = -1; + /* fall through intentionally */ + default: + e = get_errno (); + break; + } + break; + } + + set_errno (e); + termios_printf ("iflag %p, oflag %p, cflag %p, lflag %p, VMIN %d, VTIME %d", t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag, t->c_cc[VMIN], t->c_cc[VTIME]); termios_printf ("%d = tcsetattr (%d, %d, %x)", res, fd, a, t); -- cgit v1.2.1