From: Jiri Slaby <jslaby@suse.cz>
To: Godmar Back <godmar@gmail.com>
Cc: linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>,
Greg KH <gregkh@suse.de>
Subject: Re: Q.: Why does tty_ioctl.c: set_termios return EINTR instead of ERESTARTSYS?
Date: Sat, 15 Oct 2011 10:55:01 +0200 [thread overview]
Message-ID: <4E994A65.7000509@suse.cz> (raw)
In-Reply-To: <CAB4+JYLjjdo_nmwPqWTmd9YFk=4x4AVcprr-b7LoEc9JDqGthQ@mail.gmail.com>
On 10/14/2011 06:52 PM, Godmar Back wrote:
> A student in my OS class noticed during their shell assignment that
> tcsetattr() is being interrupted with EINTR even though they had set
> SA_RESTART.
>
> Upon taking a closer look, I noticed that
> drivers/char/tty_ioctl.c:set_termios(), which lies on the code path
> for the POSIX tcsetattr() function, returns -EINTR when a signal is
> pending. Consequently, the SA_RESTART flag is not honored and user
> code must check for and handle EINTR.
>
> I don't immediately see what would prevent this system call from being
> restartable.
>
> Is there a particular reason why it cannot be made restartable?
EINTR is used when there is no way to rollback already performed
actions. In this case, a flush could be performed. (This holds only for
TCSETSF, TCSETSF2 and similar.) So I think this is the reason we cannot
return ERESTARTSYS.
However I CCed tty fellows, they may have a different opinion.
regards,
--
js
suse labs
next prev parent reply other threads:[~2011-10-15 8:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAB4+JYLiF4wr+U5s_m15baC=Ktf8NnAYFKfcyhM3AxG9PZ4YPA@mail.gmail.com>
[not found] ` <CAB4+JYJYVFouMYZMX4bGVA+vPm1rD3KY3GvwVjKBZS7bwf6-zQ@mail.gmail.com>
2011-10-14 16:52 ` Q.: Why does tty_ioctl.c: set_termios return EINTR instead of ERESTARTSYS? Godmar Back
2011-10-15 8:55 ` Jiri Slaby [this message]
2011-10-15 9:25 ` Alan Cox
2011-10-15 13:12 ` Godmar Back
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=4E994A65.7000509@suse.cz \
--to=jslaby@suse.cz \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=godmar@gmail.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
/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