Changeset 2216 for trunk


Ignore:
Timestamp:
Jul 6, 2005, 5:53:43 AM (20 years ago)
Author:
bird
Message:

Added signal handler types for gnu and bsd compatability.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/sys/signal.h

    • Property cvs2svn:cvs-rev changed from 1.11 to 1.12
    r2215 r2216  
    127127 * @{
    128128 */
    129 #define SIG_ERR ((void (*)(int))-1)     /** Failure. */
    130 #define SIG_DFL ((void (*)(int))0)      /** Default action. */
    131 #define SIG_IGN ((void (*)(int))1)      /** Ignore signal. */
     129#define SIG_ERR ((__sighandler_t *)-1)  /** Failure. */
     130#define SIG_DFL ((__sighandler_t *)0)   /** Default action. */
     131#define SIG_IGN ((__sighandler_t *)1)   /** Ignore signal. */
    132132/* 2 is reserved for BSD internal use */
    133133#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 /** @todo check specs on SIG_HOLD. */
    134 #define SIG_HOLD ((void (*)(int))3)
     134#define SIG_HOLD ((__sighandler_t *)3)
    135135#endif
    136136#ifdef __BSD_VISIBLE
    137 #define SIG_ACK ((void (*)(int))4)      /** OS/2: Acknowledge a signal. */
     137#define SIG_ACK ((__sighandler_t *)4)   /** OS/2: Acknowledge a signal. */
    138138#endif
    139139/** @} */
     
    448448#endif
    449449
     450/** ANSI C signals handler. */
     451typedef void __sighandler_t(int);
     452/** POSIX Signal info handler. */
     453typedef void __siginfohandler_t(int, struct __siginfo *, void *);
     454
     455#ifdef __BSD_VISIBLE
     456/** BSD 4.4 type. */
     457typedef __sighandler_t *sig_t;
     458#endif
     459#ifdef __USE_GNU
     460/** GLIBC makes this symbol available  */
     461typedef __sighandler_t *sighandler_t;
     462#endif
    450463
    451464#if __POSIX_VISIBLE || __XSI_VISIBLE
     
    464477        /** New style handler. First arg is signal number, second is signal
    465478         * info, third is signal specific (I think). */
    466         void  (*__sa_sigaction)(int, struct __siginfo *, void *);
     479        __siginfohandler_t *__sa_sigaction;
    467480        /** Old style handler. First arg is signal number. */
    468         void  (*__sa_handler)(int);
     481        __sighandler_t     *__sa_handler;
    469482    }  __sigaction_u;
    470483    /** Signal mask to apply when executing the action. */
     
    485498{
    486499    /** See sa_sigaction in struct sigaction. */
    487     void      (*sv_handler)(int, struct __siginfo *, void *);
     500    __sighandler_t *sv_handler;
    488501    /** See sa_mask in struct sigaction. */
    489     int         sv_mask;
     502    int             sv_mask;
    490503    /** See sa_flags in struct sigaction. */
    491     int         sv_flags;
     504    int             sv_flags;
    492505};
    493506#define sv_onstack          sv_flags
     
    532545
    533546__BEGIN_DECLS
    534 void (*signal(int, void (*)(int)))(int);
    535 
    536 void (*bsd_signal(int, void (*)(int)))(int);
    537 void (*_signal_sysv(int, void (*)(int)))(int);
    538 void (*_signal_os2(int, void (*)(int)))(int);
     547__sighandler_t *signal(int, __sighandler_t *);
     548__sighandler_t *bsd_signal(int, __sighandler_t *);
     549__sighandler_t *_signal_sysv(int, __sighandler_t *);
     550__sighandler_t *_signal_os2(int, __sighandler_t *);
    539551
    540552/** @define __LIBC_SIGNAL_SYSV
    541553 * #define __LIBC_SIGNAL_SYSV to use System V style signal. */
    542554#ifdef __LIBC_SIGNAL_SYSV
    543 static inline void (*signal (int iSignalNo, void (*pfnHandler)(int)))(int)
     555static inline __sighandler_t *signal(int iSignalNo, __sighandler_t *pfnHandler)
    544556{ return _signal_sysv(iSignalNo, pfnHandler); }
    545557#endif
     
    548560 * #define __LIBC_SIGNAL_OS2 to use System V style signal. */
    549561#ifdef __LIBC_SIGNAL_OS2
    550 static inline void (*signal (int iSignalNo, void (*pfnHandler)(int)))(int)
     562static inline __sighandler_t *signal(int iSignalNo, __sighandler_t *pfnHandler)
    551563{ return _signal_os2(iSignalNo, pfnHandler); }
    552564#endif
Note: See TracChangeset for help on using the changeset viewer.