This is the mail archive of the
mailing list for the Cygwin project.
Re: SIGHUP on pty closure
- From: Marco atzeri <marco dot atzeri at gmail dot com>
- To: cygwin <cygwin at cygwin dot com>
- Date: Mon, 25 Jul 2011 12:36:58 +0200
- Subject: Re: SIGHUP on pty closure
- References: <4E289D7B.firstname.lastname@example.org>
On 7/21/2011 11:43 PM, Marco atzeri wrote:
looking on the mc subshell issue, I found that mc
suppose that the subshell will receive a SIGHUP
when mc exit and close the master side of pty.
Is such assumption wrong or it is a missing piece of
cygwin pty implementation ?
------------- extract from subshell.c --------------
/* Attach all our standard file descriptors to the pty */
/* This is done just before the fork, because stderr must still */
/* be connected to the real tty during the above error messages; */
/* otherwise the user will never see them. */
dup2 (subshell_pty_slave, STDIN_FILENO);
dup2 (subshell_pty_slave, STDOUT_FILENO);
dup2 (subshell_pty_slave, STDERR_FILENO);
close (subshell_pty_slave); /* These may be FD_CLOEXEC, but just in
/* Close master side of pty. This is important; apart from */
/* freeing up the descriptor for use in the subshell, it also */
/* means that when MC exits, the subshell will get a SIGHUP and */
/* exit too, because there will be no more descriptors pointing */
/* at the master side of the pty and so it will disappear. */
/* Execute the subshell at last */
execl (shell, "bash", "-rcfile", init_file, (char *) NULL);
It seems that mc is correct in the expectation.
"If fildes refers to the master side of a pseudo-terminal, and this is
the last close, a SIGHUP signal shall be sent to the controlling
process, if any, for which the slave side of the pseudo-terminal is the
controlling terminal. It is unspecified whether closing the master side
of the pseudo-terminal flushes all queued input and output."
I don't find such implementation on cygwin
Am I looking in the wrong place ?
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple