From: Richard Genoud <richard.genoud@gmail.com>
To: Jiri Slaby <jslaby@suse.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Peter Hurley <peter@hurleysoftware.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: stty blocks forever when the line is already opened (and the tx buffer can't be flushed)
Date: Tue, 26 Jan 2016 17:19:20 +0100 [thread overview]
Message-ID: <CACQ1gAiLYWowHTG_FSQt38Bmr2BaLkv36-p-f2pzY34MXBY60Q@mail.gmail.com> (raw)
In-Reply-To: <CACQ1gAjNSTyXLVXp7zrdda2eFfA=aQ4tp_PAMRK+Syh-Va8zaw@mail.gmail.com>
[ sorry for the noise, I forgot to Cc the lkml ]
Hi,
I've found a case were calling
stty -F /dev/ttyS1 clocal
blocks forever.
And I don't know if it's a very old bug or if it's meant to be like that.
Here is how to reproduce the lock :
NB: there's NO modem on ttyS1
stty -F /dev/ttyS1 clocal cread crtscts
cat < /dev/ttyS1
#on another terminal :
echo "dummy" > /dev/ttyS1 # This call doesn't block
stty -F /dev/ttyS1 -crtscts # this blocks forever on ioctl(TCSETSW )
looking at tty_port_close_start(), it's pretty clear that nothing is
flushed until the last user, so it explains why the "echo dummy"
returns directly, despite the crtscts flags.
And in tty_mode_ioctl(), there are the lines:
case TCSETSW:
return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_OLD);
That explain why the stty blocks.
But this behavior seems really strange.
... Or it's meant to be like that ?
Regards,
Richard
NB: This is actually a real life use case with mgetty, a modem losing
its power and another process trying to speak to the modem.
next parent reply other threads:[~2016-01-26 16:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CACQ1gAjNSTyXLVXp7zrdda2eFfA=aQ4tp_PAMRK+Syh-Va8zaw@mail.gmail.com>
2016-01-26 16:19 ` Richard Genoud [this message]
2016-01-26 17:13 ` stty blocks forever when the line is already opened (and the tx buffer can't be flushed) Peter Hurley
2016-01-27 9:14 ` Richard Genoud
2016-01-27 10:26 ` Richard Genoud
2016-01-27 23:33 ` Peter Hurley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CACQ1gAiLYWowHTG_FSQt38Bmr2BaLkv36-p-f2pzY34MXBY60Q@mail.gmail.com \
--to=richard.genoud@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peter@hurleysoftware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).