torsdag den 16 juni 2011 klockan 13:14 skrev Simon Josefsson detta:
> Mats Erik Andersson <[email protected]> writes:
>
> > typedef sig_t;
> >
> > This does not apply to OpenSolaris:
> >
> > /* config.h */
> >
> > /* #undef HAVE_SIG_T */
>
> Glibc uses 'sighandler_t' for this, and gnulib should make sure it is
> available. I've checked in a fix for this, please test!
This is not enough in OpenSolaris, since there is no type like
'__sighandler_t' that whould be rewritten using a typedef.
At least for NexentaCore, the signal handler is an anonymous type,
as is displayed by
/* signal.h */
/* Ignoring conditionals. */
extern int (*ssignal(int, int (*)(int)))(int);
extern void (*bsd_signal(int, void (*)(int)))(int);
extern void (*sigset(int, void (*)(int)))(int);
/* sys/signal.h */
struct sigaction {
union {
void (*_handler)();
....
} _funcptr;
};
#define sa_handler _funcptr._handler;
Furthermore,
/* sys/iso/signal_iso.h */
#ifdef __cplusplus
# define SIG_DFL (SIG_PF)0
#else
# define SIG_DFL (void(*)())0
#endif
/* iso/signal_iso.h */
#ifdef __cplusplus
extern "C" SIG_PF signal(int, SIG_PF);
#else
extern void (*signal(int, void (*)(int)))(int);
#endif
So we see that only C++ gets the benefit of a named
function type, not plain C.
Regards,
Mats