4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-26 02:27:47 +08:00

* 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.
This commit is contained in:
Christopher Faylor 2002-07-29 03:18:41 +00:00
parent efd34df5a5
commit eb5720f255
6 changed files with 61 additions and 16 deletions

@ -1,3 +1,13 @@
2002-07-28 Christopher Faylor <cgf@redhat.com>
* 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-26 Christopher Faylor <cgf@redhat.com> 2002-07-26 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump API version to indicate that ntsec is * include/cygwin/version.h: Bump API version to indicate that ntsec is

@ -416,7 +416,7 @@ fhandler_console::read (void *pv, size_t buflen)
break; break;
case WINDOW_BUFFER_SIZE_EVENT: case WINDOW_BUFFER_SIZE_EVENT:
kill_pgrp (tc->getpgid (), SIGWINCH); tc->kill_pgrp (SIGWINCH);
continue; continue;
default: default:

@ -169,7 +169,7 @@ fhandler_termios::bg_check (int sig)
/* Don't raise a SIGTT* signal if we have already been interrupted /* Don't raise a SIGTT* signal if we have already been interrupted
by another signal. */ by another signal. */
if (WaitForSingleObject (signal_arrived, 0) != WAIT_OBJECT_0) if (WaitForSingleObject (signal_arrived, 0) != WAIT_OBJECT_0)
_raise (sig); kill_pgrp (myself->pgid, sig);
return bg_signalled; return bg_signalled;
setEIO: setEIO:

@ -661,7 +661,7 @@ peek_console (select_record *me, bool)
else else
{ {
if (irec.EventType == WINDOW_BUFFER_SIZE_EVENT) if (irec.EventType == WINDOW_BUFFER_SIZE_EVENT)
kill_pgrp (fh->tc->getpgid (), SIGWINCH); fh->tc->kill_pgrp (SIGWINCH);
else if (irec.EventType == MOUSE_EVENT && else if (irec.EventType == MOUSE_EVENT &&
(irec.Event.MouseEvent.dwEventFlags == 0 || (irec.Event.MouseEvent.dwEventFlags == 0 ||
irec.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK)) irec.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK))

@ -325,7 +325,7 @@ _read (int fd, void *ptr, size_t len)
sending a SIGTTIN, if appropriate */ sending a SIGTTIN, if appropriate */
res = cfd->bg_check (SIGTTIN); res = cfd->bg_check (SIGTTIN);
if (!cfd.isopen()) if (!cfd.isopen ())
return -1; return -1;
if (res > bg_eof) if (res > bg_eof)

@ -23,6 +23,7 @@ details. */
#include "cygheap.h" #include "cygheap.h"
#include "cygwin/version.h" #include "cygwin/version.h"
#include "perprocess.h" #include "perprocess.h"
#include "sigproc.h"
#include <sys/termios.h> #include <sys/termios.h>
/* tcsendbreak: POSIX 7.2.2.1 */ /* tcsendbreak: POSIX 7.2.2.1 */
@ -111,21 +112,55 @@ out:
extern "C" int extern "C" int
tcsetattr (int fd, int a, const struct termios *t) tcsetattr (int fd, int a, const struct termios *t)
{ {
int res = -1; int res;
cygheap_fdget cfd (fd);
if (cfd < 0)
goto out;
t = __tonew_termios (t); t = __tonew_termios (t);
int e = get_errno ();
if (!cfd->is_tty ()) while (1)
set_errno (ENOTTY); {
else if ((res = cfd->bg_check (-SIGTTOU)) > bg_eof) sigframe thisframe (mainthread);
res = cfd->tcsetattr (a, t);
out: res = -1;
termios_printf ("iflag %x, oflag %x, cflag %x, lflag %x, VMIN %d, VTIME %d", 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_iflag, t->c_oflag, t->c_cflag, t->c_lflag, t->c_cc[VMIN],
t->c_cc[VTIME]); t->c_cc[VTIME]);
termios_printf ("%d = tcsetattr (%d, %d, %x)", res, fd, a, t); termios_printf ("%d = tcsetattr (%d, %d, %x)", res, fd, a, t);