From: INAKOSHI Hiroya <inakoshi.hiroya@jp.fujitsu.com>
To: John Levon <levon@movementarian.org>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] SIGTERM and SIGINT handler to flush xentop -b outputs
Date: Tue, 02 Oct 2007 19:57:44 +0900 [thread overview]
Message-ID: <47022428.1060607@jp.fujitsu.com> (raw)
In-Reply-To: <20071002012949.GB21202@totally.trollied.org.uk>
John,
thanks for your comment. I see your point. I will post another patch
in a separate e-mail. It uses a signal handler in a safe manner.
Regards,
Hiroya
John Levon wrote:
> On Tue, Oct 02, 2007 at 10:22:16AM +0900, INAKOSHI Hiroya wrote:
>
>> +void a_sig_handler(int n)
>> +{
>> + fflush(stdout);
>> + exit(0);
>> +}
>
> Neither exit() nor fflush() are guaranteed signal safe:
>
> http://opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
>
> so can't be used in signal handlers.
>
>> } else {
>> + signal(SIGTERM, a_sig_handler);
>> + signal(SIGINT, a_sig_handler);
>
> There's never a reason to use signal() these days, even if you made the
> handler use _exit()
>
> regards
> john
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
>
next prev parent reply other threads:[~2007-10-02 10:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-02 1:22 [PATCH] SIGTERM and SIGINT handler to flush xentop -b outputs INAKOSHI Hiroya
2007-10-02 1:29 ` John Levon
2007-10-02 10:57 ` INAKOSHI Hiroya [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-10-02 11:10 INAKOSHI Hiroya
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=47022428.1060607@jp.fujitsu.com \
--to=inakoshi.hiroya@jp.fujitsu.com \
--cc=levon@movementarian.org \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.