Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] undefine SIGHUP if function kill not available...
@ 2009-01-07 11:58 Joel Brobecker
  2009-01-08 13:51 ` Joel Brobecker
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2009-01-07 11:58 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 2337 bytes --]

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  <brobecker@adacore.com>

        * 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

[-- Attachment #2: kill.diff --]
[-- Type: text/plain, Size: 1126 bytes --]

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);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-08 15:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-07 11:58 [RFC] undefine SIGHUP if function kill not available Joel Brobecker
2009-01-08 13:51 ` Joel Brobecker
2009-01-08 15:30   ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox