From: Momchil Velikov <velco@fadata.bg>
To: Michael Schmitz <schmitz@opal.biophys.uni-duesseldorf.de>
Cc: bh40@calva.net, linuxppc-dev@lists.linuxppc.org
Subject: Re: serial on lombard
Date: Fri, 15 Oct 1999 10:26:54 +0300 [thread overview]
Message-ID: <3806D73E.19182EFF@fadata.bg> (raw)
In-Reply-To: 199910141610.SAA10877@opal.biophys.uni-duesseldorf.de
Michael Schmitz wrote:
>
> > I think the code should be as follows:
> > signal( SIGALRM, a_signal_handler_which_just_returns );
> > alarm(4);
> > portfd = open( dial_tty, O_RDWR|O_NONBLOCK);
> > alarm(0);
> > if( portfd >= 0 ) {
> > ...
> >
> > In old code (and in the patched one too) there is a race condition
> > between clearing the alarm and signal delivery. A sequence similar
> > to the above one relies only on the return value of open().
> > Regards,
>
> alarm(0) only clears the timer and won't change the return value of open.
> Watching the strace output closely you will see that the return value of
> open is filled in only after the alarm fired. The macserial open fails to
> check for pending signals after completing the modem powerup wait, and
> can't detect the timeout.
There is no need to change the return value of open(). One should _examine_ it,
and the minicom doesn't do this -- its on the 0-branch of setjmp.
Actually, there is _absolutely_ no need for alarm() -- if you say
O_NONBLOCK, you should not expect to block and you should not try to work
around with some fancy timeouts and stuff. The old code, the proposed patch
and my proposal are simply pointless -- that's to say, they all try
to solve a problem which doesn't exist (and thay fail, of course ;-).
Regards,
-velco
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
next prev parent reply other threads:[~1999-10-15 7:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-14 19:12 serial on lombard Mario Scarpa
1999-10-14 11:06 ` Benjamin Herrenschmidt
1999-10-14 11:19 ` Michael Schmitz
1999-10-14 11:31 ` Momchil Velikov
1999-10-14 12:35 ` Chris Ridd
1999-10-14 13:06 ` Benjamin Herrenschmidt
1999-10-14 13:43 ` Momchil Velikov
1999-10-14 14:21 ` Michael Schmitz
1999-10-14 14:34 ` Benjamin Herrenschmidt
1999-10-14 14:53 ` Momchil Velikov
1999-10-14 16:10 ` Michael Schmitz
1999-10-15 7:26 ` Momchil Velikov [this message]
1999-10-14 16:00 ` Michael Schmitz
1999-10-14 16:10 ` Benjamin Herrenschmidt
1999-10-14 17:41 ` Michael Schmitz
1999-10-15 4:12 ` Mario Scarpa
1999-10-15 8:33 ` Benjamin Herrenschmidt
1999-10-15 20:17 ` Mario Scarpa
1999-10-15 8:42 ` Michael Schmitz
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=3806D73E.19182EFF@fadata.bg \
--to=velco@fadata.bg \
--cc=bh40@calva.net \
--cc=linuxppc-dev@lists.linuxppc.org \
--cc=schmitz@opal.biophys.uni-duesseldorf.de \
/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).