Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/signal.h

    r3f466c33 r1a552fd  
    3939#include "sys/types.h"
    4040
    41 extern void __posix_default_signal_handler(int signo);
    42 extern void __posix_hold_signal_handler(int signo);
    43 extern void __posix_ignore_signal_handler(int signo);
     41/* HelenOS doesn't have signals, so calls to functions of this header
     42 * are just replaced with their respective failure return value.
     43 *
     44 * Other macros and constants are here just to satisfy the symbol resolver
     45 * and have no practical value whatsoever, until HelenOS implements some
     46 * equivalent of signals. Maybe something neat based on IPC will be devised
     47 * in the future?
     48 */
    4449
    4550#undef SIG_DFL
    46 #define SIG_DFL ((void (*)(int)) __posix_default_signal_handler)
     51#define SIG_DFL ((void (*)(int)) 0)
    4752#undef SIG_ERR
    48 #define SIG_ERR ((void (*)(int)) NULL)
     53#define SIG_ERR ((void (*)(int)) 0)
    4954#undef SIG_HOLD
    50 #define SIG_HOLD ((void (*)(int)) __posix_hold_signal_handler)
     55#define SIG_HOLD ((void (*)(int)) 0)
    5156#undef SIG_IGN
    52 #define SIG_IGN ((void (*)(int)) __posix_ignore_signal_handler)
     57#define SIG_IGN ((void (*)(int)) 0)
     58
     59#define signal(sig,func) (errno = ENOTSUP, SIG_ERR)
     60#define raise(sig) ((int) -1)
     61#define kill(pid,sig) (errno = ENOTSUP, (int) -1)
    5362
    5463typedef int posix_sig_atomic_t;
    55 typedef uint32_t posix_sigset_t;
     64typedef int posix_sigset_t;
    5665typedef struct posix_mcontext {
    5766        // FIXME: should not be empty to avoid compiler warnings (-pedantic)
     
    7887        int si_errno;
    7988
    80         posix_pid_t si_pid;
    81         posix_uid_t si_uid;
     89        pid_t si_pid;
     90        uid_t si_uid;
    8291        void *si_addr;
    8392        int si_status;
     
    111120/* Values of posix_sigevent::sigev_notify */
    112121#undef SIGEV_NONE
     122#define SIGEV_NONE 0
    113123#undef SIGEV_SIGNAL
     124#define SIGEV_SIGNAL 0
    114125#undef SIGEV_THREAD
    115 #define SIGEV_NONE 0
    116 #define SIGEV_SIGNAL 0
    117126#define SIGEV_THREAD 0
    118127
    119128#undef SIGRT_MIN
     129#define SIGRT_MIN 0
    120130#undef SIGRT_MAX
    121 #define SIGRT_MIN 0
    122131#define SIGRT_MAX 0
    123132
    124133#undef SIG_BLOCK
     134#define SIG_BLOCK 0
    125135#undef SIG_UNBLOCK
     136#define SIG_UNBLOCK 0
    126137#undef SIG_SETMASK
    127 #define SIG_BLOCK 0
    128 #define SIG_UNBLOCK 1
    129 #define SIG_SETMASK 2
     138#define SIG_SETMASK 0
    130139
    131140#undef SA_NOCLDSTOP
     141#define SA_NOCLDSTOP 0
    132142#undef SA_ONSTACK
     143#define SA_ONSTACK 0
    133144#undef SA_RESETHAND
     145#define SA_RESETHAND 0
    134146#undef SA_RESTART
     147#define SA_RESTART 0
    135148#undef SA_SIGINFO
     149#define SA_SIGINFO 0
    136150#undef SA_NOCLDWAIT
     151#define SA_NOCLDWAIT 0
    137152#undef SA_NODEFER
    138 #define SA_NOCLDSTOP (1 << 0)
    139 #define SA_ONSTACK (1 << 1)
    140 #define SA_RESETHAND (1 << 2)
    141 #define SA_RESTART (1 << 3)
    142 #define SA_SIGINFO (1 << 4)
    143 #define SA_NOCLDWAIT (1 << 5)
    144 #define SA_NODEFER (1 << 6)
     153#define SA_NODEFER 0
    145154
    146155#undef SS_ONSTACK
     156#define SS_ONSTACK 0
    147157#undef SS_DISABLE
    148 #define SS_ONSTACK 0
    149158#define SS_DISABLE 0
    150159
    151160#undef MINSIGSTKSZ
     161#define MINSIGSTKSZ 0
    152162#undef SIGSTKSZ
    153 #define MINSIGSTKSZ 0
    154163#define SIGSTKSZ 0
    155164
    156165/* full POSIX set */
    157166enum {
    158         /* Termination Signals */
    159167        SIGABRT,
     168        SIGALRM,
     169        SIGBUS,
     170        SIGCHLD,
     171        SIGCONT,
     172        SIGFPE,
     173        SIGHUP,
     174        SIGILL,
     175        SIGINT,
     176        SIGKILL,
     177        SIGPIPE,
    160178        SIGQUIT,
    161         SIGINT,
     179        SIGSEGV,
     180        SIGSTOP,
    162181        SIGTERM,
    163        
    164         /* Child Signal */
    165         SIGCHLD,
    166        
    167         /* User signals */
    168         SIGUSR1,
    169         SIGUSR2,
    170 
    171         /* Timer */
    172         SIGALRM,
    173         SIGVTALRM,
    174         SIGPROF, /* obsolete */
    175 
    176         _TOP_CATCHABLE_SIGNAL = SIGPROF,
    177 
    178         /* Process Scheduler Interaction - not supported */
    179         SIGSTOP,
    180         SIGCONT,
    181 
    182         /* Process Termination - can't be caught */
    183         SIGKILL,
    184 
    185         _TOP_SENDABLE_SIGNAL = SIGKILL,
    186 
    187         /* Hardware Exceptions - can't be caught or sent */
    188         SIGFPE,
    189         SIGBUS,
    190         SIGILL,
    191         SIGSEGV,
    192 
    193         /* Other Exceptions - not supported */
    194         SIGSYS,
    195         SIGXCPU,
    196         SIGXFSZ,
    197 
    198         /* Debugging - not supported */
    199         SIGTRAP,
    200 
    201         /* Communication Signals - not supported */
    202         SIGHUP,
    203         SIGPIPE,
    204         SIGPOLL, /* obsolete */
    205         SIGURG,
    206 
    207         /* Terminal Signals - not supported */
    208182        SIGTSTP,
    209183        SIGTTIN,
    210184        SIGTTOU,
    211        
    212         _TOP_SIGNAL = SIGTTOU
    213 };
    214 
    215 /* Values for sigaction field si_code. */
    216 
    217 enum {
    218         SI_USER,
    219         SI_QUEUE,
    220         SI_TIMER,
    221         SI_ASYNCIO,
    222         SI_MESGQ,
    223         ILL_ILLOPC,
    224         ILL_ILLOPN,
    225         ILL_ILLADR,
    226         ILL_ILLTRP,
    227         ILL_PRVOPC,
    228         ILL_PRVREG,
    229         ILL_COPROC,
    230         ILL_BADSTK,
    231         FPE_INTDIV,
    232         FPE_INTOVF,
    233         FPE_FLTDIV,
    234         FPE_FLTOVF,
    235         FPE_FLTUND,
    236         FPE_FLTRES,
    237         FPE_FLTINV,
    238         FPE_FLTSUB,
    239         SEGV_MAPERR,
    240         SEGV_ACCERR,
    241         BUS_ADRALN,
    242         BUS_ADRERR,
    243         BUS_OBJERR,
    244         TRAP_BRKPT,
    245         TRAP_TRACE,
    246         CLD_EXITED,
    247         CLD_KILLED,
    248         CLD_DUMPED,
    249         CLD_TRAPPED,
    250         CLD_STOPPED,
    251         CLD_CONTINUED,
    252         POLL_IN,
    253         POLL_OUT,
    254         POLL_MSG,
    255         POLL_ERR,
    256         POLL_PRI,
    257         POLL_HUP
    258 };
    259 
    260 extern int posix_sigaction(int sig, const struct posix_sigaction *restrict act,
    261     struct posix_sigaction *restrict oact);
    262 
    263 extern void (*posix_signal(int sig, void (*func)(int)))(int);
    264 extern int posix_raise(int sig);
    265 extern int posix_kill(posix_pid_t pid, int sig);
    266 extern int posix_killpg(posix_pid_t pid, int sig);
    267 
    268 extern void posix_psiginfo(const posix_siginfo_t *pinfo, const char *message);
    269 extern void posix_psignal(int signum, const char *message);
    270 
     185        SIGUSR1,
     186        SIGUSR2,
     187        SIGPOLL,
     188        SIGPROF,
     189        SIGSYS,
     190        SIGTRAP,
     191        SIGURG,
     192        SIGVTALRM,
     193        SIGXCPU,
     194        SIGXFSZ
     195};
     196
     197/* Just declared to avoid compiler warnings. */
    271198extern int posix_sigemptyset(posix_sigset_t *set);
    272 extern int posix_sigfillset(posix_sigset_t *set);
    273 extern int posix_sigaddset(posix_sigset_t *set, int signo);
    274 extern int posix_sigdelset(posix_sigset_t *set, int signo);
    275 extern int posix_sigismember(const posix_sigset_t *set, int signo);
    276 
    277 extern int posix_thread_sigmask(int how, const posix_sigset_t *restrict set,
    278     posix_sigset_t *restrict oset);
    279199extern int posix_sigprocmask(int how, const posix_sigset_t *restrict set,
    280200    posix_sigset_t *restrict oset);
     
    284204        #define sigset_t posix_sigset_t
    285205        #define sigval posix_sigval
    286         #ifndef sigevent
    287                 #define sigevent posix_sigevent
    288         #endif
     206        #define sigevent posix_sigevent
    289207        #define sigaction posix_sigaction
    290208        #define mcontext_t posix_mcontext_t
     
    292210        #define stack_t posix_stack_t
    293211        #define siginfo_t posix_siginfo_t
    294 
    295         #define signal posix_signal
    296         #define raise posix_raise
    297         #define kill posix_kill
    298         #define killpg posix_killpg
    299 
    300         #define psiginfo posix_psiginfo
    301         #define psignal posix_psignal
    302 
    303212        #define sigemptyset posix_sigemptyset
    304         #define sigfillset posix_sigfillset
    305         #define sigaddset posix_sigaddset
    306         #define sigdelset posix_sigdelset
    307         #define sigismember posix_sigismember
    308 
    309         #define pthread_sigmask posix_thread_sigmask
    310213        #define sigprocmask posix_sigprocmask
    311214#endif
Note: See TracChangeset for help on using the changeset viewer.