From: Michael Kerrisk (man-pages) <hidden> Date: 2013-02-08 20:15:16
On Fri, Feb 8, 2013 at 8:10 PM, Oleg Nesterov [off-list ref] wrote:
On 02/08, Andrey Wagin wrote:
quoted
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:
Now that this can work even with normal read(), we will actually change
f_pos. Then perhaps signalfd_fops->llseek() should work too. But this
is minor...
lseek works only if FMODE_LSEEK is set.
You have explained why read&lseek have strange semantics for SIGNALFD_PEEK.
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.
Yes. but I thought you decided to ignore this oddity ;)
quoted
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?
Well. I do not know. Up to you and Michael.
But honestly, I can't say this all looks really nice. And why do we
need SIGNALFD_PEEK then?
It surely is no beauty. The hope is at least to make it less ugly than it was.
Seriously, perhaps we should simply add signalfd_fops->ioctl() for PEEK.
Or add PTRACE_{PEEK,POKE}_SIGNAL which looks even logical and useful...
And much simpler/straightforward.
But I am not going to argue.
I suppose I had wondered along similar lines, but in a slightly
different direction: would the use of a /proc interface to get the
queued signals make some sense?
Cheers,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
On Fri, Feb 8, 2013 at 8:10 PM, Oleg Nesterov [off-list ref] wrote:
quoted
Well. I do not know. Up to you and Michael.
But honestly, I can't say this all looks really nice. And why do we
need SIGNALFD_PEEK then?
It surely is no beauty. The hope is at least to make it less ugly than it was.
This is subjective, but I am not sure about "less" ;) Yes, we avoid the
magic offsets, but we add SFD_SHARED/PER_THREAD which need to change
dequeue_signal plus other complications. And for what?
quoted
Seriously, perhaps we should simply add signalfd_fops->ioctl() for PEEK.
Or add PTRACE_{PEEK,POKE}_SIGNAL which looks even logical and useful...
And much simpler/straightforward.
But I am not going to argue.
I suppose I had wondered along similar lines, but in a slightly
different direction: would the use of a /proc interface to get the
queued signals make some sense?
(Can't resist sorry... yes we need /proc/pid/cr or /dev/cr or whatever
which dumps almost everything c/r needs without need to add a lot of
cr code everywhere).
Perhaps, but I am not sure about the textual representation.
And to me, the best solution is the simplest solution. Please look
at the patch below. It is trivial. And we can also drop the SFD_RAW
patch in -mm.
Oleg.
From: Andrew Vagin <hidden> Date: 2013-02-10 10:07:24
On Sat, Feb 09, 2013 at 07:22:39PM +0100, Oleg Nesterov wrote:
On 02/08, Michael Kerrisk (man-pages) wrote:
quoted
On Fri, Feb 8, 2013 at 8:10 PM, Oleg Nesterov [off-list ref] wrote:
quoted
Well. I do not know. Up to you and Michael.
But honestly, I can't say this all looks really nice. And why do we
need SIGNALFD_PEEK then?
It surely is no beauty. The hope is at least to make it less ugly than it was.
This is subjective, but I am not sure about "less" ;) Yes, we avoid the
magic offsets, but we add SFD_SHARED/PER_THREAD which need to change
dequeue_signal plus other complications. And for what?
quoted
quoted
Seriously, perhaps we should simply add signalfd_fops->ioctl() for PEEK.
Or add PTRACE_{PEEK,POKE}_SIGNAL which looks even logical and useful...
And much simpler/straightforward.
But I am not going to argue.
I suppose I had wondered along similar lines, but in a slightly
different direction: would the use of a /proc interface to get the
queued signals make some sense?
(Can't resist sorry... yes we need /proc/pid/cr or /dev/cr or whatever
which dumps almost everything c/r needs without need to add a lot of
cr code everywhere).
Perhaps, but I am not sure about the textual representation.
And to me, the best solution is the simplest solution. Please look
at the patch below. It is trivial. And we can also drop the SFD_RAW
patch in -mm.
I'm agree with you and I will ask Andrew to drop the SFD_RAW patch.
Thanks.
On Friday 08 February 2013 21:15, Michael Kerrisk (man-pages) wrote:
quoted
quoted
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.
Yes. but I thought you decided to ignore this oddity ;)
quoted
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?
Well. I do not know. Up to you and Michael.
But honestly, I can't say this all looks really nice. And why do we
need SIGNALFD_PEEK then?
It surely is no beauty. The hope is at least to make it less ugly than it was.
quoted
Seriously, perhaps we should simply add signalfd_fops->ioctl() for PEEK.
Or add PTRACE_{PEEK,POKE}_SIGNAL which looks even logical and useful...
And much simpler/straightforward.
But I am not going to argue.
ptrace interface might find some use in debuggers.
Not that any of them expressed such desires so far,
but just maybe.
However, it needs coding in C to read it,
which brings me to:
I suppose I had wondered along similar lines, but in a slightly
different direction: would the use of a /proc interface to get the
queued signals make some sense?
I think that /proc interface beats adding magic flags and magic semantic
to [p]read.
It also has the benefit of being human-readable. You don't need
to write a special C program to "cat /proc/$$/foo".
Andrey, I know that it is hard to let go of the code you invested time
and efforts in creating. But this isn't the last patch, is it?
You will need to retrieve yet more data for process checkpointing.
When you start working on the next patch for it, consider trying
/proc approach.
--
vda
From: Andrew Vagin <hidden> Date: 2013-02-11 11:01:07
On Mon, Feb 11, 2013 at 10:29:50AM +0100, Denys Vlasenko wrote:
On Friday 08 February 2013 21:15, Michael Kerrisk (man-pages) wrote:
quoted
quoted
quoted
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.
Yes. but I thought you decided to ignore this oddity ;)
quoted
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?
Well. I do not know. Up to you and Michael.
But honestly, I can't say this all looks really nice. And why do we
need SIGNALFD_PEEK then?
It surely is no beauty. The hope is at least to make it less ugly than it was.
quoted
Seriously, perhaps we should simply add signalfd_fops->ioctl() for PEEK.
Or add PTRACE_{PEEK,POKE}_SIGNAL which looks even logical and useful...
And much simpler/straightforward.
But I am not going to argue.
ptrace interface might find some use in debuggers.
Not that any of them expressed such desires so far,
but just maybe.
However, it needs coding in C to read it,
which brings me to:
quoted
I suppose I had wondered along similar lines, but in a slightly
different direction: would the use of a /proc interface to get the
queued signals make some sense?
I think that /proc interface beats adding magic flags and magic semantic
to [p]read.
It also has the benefit of being human-readable. You don't need
to write a special C program to "cat /proc/$$/foo".
Andrey, I know that it is hard to let go of the code you invested time
and efforts in creating. But this isn't the last patch, is it?
You will need to retrieve yet more data for process checkpointing.
When you start working on the next patch for it, consider trying
/proc approach.
I don't think that we need to convert siginfo into a human readable format
in kernel. For example siginfo with a negative si_code contains binary data.
A kernel already has got signalfd_siginfo and we can see, that it's not
good.
I think would be better to print siginfo in a human readable format from
userspace (e.g. gdb) and implement a generic interface in kernel (e.g.
ptrace).