Cygwin: console: Revive Win7 compatibility.

- The commit fca4cda7a4 broke Win7
  compatibility. This patch fixes the issue.
This commit is contained in:
Takashi Yano 2019-09-19 05:49:55 +09:00 committed by Ken Brown
parent bbc625da81
commit 1a44ad03e0
3 changed files with 6 additions and 7 deletions

View File

@ -43,6 +43,12 @@ details. */
#define O_TMPFILE_FILE_ATTRS (FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_HIDDEN)
/* Buffer size for ReadConsoleInput() and PeekConsoleInput(). */
/* Per MSDN, max size of buffer required is below 64K. */
/* (65536 / sizeof (INPUT_RECORD)) is 3276, however,
ERROR_NOT_ENOUGH_MEMORY occurs in win7 if this value is used. */
#define INREC_SIZE 2048
extern const char *windows_device_names[];
extern struct __cygwin_perfile *perfile_table;
#define __fmode (*(user_data->fmode_ptr))

View File

@ -499,9 +499,6 @@ fhandler_console::process_input_message (void)
termios *ti = &(get_ttyp ()->ti);
/* Per MSDN, max size of buffer required is below 64K. */
#define INREC_SIZE (65536 / sizeof (INPUT_RECORD))
fhandler_console::input_states stat = input_processing;
DWORD total_read, i;
INPUT_RECORD input_rec[INREC_SIZE];
@ -1165,9 +1162,6 @@ fhandler_console::ioctl (unsigned int cmd, void *arg)
return -1;
case FIONREAD:
{
/* Per MSDN, max size of buffer required is below 64K. */
#define INREC_SIZE (65536 / sizeof (INPUT_RECORD))
DWORD n;
int ret = 0;
INPUT_RECORD inp[INREC_SIZE];

View File

@ -1209,7 +1209,6 @@ peek_pty_slave (select_record *s, bool from_select)
{
if (ptys->is_line_input ())
{
#define INREC_SIZE (65536 / sizeof (INPUT_RECORD))
INPUT_RECORD inp[INREC_SIZE];
DWORD n;
PeekConsoleInput (ptys->get_handle (), inp, INREC_SIZE, &n);