From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2210) id 91A563858C27; Thu, 16 Sep 2021 20:28:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 91A563858C27 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Ken Brown To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pipe, fifo: Move query_hdl and hdl_cnt_mtx to fhandler_pipe. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: 199482654b07e0603f668caaba8cddb2070cfdb8 X-Git-Newrev: 9814cfd8f693f61e602a5436b3fd6502907bfb11 Message-Id: <20210916202805.91A563858C27@sourceware.org> Date: Thu, 16 Sep 2021 20:28:05 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 20:28:05 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=9814cfd8f693f61e602a5436b3fd6502907bfb11 commit 9814cfd8f693f61e602a5436b3fd6502907bfb11 Author: Takashi Yano Date: Fri Sep 17 04:23:12 2021 +0900 Cygwin: pipe, fifo: Move query_hdl and hdl_cnt_mtx to fhandler_pipe. - query_hdl and hdl_cnt_mtx are moved from fhandler_pipe_fifo to fhandler_pipe. Then reader_closed() is changed to virtual and overridden in fhandler_pipe. Diff: --- winsup/cygwin/fhandler.h | 27 +++++++++++++-------------- winsup/cygwin/fhandler_pipe.cc | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 31edb1822..61113e698 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -1175,26 +1175,13 @@ class fhandler_pipe_fifo: public fhandler_base { protected: size_t pipe_buf_size; - HANDLE query_hdl; - HANDLE hdl_cnt_mtx; virtual void release_select_sem (const char *) {}; public: fhandler_pipe_fifo (); - HANDLE get_query_handle () const { return query_hdl; } - void close_query_handle () - { - if (query_hdl) - { - CloseHandle (query_hdl); - query_hdl = NULL; - } - } - bool reader_closed (); - + virtual bool reader_closed () { return false; }; ssize_t __reg3 raw_write (const void *ptr, size_t len); - }; class fhandler_pipe: public fhandler_pipe_fifo @@ -1202,6 +1189,8 @@ class fhandler_pipe: public fhandler_pipe_fifo private: HANDLE read_mtx; pid_t popen_pid; + HANDLE query_hdl; + HANDLE hdl_cnt_mtx; void release_select_sem (const char *); public: fhandler_pipe (); @@ -1250,6 +1239,16 @@ public: return fh; } void set_pipe_non_blocking (bool nonblocking); + HANDLE get_query_handle () const { return query_hdl; } + void close_query_handle () + { + if (query_hdl) + { + CloseHandle (query_hdl); + query_hdl = NULL; + } + } + bool reader_closed (); }; #define CYGWIN_FIFO_PIPE_NAME_LEN 47 diff --git a/winsup/cygwin/fhandler_pipe.cc b/winsup/cygwin/fhandler_pipe.cc index 2068a943e..73ace3ac5 100644 --- a/winsup/cygwin/fhandler_pipe.cc +++ b/winsup/cygwin/fhandler_pipe.cc @@ -393,7 +393,7 @@ fhandler_pipe::raw_read (void *ptr, size_t& len) } bool -fhandler_pipe_fifo::reader_closed () +fhandler_pipe::reader_closed () { if (!query_hdl) return false;