Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Mon, 17 Jun 2002 16:13:43 +0200 From: Pavel Tsekov Reply-To: Pavel Tsekov Organization: Syntrex, Inc. X-Priority: 3 (Normal) Message-ID: <17824658567.20020617161343@syntrex.com> To: cygwin AT cygwin DOT com Subject: Re[2]: ioctl(), TIOCSWINSZ and pseudo terminal slaves In-Reply-To: <20020617133403.B30892@cygbert.vinschen.de> References: <8114354270 DOT 20020617132158 AT syntrex DOT com> <20020617133403 DOT B30892 AT cygbert DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit CV> On Mon, Jun 17, 2002 at 01:21:58PM +0200, Pavel Tsekov wrote: >> This is just a heads up message :) >> >> The above combination doesn't succeed (-1 is returned), but the errno >> is not set approapriately. CV> What's the expected errno? My report wasn't quite right for which I apologize. errno is not set, so its value is 0 (No error). I don't know which the correct value for errno is in this case though :( However I investiagted a bit more... From the source I can see that this ioctl () function seems to be not implemented for pty slaves when the master is opened with fhandler_pty_master::open() method - I refer to this comment from fhander_tty.cc, line 461: /* output_done_event may or may not exist. It will exist if the tty was opened by fhandler_tty_master::init, normally called at startup if use_tty is non-zero. It will not exist if this is a pty opened by fhandler_pty_master::open. In the former case, tty output is handled by a separate thread which controls output. */ and some lines below this one (line 489): /* The ioctl events may or may not exist. See output_done_event, above. */ Now in this case (pty's) the following code from line 976 get_ttyp ()->ioctl_retval = -1; get_ttyp ()->arg.winsize = * (struct winsize *) arg; if (ioctl_request_event) // This will be NULL SetEvent (ioctl_request_event); if (ioctl_done_event) // and this also WaitForSingleObject (ioctl_done_event, INFINITE); break; will cause the return value of the ioctl() to be -1 but doesn't set errno. I see two possible solutions for this problem, though I don't have the insights to decide which one is correct (of course maybe there are others): 1. The ioctl* events should not be handled like the read/write events i.e. maybe they need to be created both for TTY masters and PTY masters in tty::common_init(). 2. Check in fhandler_tty_slave::ioctl() if the master is a PTY and set ENOSYS for TIOCSWINSZ function. I have to note that my knowledge on PTYs is not good at all and I can't forsee other solutions without further information. I noted this problem in my effort to port Midnight Commander to cygwin. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/