| 115 | } |
| 116 | |
| 117 | void SetSignalHandler(const FuzzingOptions& Options) { |
| 118 | // setitimer is not implemented in emscripten. |
| 119 | if (Options.HandleAlrm && Options.UnitTimeoutSec > 0 && !LIBFUZZER_EMSCRIPTEN) |
| 120 | SetTimer(Options.UnitTimeoutSec / 2 + 1); |
| 121 | if (Options.HandleInt) |
| 122 | SetSigaction(SIGINT, InterruptHandler); |
| 123 | if (Options.HandleTerm) |
| 124 | SetSigaction(SIGTERM, InterruptHandler); |
| 125 | if (Options.HandleSegv) |
| 126 | SetSigaction(SIGSEGV, SegvHandler); |
| 127 | if (Options.HandleBus) |
| 128 | SetSigaction(SIGBUS, CrashHandler); |
| 129 | if (Options.HandleAbrt) |
| 130 | SetSigaction(SIGABRT, CrashHandler); |
| 131 | if (Options.HandleIll) |
| 132 | SetSigaction(SIGILL, CrashHandler); |
| 133 | if (Options.HandleFpe) |
| 134 | SetSigaction(SIGFPE, CrashHandler); |
| 135 | if (Options.HandleXfsz) |
| 136 | SetSigaction(SIGXFSZ, FileSizeExceedHandler); |
| 137 | if (Options.HandleUsr1) |
| 138 | SetSigaction(SIGUSR1, GracefulExitHandler); |
| 139 | if (Options.HandleUsr2) |
| 140 | SetSigaction(SIGUSR2, GracefulExitHandler); |
| 141 | } |
| 142 | |
| 143 | void SleepSeconds(int Seconds) { |
| 144 | sleep(Seconds); // Use C API to avoid coverage from instrumented libc++. |
no test coverage detected