public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: serial: select: fix previous revamp patch
Date: Thu, 26 Mar 2020 11:26:26 +0000 (GMT)	[thread overview]
Message-ID: <20200326112626.A6FC8385E01A@sourceware.org> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 2241 bytes --]

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e4f9fc92ac613f0ae6cf44de7fdd6229c50168e4

commit e4f9fc92ac613f0ae6cf44de7fdd6229c50168e4
Author: Åke Rehnman <ake.rehnman@gmail.com>
Date:   Fri Mar 20 10:37:17 2020 +0100

    Cygwin: serial: select: fix previous revamp patch
    
    - We need a verify function.
    - The event object referenced in WaitCommEvent must not be a local var,
      move it into fhandler_serial.

Diff:
---
 winsup/cygwin/fhandler.h |  1 +
 winsup/cygwin/select.cc  | 12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 923313df4..45e256e77 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1685,6 +1685,7 @@ class fhandler_serial: public fhandler_base
   pid_t pgrp_;
   int rts;				/* for Windows 9x purposes only */
   int dtr;				/* for Windows 9x purposes only */
+  DWORD event;				/* for select */
 
  public:
   OVERLAPPED io_status;
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 93820ae77..e11f5850a 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -1493,14 +1493,18 @@ serial_read_cleanup (select_record *s, select_stuff *stuff)
     }
 }
 
+verify_serial (select_record *me, fd_set *rfds, fd_set *wfds, fd_set *efds)
+{
+  return peek_serial (me, true);
+}
+
 select_record *
 fhandler_serial::select_read (select_stuff *ss)
 {
-  DWORD event;
   select_record *s = ss->start.next;
 
   s->startup = no_startup;
-  s->verify = verify_ok;
+  s->verify = verify_serial;
   s->cleanup = serial_read_cleanup;
   s->peek = peek_serial;
   s->read_selected = true;
@@ -1521,7 +1525,7 @@ fhandler_serial::select_write (select_stuff *ss)
   select_record *s = ss->start.next;
 
   s->startup = no_startup;
-  s->verify = verify_ok;
+  s->verify = verify_serial;
   s->peek = peek_serial;
   s->write_selected = true;
   s->write_ready = true;
@@ -1534,7 +1538,7 @@ fhandler_serial::select_except (select_stuff *ss)
   select_record *s = ss->start.next;
 
   s->startup = no_startup;
-  s->verify = verify_ok;
+  s->verify = verify_serial;
   s->peek = peek_serial;
   s->except_selected = false;	// Can't do this
   s->except_ready = false;


                 reply	other threads:[~2020-03-26 11:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200326112626.A6FC8385E01A@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).