Thread (3 messages) 3 messages, 3 authors, 2013-02-08

Re: [PATCH 3/3] signalfd: add ability to read siginfo-s without dequeuing signals (v2)

flat view

From: Michael Kerrisk (man-pages) <hidden>
Date: 2013-02-08 00:51:50
Also in: linux-fsdevel, lkml

On Thu, Feb 7, 2013 at 10:13 PM, Andrey Wagin [off-list ref] wrote:
2013/2/7 Oleg Nesterov [off-list ref]:
quoted
Andrey, sorry for delay.

As for API, I leave this to you and Michael. Not that I like these
new flags, but I agree that pread() hack was not pretty too.

On 01/29, Andrey Vagin wrote:
[...]
quoted
Damn. But after I wrote this email I realized that llseek() probably can't
work. Because peek_offset/f_pos/whatever has to be shared with all processes
which have this file opened.

Suppose that the task forks after sys_signalfd(). Now if parent or child
do llseek this affects them both. This is insane because signalfd is
"strange" to say at least, fork/dup/etc inherits signalfd_ctx but not the
"source" of the data.
(Good catch, Oleg.)
So I want to suggest a way how to forbid read() for SIGNALFD_PEEK.
file->f_pos can be initialized to -1. read() returns EINVAL in this
case. In a man page we will write that signals can be dumped only with
help pread(). Is it overload or too ugly?
From an interface perspective I have no problem with limiting the API
to allow just pread(). If we later decide that there is some way that
the semantics using read() + lseek() could be sensible (which seems
unlikely), we could relax things and allow read().

[...]
Oleg, thank you for the comments. I'm waiting an answer on the
question and after that I'm going to send a final version.
It would be nice if the new patch series has a changelog of the
changes to date, and also includes a fairly detailed description of
the user-space API. Would that be possible?

Thanks,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help