Home | History | Annotate | Download | only in Linux
      1 //===-- LinuxSignals.cpp ----------------------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // C Includes
     11 #include <signal.h>
     12 
     13 // C++ Includes
     14 // Other libraries and framework includes
     15 // Project includes
     16 #include "LinuxSignals.h"
     17 
     18 LinuxSignals::LinuxSignals()
     19     : UnixSignals()
     20 {
     21     Reset();
     22 }
     23 
     24 void
     25 LinuxSignals::Reset()
     26 {
     27     m_signals.clear();
     28 
     29 #define ADDSIGNAL(S, SUPPRESS, STOP, NOTIFY, DESCRIPTION) \
     30     AddSignal(SIG ## S, "SIG" #S, #S, SUPPRESS, STOP, NOTIFY, DESCRIPTION)
     31 
     32     ADDSIGNAL(HUP,    false,  true,  true, "hangup");
     33     ADDSIGNAL(INT,    true,   true,  true, "interrupt");
     34     ADDSIGNAL(QUIT,   false,  true,  true, "quit");
     35     ADDSIGNAL(ILL,    false,  true,  true, "illegal instruction");
     36     ADDSIGNAL(TRAP,   true,   true,  true, "trace trap (not reset when caught)");
     37     ADDSIGNAL(ABRT,   false,  true,  true, "abort");
     38     ADDSIGNAL(IOT,    false,  true,  true, "abort");
     39     ADDSIGNAL(BUS,    false,  true,  true, "bus error");
     40     ADDSIGNAL(FPE,    false,  true,  true, "floating point exception");
     41     ADDSIGNAL(KILL,   false,  true,  true, "kill");
     42     ADDSIGNAL(USR1,   false,  true,  true, "user defined signal 1");
     43     ADDSIGNAL(SEGV,   false,  true,  true, "segmentation violation");
     44     ADDSIGNAL(USR2,   false,  true,  true, "user defined signal 2");
     45     ADDSIGNAL(PIPE,   false,  true,  true, "write to pipe with reading end closed");
     46     ADDSIGNAL(ALRM,   false,  false, true, "alarm");
     47     ADDSIGNAL(TERM,   false,  true,  true, "termination requested");
     48     ADDSIGNAL(STKFLT, false,  true,  true, "stack fault");
     49     ADDSIGNAL(CHLD,   false,  false, true, "child process exit");
     50     ADDSIGNAL(CONT,   false,  true,  true, "process continue");
     51     ADDSIGNAL(STOP,   false,  true,  true, "process stop");
     52     ADDSIGNAL(TSTP,   false,  true,  true, "tty stop");
     53     ADDSIGNAL(TTIN,   false,  true,  true, "background tty read");
     54     ADDSIGNAL(TTOU,   false,  true,  true, "background tty write");
     55     ADDSIGNAL(URG,    false,  true,  true, "urgent data on socket");
     56     ADDSIGNAL(XCPU,   false,  true,  true, "CPU resource exceeded");
     57     ADDSIGNAL(XFSZ,   false,  true,  true, "file size limit exceeded");
     58     ADDSIGNAL(VTALRM, false,  true,  true, "virtual alarm");
     59     ADDSIGNAL(PROF,   false,  true,  true, "profiling alarm");
     60     ADDSIGNAL(WINCH,  false,  true,  true, "window size change");
     61     ADDSIGNAL(POLL,   false,  true,  true, "pollable event");
     62     ADDSIGNAL(IO,     false,  true,  true, "input/output ready");
     63     ADDSIGNAL(PWR,    false,  true,  true, "power failure");
     64     ADDSIGNAL(SYS,    false,  true,  true, "invalid system call");
     65 
     66 #undef ADDSIGNAL
     67 }
     68