WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] SIGTERM and SIGINT handler to flush xentop -b ou

To: John Levon <levon@xxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] SIGTERM and SIGINT handler to flush xentop -b outputs
From: INAKOSHI Hiroya <inakoshi.hiroya@xxxxxxxxxxxxxx>
Date: Tue, 02 Oct 2007 19:57:44 +0900
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 02 Oct 2007 03:59:00 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20071002012949.GB21202@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <47019D48.5070600@xxxxxxxxxxxxxx> <20071002012949.GB21202@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)
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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel





_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>