[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121227143626.GA15154@gmail.com>
Date: Thu, 27 Dec 2012 18:36:26 +0400
From: Andrey Wagin <avagin@...il.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Andrew Vagin <avagin@...allels.com>,
Pavel Emelyanov <xemul@...allels.com>,
David Howells <dhowells@...hat.com>,
linux-kernel@...r.kernel.org, criu@...nvz.org,
Cyrill Gorcunov <gorcunov@...nvz.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
linux-fsdevel@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Michael Kerrisk <mtk.manpages@...il.com>
Subject: Re: [CRIU] [PATCH 1/4] signalfd: add ability to return siginfo in a
raw format
On Wed, Dec 26, 2012 at 05:31:12PM +0100, Oleg Nesterov wrote:
> On 12/26, Andrew Vagin wrote:
> >
> > On Tue, Dec 25, 2012 at 05:58:03PM +0100, Oleg Nesterov wrote:
> > > On 12/25, Pavel Emelyanov wrote:
> > > >
> > > > On 12/25/2012 07:27 PM, Oleg Nesterov wrote:
> > > > >
> > > > > I guess that probably you actually need DUMP, not DEQUEUE. but the
> > > > > latter is not trivial. However, perhaps we can do this assuming that
> > > > > all other threads are sleeping and nobody can do dequeue_signal().
> > > > > Say, we can play with ppos/llseek. If *ppos is not zero,
> > > > > signalfd_dequeue() could dump the nth entry from list or return 0.
> > > >
> > > > This would be perfect, but isn't it better to preserve the pos
> > > > semantics -- we do know size of entry we're about to copy, we can
> > > > treat pos as offset in bytes, not in elements.
> > >
> > > nr-of-records looks better (more flexible) than nr-of-bytes to me. And
> > > perhaps we can also encode private-or-shared into ppos. But I will not
> > > argue in any case.
> >
> > Oleg and Pavel, could you look at these two patches. I implemented in them,
> > what you described here.
>
> cosmetics nits below, feel free to ignore...
>
> 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.
You are right.
>
> So I think we should not use llseek. But, probably we can rely on pread() ?
> This way we can avoid the problem above, and this looks even simpler.
Yes. It is a good idea. A new patch is attached to this email. I
implemented pread for signalfd and fixed all your previous comments.
Could you look at this patch. If it's good for you, I will send a whole
serie.
Thanks.
View attachment "0001-signalfd-add-ability-to-get-signal-without-removing-.patch" of type "text/plain" (3475 bytes)
Powered by blists - more mailing lists