From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1894 invoked by alias); 7 Jan 2009 11:58:47 -0000 Received: (qmail 1886 invoked by uid 22791); 7 Jan 2009 11:58:47 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Jan 2009 11:58:42 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 9CC922A964C for ; Wed, 7 Jan 2009 06:58:40 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id cuz+cZ79zv8o for ; Wed, 7 Jan 2009 06:58:40 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id AD8972A9620 for ; Wed, 7 Jan 2009 06:58:39 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 99CE0E7ACD; Wed, 7 Jan 2009 15:58:32 +0400 (RET) Date: Wed, 07 Jan 2009 11:58:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [RFC] undefine SIGHUP if function kill not available... Message-ID: <20090107115832.GF1751@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="27ZtN5FSuKKSZcBU" Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-01/txt/msg00086.txt.bz2 --27ZtN5FSuKKSZcBU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 2337 I have just seen Mark's comments (thank you!) about this patch, so I just downgraded this request to a request for comments. Here is the problem: In event-top.c, some code that is conditional on SIGHUP being defined also uses kill(). On x86_64-windows, the MinGW signal.h now defines SIGHUP, but kill is still not available. So the approach I took for now was to pretend that SIGHUP is not defined if kill is not available. This is clearly a hack, hence the comment I added. Mark's comments were: > > AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid \ > > - getgid poll pread64 sbrk setpgid setpgrp setsid \ > > + getgid kill poll pread64 sbrk setpgid setpgrp setsid \ > > sigaction sigprocmask sigsetmask socketpair syscall \ > > ttrace wborder setlocale]) > > Why the hell do we need to add a check for a function defined by ISO C90? > > > +#if defined (SIGHUP) && !defined (HAVE_KILL) > > +/* On x86_64-windows, MingW's signal.h defines SIGHUP but does not > > + provide "kill". However, the code that uses SIGHUP below also > > + uses kill. So, if kill is not available, pretend SIGHUP isn't > > + either. */ > > +#undef SIGHUP > > +#endif > > This must be a bug in MingW. Please tell the MingW people that in > 2008 they manage to ship an environment that doesn't even implement > ISO C90 correctly. If they fix it (or have already fixed it) is it > really necessary to add this ugly workaround? Just to make sure I understand, my understanding is the fact that "kill" is not available, right? Not knowing Windows all that well, I wonder how much sense a "kill" routine would make. That being said, I agree that, if MinGW has already fixed the problem, it's reasonable to require a recent version of MinGW. I will double-check for sure. But in the event that this is not the case, I think it's reasonable to add the workaround. I should probably add a FIXME and a date, to show that this should really be a temporary measure. Or maybe there's a better way? 2009-01-07 Joel Brobecker * configure.ac: Add kill to the list of functions to check. * configure, config.in: Regenerate. * event-top.c: Undefine SIGHUP if kill is not available. Tested on x86-windows and x86-linux. -- Joel --27ZtN5FSuKKSZcBU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="kill.diff" Content-length: 1126 diff --git a/gdb/configure.ac b/gdb/configure.ac index 4e0cf7d..e970234 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -774,7 +774,7 @@ AC_FUNC_ALLOCA AC_FUNC_MMAP AC_FUNC_VFORK AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid \ - getgid poll pread64 sbrk setpgid setpgrp setsid \ + getgid kill poll pread64 sbrk setpgid setpgrp setsid \ sigaction sigprocmask sigsetmask socketpair syscall \ ttrace wborder setlocale]) diff --git a/gdb/event-top.c b/gdb/event-top.c index 5483608..dd223e1 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -50,6 +50,14 @@ static void change_line_handler (void); static void change_annotation_level (void); static void command_handler (char *command); +#if defined (SIGHUP) && !defined (HAVE_KILL) +/* On x86_64-windows, MingW's signal.h defines SIGHUP but does not + provide "kill". However, the code that uses SIGHUP below also + uses kill. So, if kill is not available, pretend SIGHUP isn't + either. */ +#undef SIGHUP +#endif + /* Signal handlers. */ #ifdef SIGQUIT static void handle_sigquit (int sig); --27ZtN5FSuKKSZcBU--