Fork me on GitHub

root/include/fiwix/signal.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * fiwix/include/fiwix/signal.h
   3  *
   4  * Copyright 2018-2022, Jordi Sanfeliu. All rights reserved.
   5  * Distributed under the terms of the Fiwix License.
   6  */
   7 
   8 #ifndef _FIWIX_SIGNAL_H
   9 #define _FIWIX_SIGNAL_H
  10 
  11 #define NSIG            32
  12 
  13 #define SIGHUP          1       /* Hangup or Reset */
  14 #define SIGINT          2       /* Interrupt */
  15 #define SIGQUIT         3       /* Quit */
  16 #define SIGILL          4       /* Illegal Instruction */
  17 #define SIGTRAP         5       /* Trace Trap */
  18 #define SIGABRT         6       /* Abort Instruction */
  19 #define SIGIOT          SIGABRT /* I/O Trap Instruction */
  20 #define SIGBUS          7       /* Bus Error */
  21 #define SIGFPE          8       /* Floating Point Exception */
  22 #define SIGKILL         9       /* Kill */
  23 #define SIGUSR1         10      /* User Defined #1 */
  24 #define SIGSEGV         11      /* Segmentation Violation */
  25 #define SIGUSR2         12      /* User Defined #2 */
  26 #define SIGPIPE         13      /* Broken Pipe */
  27 #define SIGALRM         14      /* Alarm Clock */
  28 #define SIGTERM         15      /* Software Termination */
  29 #define SIGSTKFLT       16      /* Stack Fault */
  30 #define SIGCHLD         17      /* Child Termination */
  31 #define SIGCONT         18      /* Continue */
  32 #define SIGSTOP         19      /* Stop */
  33 #define SIGTSTP         20      /* Terminal Stop */
  34 #define SIGTTIN         21      /* Background Read */
  35 #define SIGTTOU         22      /* Background Write */
  36 #define SIGURG          23      /* Urgent Data */
  37 #define SIGXCPU         24      /* CPU eXceeded */
  38 #define SIGXFSZ         25      /* File Size eXceeded */
  39 #define SIGVTALRM       26      /* Virtual Time Alarm */
  40 #define SIGPROF         27      /* Profile Alarm */
  41 #define SIGWINCH        28      /* Window Change */
  42 #define SIGIO           29      /* I/O Asyncronous */
  43 #define SIGPOLL         SIGIO
  44 #define SIGPWR          30      /* Power Fault */
  45 #define SIGUNUSED       31
  46 
  47 typedef unsigned long int __sigset_t;
  48 typedef void (*__sighandler_t)(int);
  49 
  50 struct sigaction {
  51         __sighandler_t sa_handler;
  52         __sigset_t sa_mask;
  53         int sa_flags;
  54         void (*sa_restorer)(void);
  55 };
  56 
  57 #define SIG_DFL         ((__sighandler_t)  0)
  58 #define SIG_IGN         ((__sighandler_t)  1)
  59 #define SIG_ERR         ((__sighandler_t) -1)
  60 
  61 /* bits in sa_flags */
  62 #define SA_NOCLDSTOP    0x00000001      /* don't send SIGCHLD when children stop */
  63 #define SA_NOCLDWAIT    0x00000002      /* don't create zombie on child death */
  64 #define SA_ONSTACK      0x08000000      /* invoke handler on alternate stack */
  65 #define SA_RESTART      0x10000000      /* automatically restart system call */
  66 #define SA_INTERRUPT    0x20000000      /* unused */
  67 
  68 /* don't automatically block signal when the handler is executing */
  69 #define SA_NODEFER      0x40000000
  70 #define SA_NOMASK       SA_NODEFER
  71 
  72 /* reset signal disposition to SIG_DFL before invoking handler */
  73 #define SA_RESETHAND    0x80000000
  74 #define SA_ONESHOT      SA_RESETHAND
  75 
  76 /* bits in the third argument to 'waitpid/wait4' */
  77 #define WNOHANG         1       /* don't block waiting */
  78 #define WUNTRACED       2       /* report status of stopped children */
  79 
  80 #define SIG_BLOCK       0       /* for blocking signals */
  81 #define SIG_UNBLOCK     1       /* for unblocking signals */
  82 #define SIG_SETMASK     2       /* for setting the signal mask */
  83 
  84 /* SIGKILL and SIGSTOP can't ever be set as blockable signals */
  85 #define SIG_BLOCKABLE   (~(1 << (SIGKILL - 1)) | (1 << (SIGSTOP - 1)))
  86 
  87 #define SIG_MASK(sig)   (~(1 << ((sig) - 1)))
  88 
  89 #define KERNEL          1       /* kernel is who has sent the signal */
  90 #define USER            2       /* user is who has sent the signal */
  91 
  92 int issig(void);
  93 void psig(unsigned int);
  94 int kill_pid(__pid_t, __sigset_t, int);
  95 int kill_pgrp(__pid_t, __sigset_t, int);
  96 
  97 #endif /* _FIWIX_SIGNAL_H */

/* [previous][next][first][last][top][bottom][index][help] */