This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

tty and the cygwin server


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.
<http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/fhandler
_tty.cc.diff?r2=1.50&r1=1.49.2.4&cvsroot=src&f=h>

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]