From: noer AT cygnus DOT com (Geoffrey Noer) Subject: Re: pty code 9 Feb 1998 14:51:51 -0800 Message-ID: <199802092250.OAA12929.cygnus.cygwin32.developers@rtl.cygnus.com> References: <199802092111 DOT QAA06948 AT subrogation DOT cygnus DOT com> Reply-To: cygwin32-developers AT cygnus DOT com Content-Type: text To: cygwin32-developers AT cygnus DOT com Ian Lance Taylor wrote: > > I figured out a simple way to make Sergey's code work with ptys--the > code which calls stat before opening the slave. I'm going to check > this in. > > Sergey suggested another approach: have the slave write a bunch of > characters when closing, enough to wake up any read, and then have the > read check whether the slave was closed. I haven't been able to think > of a way to make that work in any manner that I find satisfactorily > reliable. We can't really assume anything about the data which comes > from the slave. We have to make sure that the master reads the last > few bytes the slave wrote before closing the pty. > > Ian OK, FYI, I'm probably going to be checking in the following patch from Sergey relatively soon. I don't think it conflicts... Geoffr The following patch implements non-blocking read on all types of file handles (it's neccessary to have X-window and tty versions of Xemacs up and running with cygwin) and contains some bug fixes. fhandler.cc (fhandler_base::fhandler_base): initialize openflags_ variable. hinfo.cc (hinfo_vec::not_open): fixed a bug in checking open fd's range. select.cc (cygwin32_select): restore fd sets if select() call was interrupted by a signal. syscalls.cc include sys/socket.h (_read): if non-blocking i/o is set, check for data availability by calling cygwin32_select() with a zero timeout, set ERRNO to EAGAIN and return -1 if no data is available. tty.cc (fhandler_pty_master::read): removed a check for data availability if non-blocking i/o is set. winsup.h prototype for select_init() removed, prototype for cygwin32_select() added. -- Geoffrey Noer noer AT cygnus DOT com