From: "Michael Kerrisk" <mtk-manpages@gmx.net>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: signalfd() semantics after execve()
Date: Sun, 15 Jul 2007 11:17:38 +0200 [thread overview]
Message-ID: <20070715091738.193100@gmx.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0707141151500.31255@alien.or.mcafeemobile.com>
Davide,
> > I'm working on the signalfd(2) man page, and I've come
> > acorss some puzzling behaviour...
> >
> > What are the intended semantics of a signalfd file descriptor
> > after an execve()?
> >
> > As far as I can work out, after an execve() the file descriptor
> > is still available, but reads from it always return 0, even if:
> >
> > a) there were signals pending before the execve().
> > However, sigpending() shows the signal as pending,
> > and the signal can be accepted using sigwaitinfo().
> >
> > b) we generate a signal after the execve().
> >
> > Is this intended behavior (the "orphaned sighand" condition
> > mentioned in the draft man page you sent me?)? Is it a bug?
>
> It is the intended behaviour. Just like reading from a socket where the
> remote peer disconnected.
I don't think this analogy is good; what is the "peer" in this
situation?
IMO, A better analogy is: signalfd() should provide
similar semantics to sigwaitinfo()/sigtimedwait() (and/or
handling signals with a signal handler).
> A return 0 from a read from a signalfd should be
> interpreted as the "virtual connection" with the signal source has been
> dropped.
Yes, but in this case why has the '"virtual connection" with the
signal source' been dropped?
Why shouldn't one be allowed to continue reading signals from
the signalfd file descriptor after the execve()?
After all, I can still fetch those signals with sigwaitinfo()
after the execve(). Not being able to also dothat with signalfd
just isn't consistent.
Cheers,
Michael
--
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7
Want to help with man page maintenance?
Grab the latest tarball at
http://www.kernel.org/pub/linux/docs/manpages ,
read the HOWTOHELP file and grep the source
files for 'FIXME'.
prev parent reply other threads:[~2007-07-15 9:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-14 7:41 signalfd() semantics after execve() Michael Kerrisk
2007-07-14 18:53 ` Davide Libenzi
2007-07-15 9:17 ` Michael Kerrisk [this message]
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=20070715091738.193100@gmx.net \
--to=mtk-manpages@gmx.net \
--cc=davidel@xmailserver.org \
--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