This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] undefine SIGHUP if function kill not available...


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: kill.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]