This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: [PATCH v2 1/1] Cygwin: console: Revive Win7 compatibility.
- From: Ken Brown <kbrown at cornell dot edu>
- To: "cygwin-patches at cygwin dot com" <cygwin-patches at cygwin dot com>
- Date: Fri, 20 Sep 2019 02:21:55 +0000
- Subject: Re: [PATCH v2 1/1] Cygwin: console: Revive Win7 compatibility.
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TCp7G0CoxIC032lBRKnBjDl1C/gwnYWQinVx0eLRRxA=; b=ihrE4zEw6yzg4X5TZstXUuUrfPeGd23lfKqeA+rYmz7sRDxTwETUVBWhDZiTH/MqEgDb4/yibM8fGHVu1ujh7PtnEKM71eFc2LdHU3DYUoTZrjAL1WGAuZHLe90pFlEC6W7/rnGtVAimequdD5Na3eZo+FSUULWOO+jAXY5PJiYyaJwM1+rDybQPgNM3DRQj3oyJ+WFME7HWK4N67q8hAEDg/qDZ5J3R+c7904tWNjffR0NyNhln7bbGmh4SPKukZ2Km8VHCRCzJbDu9ndcobHmzztTELtZu2hX9UA/MZTb1Cyvp5UD5neLrHAUszC+HHGGMAU57BTfB1xKQBCZ7Pw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P8NdwD8O4bZWrwSRjh8kDScm3K+1knRbMYJJldGJtbsR3sywEP/nbgOQyZS+XwoWU6XE3b6WmmUZxlA7qcaPftwrFIPwVWYIhIxnnVkeOPbuTBuJP/yMdq2AiZCnrFOg3mZhTRtsW7VhvwZ7qPdD2GbPi4W+SU8HYDJW8/i4BKobGamcMGyUWFrpZH1tqHlHXHMe2rUyrG8SexV7ZPOg2NNqF9TWpqZ1za+EBPTj18PgDcWo1+xIOJ6NieIWv39n6Sd2boRb27KUFenZu3hJe4WCGPZKFy/1xiOzJ9WXVitvzZd2XpDEQHjjQATfvqf/3mkX+1enYuyasBdnlhTskA==
- References: <20190918204955.2131-1-takashi.yano@nifty.ne.jp> <20190918204955.2131-2-takashi.yano@nifty.ne.jp>
On 9/18/2019 4:49 PM, Takashi Yano wrote:
> - The commit fca4cda7a420d7b15ac217d008527e029d05758e broke Win7
> compatibility. This patch fixes the issue.
> ---
> winsup/cygwin/fhandler.h | 6 ++++++
> winsup/cygwin/fhandler_console.cc | 6 ------
> winsup/cygwin/select.cc | 1 -
> 3 files changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
> index 4efb6a4f2..94b0e520b 100644
> --- a/winsup/cygwin/fhandler.h
> +++ b/winsup/cygwin/fhandler.h
> @@ -43,6 +43,12 @@ details. */
>
> #define O_TMPFILE_FILE_ATTRS (FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_HIDDEN)
>
> +/* Buffer size for ReadConsoleInput() and PeakConsoleInput(). */
Peek
> +/* 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))
> diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
> index 709b8255d..86c39db25 100644
> --- a/winsup/cygwin/fhandler_console.cc
> +++ b/winsup/cygwin/fhandler_console.cc
> @@ -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];
> diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
> index ed8c98d1c..e7014422b 100644
> --- a/winsup/cygwin/select.cc
> +++ b/winsup/cygwin/select.cc
> @@ -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);
Pushed, with the above typo corrected. Thanks.
Ken