Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT cygwin DOT com Delivered-To: mailing list cygwin-developers AT cygwin DOT com Message-ID: <18c301c19f0c$7176a770$0200a8c0@lifelesswks> From: "Robert Collins" To: Subject: tty and the cygwin server Date: Thu, 17 Jan 2002 15:07:12 +1100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-OriginalArrivalTime: 17 Jan 2002 04:08:10.0512 (UTC) FILETIME=[93705100:01C19F0C] Ok, looking at the problem Gary reported, I've realised I don't understand tty's :]. So I'm asking for a quick lesson. To save anyone looking at the code, here's the key differences between MAIN and cygwin_daemon. in fhandler_tty_slave::open, MAIN uses a single temp handle variable in the duplicate calls , cygwin_daemon always uses two. MAIN always does the duplication internally, cygwin_daemon only does it internally if the cygserver call fails. I can't see any substantial differences other than that. Yet... running the daemon, rxvt quits after the first command is given to ash. Without running the daemon, rxvt operates fine. My question is, what occurs between accept_input and process_slave_output in rxvt that could result in ash (the slave) quitting? I can't get a strace of the slaves behaviour so far, which is why I'm turning for inspiration here... This is a strace snippet from a failed run 1482 5445896 [main] rxvt 3660 fhandler_pty_master::accept_input: about to write 3 chars t o slave 12959 5458855 [main] rxvt 3660 fhandler_pty_master::process_slave_output: bytes read 1 1025 5459880 [main] rxvt 3660 fhandler_pty_master::process_slave_output: returning 2 1687 5461567 [main] rxvt 3660 fhandler_pty_master::hit_eof: all other handles closed 1949 5463516 [main] rxvt 3660 fhandler_pty_master::hit_eof: all other handles closed 1024 5464540 [main] rxvt 3660 fhandler_pty_master::process_slave_output: returning 0 5284 5469824 [select_pipe] rxvt 3660 fhandler_pty_master::hit_eof: all other handles clos ed 6412 5476236 [main] rxvt 3660 fhandler_pty_master::hit_eof: all other handles closed 1886 5478122 [main] rxvt 3660 fhandler_pty_master::hit_eof: all other handles closed 1068 5479190 [main] rxvt 3660 fhandler_pty_master::process_slave_output: returning 0 10435 5489625 [select_pipe] rxvt 3660 fhandler_pty_master::hit_eof: all other handles clos ed 11509 5501134 [main] rxvt 3660 fhandler_tty_common::close: no more masters left. sending E OF 1629 5502763 [main] rxvt 3660 fhandler_tty_common::close: tty0 <0x728,0x750> closed 1078 5503841 [main] rxvt 3660 fhandler_pty_master::close: freeing tty0 (0) And this is from a good run 1720 3832826 [main] rxvt 1996 fhandler_pty_master::accept_input: about to write 3 chars t o slave 13517 3846343 [main] rxvt 1996 fhandler_pty_master::process_slave_output: bytes read 1 1550 3847893 [main] rxvt 1996 fhandler_pty_master::process_slave_output: returning 2 122079 3969972 [main] rxvt 1996 fhandler_pty_master::process_slave_output: bytes read 257 1418 3971390 [main] rxvt 1996 fhandler_pty_master::process_slave_output: returning 261 Rob