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:
authorConrad Scott <conrad.scott@dsl.pipex.com>2002-08-24 16:25:31 +0400
committerConrad Scott <conrad.scott@dsl.pipex.com>2002-08-24 16:25:31 +0400
commit12936cb259ec6cb75d244c73de5e2bb2a7c12533 (patch)
treefbdd079e3373c937ae9a046525dfa9e8e94472c0
parent210a84b5cd6bdac9c4bdea682ccae32582e0b2c7 (diff)
Merged changes from HEAD
-rw-r--r--winsup/cygwin/ChangeLog26
-rw-r--r--winsup/cygwin/fhandler.h1
-rw-r--r--winsup/cygwin/fhandler_console.cc35
-rw-r--r--winsup/cygwin/pinfo.h13
-rw-r--r--winsup/cygwin/pwdgrp.h16
-rw-r--r--winsup/cygwin/select.cc22
-rw-r--r--winsup/cygwin/sigproc.cc2
7 files changed, 72 insertions, 43 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index be01e5dcf..b43e746cc 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,29 @@
+2002-08-19 Christopher Faylor <cgf@redhat.com>
+
+ * pinfo.h (pinfo::remember): Arrange for destructor call if
+ proc_subproc returns error.
+ * sigproc.cc (zombies): Store 1 + total zombies since proc_subproc uses
+ NZOMBIES element.
+
+2002-08-19 Corinna Vinschen <corinna@vinschen.de>
+
+ * pwdgrp.h (pwdgrp_read::pwdgrp_read): Remove.
+ (pwdgrp_read::~pwdgrp_read): Ditto.
+ (pwdgrp_read::open): Reset fh to NULL instead of INVALID_HANDLE_VALUE.
+ (pwdgrp_read::close): Ditto.
+
+2002-08-19 Christopher Faylor <cgf@redhat.com>
+
+ * fhandler.h (fhandler_console::send_winch_maybe): New method.
+ * fhandler_console.cc (set_console_state_for_spawn): Remove if 0'ed
+ code.
+ (fhandler_console::send_winch_maybe): Define new method.
+ (fhandler_console::read): Use send_winch_maybe where appropriate.
+ (fhandler_console::init): Just call all tcsetattr rather than
+ output_tcsetattr.
+ * select.cc (peek_console): Reorganize so that send_winch_maybe is
+ called for everything but keyboard input.
+
2002-08-18 Christopher Faylor <cgf@redhat.com>
* perthread.h (vfork_save): Add ctty, sid, pgid, exitval fields.
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 6237c6ca9..6f9a5cbe5 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -826,6 +826,7 @@ class fhandler_console: public fhandler_termios
void set_close_on_exec (int val);
void fixup_after_fork (HANDLE parent);
void set_input_state ();
+ void send_winch_maybe ();
};
class fhandler_tty_common: public fhandler_termios
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index bae7c11a7..e9ca5b09d 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -147,13 +147,6 @@ set_console_state_for_spawn ()
# define tc shared_console_info /* ACK. Temporarily define for use in TTYSETF macro */
SetConsoleMode (h, ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
TTYSETF (RSTCONS);
-#if 0
- char ch;
- DWORD n;
- /* NOTE -- This ReadFile is apparently necessary for correct functioning on
- Windows NT 4.0. Without this, the next ReadFile returns garbage. */
- (void) ReadFile (h, &ch, 0, &n, NULL);
-#endif
# undef tc
}
@@ -186,6 +179,17 @@ fhandler_console::set_cursor_maybe ()
}
}
+void
+fhandler_console::send_winch_maybe ()
+{
+ SHORT y = info.dwWinSize.Y;
+ SHORT x = info.dwWinSize.X;
+ fillin_info ();
+
+ if (y != info.dwWinSize.Y || x != info.dwWinSize.X)
+ tc->kill_pgrp (SIGWINCH);
+}
+
int __stdcall
fhandler_console::read (void *pv, size_t buflen)
{
@@ -332,9 +336,10 @@ fhandler_console::read (void *pv, size_t buflen)
break;
case MOUSE_EVENT:
+ send_winch_maybe ();
if (use_mouse)
{
- MOUSE_EVENT_RECORD & mouse_event = input_rec.Event.MouseEvent;
+ MOUSE_EVENT_RECORD& mouse_event = input_rec.Event.MouseEvent;
/* Treat the double-click event like a regular button press */
if (mouse_event.dwEventFlags == DOUBLE_CLICK)
@@ -416,10 +421,10 @@ fhandler_console::read (void *pv, size_t buflen)
}
break;
+ case FOCUS_EVENT:
case WINDOW_BUFFER_SIZE_EVENT:
- tc->kill_pgrp (SIGWINCH);
- continue;
-
+ send_winch_maybe ();
+ /* fall through */
default:
continue;
}
@@ -493,7 +498,7 @@ fhandler_console::scroll_screen (int x1, int y1, int x2, int y2, int xn, int yn)
CHAR_INFO fill;
COORD dest;
- (void)fillin_info ();
+ (void) fillin_info ();
sr1.Left = x1 >= 0 ? x1 : info.dwWinSize.X - 1;
if (y1 == 0)
sr1.Top = info.winTop;
@@ -761,8 +766,6 @@ fhandler_console::input_tcsetattr (int, struct termios const *t)
{
flags |= ENABLE_PROCESSED_INPUT;
}
- /* What about ENABLE_WINDOW_INPUT
- and ENABLE_MOUSE_INPUT ? */
if (use_tty)
{
@@ -956,7 +959,7 @@ fhandler_console::cursor_set (BOOL rel_to_top, int x, int y)
{
COORD pos;
- (void)fillin_info ();
+ (void) fillin_info ();
if (y > info.winBottom)
y = info.winBottom;
else if (y < 0)
@@ -1692,7 +1695,7 @@ fhandler_console::init (HANDLE f, DWORD a, mode_t bin)
if (f != INVALID_HANDLE_VALUE)
CloseHandle (f); /* Reopened by open */
- output_tcsetattr (0, &tc->ti);
+ this->tcsetattr (0, &tc->ti);
}
int
diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h
index 8a090cfd9..dcb814bcc 100644
--- a/winsup/cygwin/pinfo.h
+++ b/winsup/cygwin/pinfo.h
@@ -131,7 +131,7 @@ class pinfo
{
HANDLE h;
_pinfo *procinfo;
- int destroy;
+ bool destroy;
public:
void init (pid_t n, DWORD create = 0, HANDLE h = NULL) __attribute__ ((regparm(3)));
pinfo () {}
@@ -154,10 +154,15 @@ public:
_pinfo *operator * () const {return procinfo;}
operator _pinfo * () const {return procinfo;}
// operator bool () const {return (int) h;}
-#ifdef _SIGPROC_H
- int remember () {destroy = 0; return proc_subproc (PROC_ADDCHILD, (DWORD) this);}
-#else
+#ifndef _SIGPROC_H
int remember () {system_printf ("remember is not here"); return 0;}
+#else
+ int remember ()
+ {
+ int res = proc_subproc (PROC_ADDCHILD, (DWORD) this);
+ destroy = res ? false : true;
+ return res;
+ }
#endif
HANDLE shared_handle () {return h;}
};
diff --git a/winsup/cygwin/pwdgrp.h b/winsup/cygwin/pwdgrp.h
index bab2da863..530adf63a 100644
--- a/winsup/cygwin/pwdgrp.h
+++ b/winsup/cygwin/pwdgrp.h
@@ -59,16 +59,6 @@ class pwdgrp_read {
char *lptr, *eptr;
public:
- pwdgrp_read ()
- : fh (INVALID_HANDLE_VALUE), buf (NULL), lptr (NULL), eptr (NULL) {}
- virtual ~pwdgrp_read ()
- {
- if (fh != INVALID_HANDLE_VALUE)
- CloseHandle (fh);
- if (buf)
- free (buf);
- }
-
bool open (const char *posix_fname)
{
if (buf)
@@ -91,7 +81,7 @@ public:
free (buf);
buf = NULL;
CloseHandle (fh);
- fh = INVALID_HANDLE_VALUE;
+ fh = NULL;
return false;
}
buf[read_bytes] = '\0';
@@ -118,8 +108,8 @@ public:
inline const char *get_fname () { return pc; }
void close ()
{
- if (fh != INVALID_HANDLE_VALUE)
+ if (fh)
CloseHandle (fh);
- fh = INVALID_HANDLE_VALUE;
+ fh = NULL;
}
};
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 97674a92f..c3c4158a4 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -661,18 +661,22 @@ peek_console (select_record *me, bool)
break;
else
{
- if (irec.EventType == WINDOW_BUFFER_SIZE_EVENT)
- fh->tc->kill_pgrp (SIGWINCH);
- else if (irec.EventType == MOUSE_EVENT &&
- (irec.Event.MouseEvent.dwEventFlags == 0 ||
- irec.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK))
+ if (irec.EventType == KEY_EVENT)
{
- if (fh->mouse_aware ())
+ if (irec.Event.KeyEvent.bKeyDown
+ && (irec.Event.KeyEvent.uChar.AsciiChar
+ || get_nonascii_key (irec, tmpbuf)))
return me->read_ready = true;
}
- else if (irec.EventType == KEY_EVENT && irec.Event.KeyEvent.bKeyDown == true &&
- (irec.Event.KeyEvent.uChar.AsciiChar || get_nonascii_key (irec, tmpbuf)))
- return me->read_ready = true;
+ else
+ {
+ fh->send_winch_maybe ();
+ if (irec.EventType == MOUSE_EVENT
+ && fh->mouse_aware ()
+ && (irec.Event.MouseEvent.dwEventFlags == 0
+ || irec.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK))
+ return me->read_ready = true;
+ }
/* Read and discard the event */
ReadConsoleInput (h, &irec, 1, &events_read);
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index b43057e1c..8509ff8c4 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -107,7 +107,7 @@ Static HANDLE events[PSIZE + 1]; // All my children's handles++
#define hchildren (events + 1) // Where the children handles begin
Static char cpchildren[PSIZE * sizeof (pinfo)]; // All my children info
Static int nchildren; // Number of active children
-Static char czombies[NZOMBIES * sizeof (pinfo)]; // All my deceased children info
+Static char czombies[(NZOMBIES + 1) * sizeof (pinfo)]; // All my deceased children info
Static int nzombies; // Number of deceased children
#define pchildren ((pinfo *) cpchildren)