cmProcess.cxx 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmProcess.h"
  4. #include <csignal>
  5. #include <iostream>
  6. #include <ratio>
  7. #include <string>
  8. #include <utility>
  9. #include <cmext/algorithm>
  10. #include "cmsys/Process.h"
  11. #include "cmCTest.h"
  12. #include "cmCTestRunTest.h"
  13. #include "cmCTestTestHandler.h"
  14. #include "cmGetPipes.h"
  15. #include "cmStringAlgorithms.h"
  16. #if defined(_WIN32)
  17. # include <cm3p/kwiml/int.h>
  18. #endif
  19. #define CM_PROCESS_BUF_SIZE 65536
  20. cmProcess::cmProcess(std::unique_ptr<cmCTestRunTest> runner)
  21. : Runner(std::move(runner))
  22. , Conv(cmProcessOutput::UTF8, CM_PROCESS_BUF_SIZE)
  23. {
  24. this->TotalTime = cmDuration::zero();
  25. this->ExitValue = 0;
  26. this->Id = 0;
  27. this->StartTime = std::chrono::steady_clock::time_point();
  28. }
  29. cmProcess::~cmProcess() = default;
  30. void cmProcess::SetCommand(std::string const& command)
  31. {
  32. this->Command = command;
  33. }
  34. void cmProcess::SetCommandArguments(std::vector<std::string> const& args)
  35. {
  36. this->Arguments = args;
  37. }
  38. void cmProcess::SetWorkingDirectory(std::string const& dir)
  39. {
  40. this->WorkingDirectory = dir;
  41. }
  42. bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
  43. {
  44. this->ProcessState = cmProcess::State::Error;
  45. if (this->Command.empty()) {
  46. return false;
  47. }
  48. this->StartTime = std::chrono::steady_clock::now();
  49. this->SystemStartTime = std::chrono::system_clock::now();
  50. this->ProcessArgs.clear();
  51. // put the command as arg0
  52. this->ProcessArgs.push_back(this->Command.c_str());
  53. // now put the command arguments in
  54. for (std::string const& arg : this->Arguments) {
  55. this->ProcessArgs.push_back(arg.c_str());
  56. }
  57. this->ProcessArgs.push_back(nullptr); // null terminate the list
  58. cm::uv_timer_ptr timer;
  59. int status = timer.init(loop, this);
  60. if (status != 0) {
  61. cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
  62. "Error initializing timer: " << uv_strerror(status)
  63. << std::endl);
  64. return false;
  65. }
  66. cm::uv_pipe_ptr pipe_writer;
  67. cm::uv_pipe_ptr pipe_reader;
  68. pipe_writer.init(loop, 0);
  69. pipe_reader.init(loop, 0, this);
  70. int fds[2] = { -1, -1 };
  71. status = cmGetPipes(fds);
  72. if (status != 0) {
  73. cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
  74. "Error initializing pipe: " << uv_strerror(status)
  75. << std::endl);
  76. return false;
  77. }
  78. uv_pipe_open(pipe_reader, fds[0]);
  79. uv_pipe_open(pipe_writer, fds[1]);
  80. uv_stdio_container_t stdio[3];
  81. stdio[0].flags = UV_INHERIT_FD;
  82. stdio[0].data.fd = 0;
  83. stdio[1].flags = UV_INHERIT_STREAM;
  84. stdio[1].data.stream = pipe_writer;
  85. stdio[2] = stdio[1];
  86. uv_process_options_t options = uv_process_options_t();
  87. options.file = this->Command.data();
  88. options.args = const_cast<char**>(this->ProcessArgs.data());
  89. options.stdio_count = 3; // in, out and err
  90. options.exit_cb = &cmProcess::OnExitCB;
  91. options.stdio = stdio;
  92. #if UV_VERSION_MAJOR > 1 || !defined(CMAKE_USE_SYSTEM_LIBUV)
  93. if (!this->Runner->GetCTest()->GetInteractiveDebugMode()) {
  94. options.flags = UV_PROCESS_WINDOWS_USE_PARENT_ERROR_MODE;
  95. }
  96. #endif
  97. #if !defined(CMAKE_USE_SYSTEM_LIBUV)
  98. std::vector<char> cpumask;
  99. if (affinity && !affinity->empty()) {
  100. cpumask.resize(static_cast<size_t>(uv_cpumask_size()), 0);
  101. for (auto p : *affinity) {
  102. cpumask[p] = 1;
  103. }
  104. options.cpumask = cpumask.data();
  105. options.cpumask_size = cpumask.size();
  106. } else {
  107. options.cpumask = nullptr;
  108. options.cpumask_size = 0;
  109. }
  110. #else
  111. static_cast<void>(affinity);
  112. #endif
  113. status =
  114. uv_read_start(pipe_reader, &cmProcess::OnAllocateCB, &cmProcess::OnReadCB);
  115. if (status != 0) {
  116. cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
  117. "Error starting read events: " << uv_strerror(status)
  118. << std::endl);
  119. return false;
  120. }
  121. status = this->Process.spawn(loop, options, this);
  122. if (status != 0) {
  123. cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
  124. "Process not started\n " << this->Command << "\n["
  125. << uv_strerror(status) << "]\n");
  126. return false;
  127. }
  128. this->PipeReader = std::move(pipe_reader);
  129. this->Timer = std::move(timer);
  130. this->StartTimer();
  131. this->ProcessState = cmProcess::State::Executing;
  132. return true;
  133. }
  134. void cmProcess::StartTimer()
  135. {
  136. if (this->Timeout) {
  137. auto msec =
  138. std::chrono::duration_cast<std::chrono::milliseconds>(*this->Timeout);
  139. this->Timer.start(&cmProcess::OnTimeoutCB,
  140. static_cast<uint64_t>(msec.count()), 0);
  141. }
  142. }
  143. bool cmProcess::Buffer::GetLine(std::string& line)
  144. {
  145. // Scan for the next newline.
  146. for (size_type sz = this->size(); this->Last != sz; ++this->Last) {
  147. if ((*this)[this->Last] == '\n' || (*this)[this->Last] == '\0') {
  148. // Extract the range first..last as a line.
  149. char const* text = this->data() + this->First;
  150. size_type length = this->Last - this->First;
  151. while (length && text[length - 1] == '\r') {
  152. length--;
  153. }
  154. line.assign(text, length);
  155. // Start a new range for the next line.
  156. ++this->Last;
  157. this->First = this->Last;
  158. // Return the line extracted.
  159. return true;
  160. }
  161. }
  162. // Available data have been exhausted without a newline.
  163. if (this->First != 0) {
  164. // Move the partial line to the beginning of the buffer.
  165. this->erase(this->begin(), this->begin() + this->First);
  166. this->First = 0;
  167. this->Last = this->size();
  168. }
  169. return false;
  170. }
  171. bool cmProcess::Buffer::GetLast(std::string& line)
  172. {
  173. // Return the partial last line, if any.
  174. if (!this->empty()) {
  175. line.assign(this->data(), this->size());
  176. this->First = this->Last = 0;
  177. this->clear();
  178. return true;
  179. }
  180. return false;
  181. }
  182. void cmProcess::OnReadCB(uv_stream_t* stream, ssize_t nread,
  183. uv_buf_t const* buf)
  184. {
  185. auto* self = static_cast<cmProcess*>(stream->data);
  186. self->OnRead(nread, buf);
  187. }
  188. void cmProcess::OnRead(ssize_t nread, uv_buf_t const* buf)
  189. {
  190. std::string line;
  191. if (nread > 0) {
  192. std::string strdata;
  193. this->Conv.DecodeText(buf->base, static_cast<size_t>(nread), strdata);
  194. cm::append(this->Output, strdata);
  195. while (this->Output.GetLine(line)) {
  196. this->Runner->CheckOutput(line);
  197. line.clear();
  198. }
  199. return;
  200. }
  201. if (nread == 0) {
  202. return;
  203. }
  204. // The process will provide no more data.
  205. if (nread != UV_EOF) {
  206. auto error = static_cast<int>(nread);
  207. cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
  208. "Error reading stream: " << uv_strerror(error) << std::endl);
  209. }
  210. // Look for partial last lines.
  211. if (this->Output.GetLast(line)) {
  212. this->Runner->CheckOutput(line);
  213. }
  214. this->ReadHandleClosed = true;
  215. this->PipeReader.reset();
  216. if (this->ProcessHandleClosed) {
  217. uv_timer_stop(this->Timer);
  218. this->Finish();
  219. }
  220. }
  221. void cmProcess::OnAllocateCB(uv_handle_t* handle, size_t suggested_size,
  222. uv_buf_t* buf)
  223. {
  224. auto* self = static_cast<cmProcess*>(handle->data);
  225. self->OnAllocate(suggested_size, buf);
  226. }
  227. void cmProcess::OnAllocate(size_t /*suggested_size*/, uv_buf_t* buf)
  228. {
  229. if (this->Buf.size() != CM_PROCESS_BUF_SIZE) {
  230. this->Buf.resize(CM_PROCESS_BUF_SIZE);
  231. }
  232. *buf =
  233. uv_buf_init(this->Buf.data(), static_cast<unsigned int>(this->Buf.size()));
  234. }
  235. void cmProcess::OnTimeoutCB(uv_timer_t* timer)
  236. {
  237. auto* self = static_cast<cmProcess*>(timer->data);
  238. self->OnTimeout();
  239. }
  240. void cmProcess::OnTimeout()
  241. {
  242. bool const wasExecuting = this->ProcessState == cmProcess::State::Executing;
  243. this->ProcessState = cmProcess::State::Expired;
  244. // If the test process is still executing normally, and we timed out because
  245. // the test timeout was reached, send the custom timeout signal, if any.
  246. if (wasExecuting && this->TimeoutReason_ == TimeoutReason::Normal) {
  247. cmCTestTestHandler::cmCTestTestProperties* p =
  248. this->Runner->GetTestProperties();
  249. if (p->TimeoutSignal) {
  250. this->TerminationStyle = Termination::Custom;
  251. uv_process_kill(this->Process, p->TimeoutSignal->Number);
  252. if (p->TimeoutGracePeriod) {
  253. this->Timeout = *p->TimeoutGracePeriod;
  254. } else {
  255. static cmDuration const defaultGracePeriod{ 1.0 };
  256. this->Timeout = defaultGracePeriod;
  257. }
  258. this->StartTimer();
  259. return;
  260. }
  261. }
  262. this->TerminationStyle = Termination::Forced;
  263. bool const was_still_reading = !this->ReadHandleClosed;
  264. if (!this->ReadHandleClosed) {
  265. this->ReadHandleClosed = true;
  266. this->PipeReader.reset();
  267. }
  268. if (!this->ProcessHandleClosed) {
  269. // Kill the child and let our on-exit handler finish the test.
  270. cmsysProcess_KillPID(static_cast<unsigned long>(this->Process->pid));
  271. } else if (was_still_reading) {
  272. // Our on-exit handler already ran but did not finish the test
  273. // because we were still reading output. We've just dropped
  274. // our read handler, so we need to finish the test now.
  275. this->Finish();
  276. }
  277. }
  278. void cmProcess::OnExitCB(uv_process_t* process, int64_t exit_status,
  279. int term_signal)
  280. {
  281. auto* self = static_cast<cmProcess*>(process->data);
  282. self->OnExit(exit_status, term_signal);
  283. }
  284. void cmProcess::OnExit(int64_t exit_status, int term_signal)
  285. {
  286. if (this->ProcessState != cmProcess::State::Expired) {
  287. if (
  288. #if defined(_WIN32)
  289. ((DWORD)exit_status & 0xF0000000) == 0xC0000000
  290. #else
  291. term_signal != 0
  292. #endif
  293. ) {
  294. this->ProcessState = cmProcess::State::Exception;
  295. } else {
  296. this->ProcessState = cmProcess::State::Exited;
  297. }
  298. }
  299. // Record exit information.
  300. this->ExitValue = exit_status;
  301. this->Signal = term_signal;
  302. this->ProcessHandleClosed = true;
  303. if (this->ReadHandleClosed) {
  304. uv_timer_stop(this->Timer);
  305. this->Finish();
  306. }
  307. }
  308. void cmProcess::Finish()
  309. {
  310. this->TotalTime = std::chrono::steady_clock::now() - this->StartTime;
  311. // Because of a processor clock scew the runtime may become slightly
  312. // negative. If someone changed the system clock while the process was
  313. // running this may be even more. Make sure not to report a negative
  314. // duration here.
  315. if (this->TotalTime <= cmDuration::zero()) {
  316. this->TotalTime = cmDuration::zero();
  317. }
  318. this->Runner->FinalizeTest();
  319. }
  320. cmProcess::State cmProcess::GetProcessStatus()
  321. {
  322. return this->ProcessState;
  323. }
  324. void cmProcess::ChangeTimeout(cmDuration t)
  325. {
  326. this->Timeout = t;
  327. this->StartTimer();
  328. }
  329. void cmProcess::ResetStartTime()
  330. {
  331. this->StartTime = std::chrono::steady_clock::now();
  332. }
  333. cmProcess::Exception cmProcess::GetExitException() const
  334. {
  335. auto exception = Exception::None;
  336. #if defined(_WIN32) && !defined(__CYGWIN__)
  337. auto exit_code = (DWORD)this->ExitValue;
  338. if ((exit_code & 0xF0000000) != 0xC0000000) {
  339. return exception;
  340. }
  341. if (exit_code) {
  342. switch (exit_code) {
  343. case STATUS_DATATYPE_MISALIGNMENT:
  344. case STATUS_ACCESS_VIOLATION:
  345. case STATUS_IN_PAGE_ERROR:
  346. case STATUS_INVALID_HANDLE:
  347. case STATUS_NONCONTINUABLE_EXCEPTION:
  348. case STATUS_INVALID_DISPOSITION:
  349. case STATUS_ARRAY_BOUNDS_EXCEEDED:
  350. case STATUS_STACK_OVERFLOW:
  351. exception = Exception::Fault;
  352. break;
  353. case STATUS_FLOAT_DENORMAL_OPERAND:
  354. case STATUS_FLOAT_DIVIDE_BY_ZERO:
  355. case STATUS_FLOAT_INEXACT_RESULT:
  356. case STATUS_FLOAT_INVALID_OPERATION:
  357. case STATUS_FLOAT_OVERFLOW:
  358. case STATUS_FLOAT_STACK_CHECK:
  359. case STATUS_FLOAT_UNDERFLOW:
  360. # ifdef STATUS_FLOAT_MULTIPLE_FAULTS
  361. case STATUS_FLOAT_MULTIPLE_FAULTS:
  362. # endif
  363. # ifdef STATUS_FLOAT_MULTIPLE_TRAPS
  364. case STATUS_FLOAT_MULTIPLE_TRAPS:
  365. # endif
  366. case STATUS_INTEGER_DIVIDE_BY_ZERO:
  367. case STATUS_INTEGER_OVERFLOW:
  368. exception = Exception::Numerical;
  369. break;
  370. case STATUS_CONTROL_C_EXIT:
  371. exception = Exception::Interrupt;
  372. break;
  373. case STATUS_ILLEGAL_INSTRUCTION:
  374. case STATUS_PRIVILEGED_INSTRUCTION:
  375. exception = Exception::Illegal;
  376. break;
  377. default:
  378. exception = Exception::Other;
  379. }
  380. }
  381. #else
  382. if (this->Signal) {
  383. switch (this->Signal) {
  384. case SIGSEGV:
  385. exception = Exception::Fault;
  386. break;
  387. case SIGFPE:
  388. exception = Exception::Numerical;
  389. break;
  390. case SIGINT:
  391. exception = Exception::Interrupt;
  392. break;
  393. case SIGILL:
  394. exception = Exception::Illegal;
  395. break;
  396. default:
  397. exception = Exception::Other;
  398. }
  399. }
  400. #endif
  401. return exception;
  402. }
  403. std::string cmProcess::GetExitExceptionString() const
  404. {
  405. std::string exception_str;
  406. #if defined(_WIN32)
  407. switch (this->ExitValue) {
  408. case STATUS_CONTROL_C_EXIT:
  409. exception_str = "User interrupt";
  410. break;
  411. case STATUS_FLOAT_DENORMAL_OPERAND:
  412. exception_str = "Floating-point exception (denormal operand)";
  413. break;
  414. case STATUS_FLOAT_DIVIDE_BY_ZERO:
  415. exception_str = "Divide-by-zero";
  416. break;
  417. case STATUS_FLOAT_INEXACT_RESULT:
  418. exception_str = "Floating-point exception (inexact result)";
  419. break;
  420. case STATUS_FLOAT_INVALID_OPERATION:
  421. exception_str = "Invalid floating-point operation";
  422. break;
  423. case STATUS_FLOAT_OVERFLOW:
  424. exception_str = "Floating-point overflow";
  425. break;
  426. case STATUS_FLOAT_STACK_CHECK:
  427. exception_str = "Floating-point stack check failed";
  428. break;
  429. case STATUS_FLOAT_UNDERFLOW:
  430. exception_str = "Floating-point underflow";
  431. break;
  432. # ifdef STATUS_FLOAT_MULTIPLE_FAULTS
  433. case STATUS_FLOAT_MULTIPLE_FAULTS:
  434. exception_str = "Floating-point exception (multiple faults)";
  435. break;
  436. # endif
  437. # ifdef STATUS_FLOAT_MULTIPLE_TRAPS
  438. case STATUS_FLOAT_MULTIPLE_TRAPS:
  439. exception_str = "Floating-point exception (multiple traps)";
  440. break;
  441. # endif
  442. case STATUS_INTEGER_DIVIDE_BY_ZERO:
  443. exception_str = "Integer divide-by-zero";
  444. break;
  445. case STATUS_INTEGER_OVERFLOW:
  446. exception_str = "Integer overflow";
  447. break;
  448. case STATUS_DATATYPE_MISALIGNMENT:
  449. exception_str = "Datatype misalignment";
  450. break;
  451. case STATUS_ACCESS_VIOLATION:
  452. exception_str = "Access violation";
  453. break;
  454. case STATUS_IN_PAGE_ERROR:
  455. exception_str = "In-page error";
  456. break;
  457. case STATUS_INVALID_HANDLE:
  458. exception_str = "Invalid handle";
  459. break;
  460. case STATUS_NONCONTINUABLE_EXCEPTION:
  461. exception_str = "Noncontinuable exception";
  462. break;
  463. case STATUS_INVALID_DISPOSITION:
  464. exception_str = "Invalid disposition";
  465. break;
  466. case STATUS_ARRAY_BOUNDS_EXCEEDED:
  467. exception_str = "Array bounds exceeded";
  468. break;
  469. case STATUS_STACK_OVERFLOW:
  470. exception_str = "Stack overflow";
  471. break;
  472. case STATUS_ILLEGAL_INSTRUCTION:
  473. exception_str = "Illegal instruction";
  474. break;
  475. case STATUS_PRIVILEGED_INSTRUCTION:
  476. exception_str = "Privileged instruction";
  477. break;
  478. case STATUS_NO_MEMORY:
  479. default:
  480. char buf[1024];
  481. char const* fmt = "Exit code 0x%" KWIML_INT_PRIx64 "\n";
  482. snprintf(buf, sizeof(buf), fmt, this->ExitValue);
  483. exception_str.assign(buf);
  484. }
  485. #else
  486. switch (this->Signal) {
  487. # ifdef SIGSEGV
  488. case SIGSEGV:
  489. exception_str = "Segmentation fault";
  490. break;
  491. # endif
  492. # ifdef SIGBUS
  493. # if !defined(SIGSEGV) || SIGBUS != SIGSEGV
  494. case SIGBUS:
  495. exception_str = "Bus error";
  496. break;
  497. # endif
  498. # endif
  499. # ifdef SIGFPE
  500. case SIGFPE:
  501. exception_str = "Floating-point exception";
  502. break;
  503. # endif
  504. # ifdef SIGILL
  505. case SIGILL:
  506. exception_str = "Illegal instruction";
  507. break;
  508. # endif
  509. # ifdef SIGINT
  510. case SIGINT:
  511. exception_str = "User interrupt";
  512. break;
  513. # endif
  514. # ifdef SIGABRT
  515. case SIGABRT:
  516. exception_str = "Subprocess aborted";
  517. break;
  518. # endif
  519. # ifdef SIGKILL
  520. case SIGKILL:
  521. exception_str = "Subprocess killed";
  522. break;
  523. # endif
  524. # ifdef SIGTERM
  525. case SIGTERM:
  526. exception_str = "Subprocess terminated";
  527. break;
  528. # endif
  529. # ifdef SIGHUP
  530. case SIGHUP:
  531. exception_str = "SIGHUP";
  532. break;
  533. # endif
  534. # ifdef SIGQUIT
  535. case SIGQUIT:
  536. exception_str = "SIGQUIT";
  537. break;
  538. # endif
  539. # ifdef SIGTRAP
  540. case SIGTRAP:
  541. exception_str = "SIGTRAP";
  542. break;
  543. # endif
  544. # ifdef SIGIOT
  545. # if !defined(SIGABRT) || SIGIOT != SIGABRT
  546. case SIGIOT:
  547. exception_str = "SIGIOT";
  548. break;
  549. # endif
  550. # endif
  551. # ifdef SIGUSR1
  552. case SIGUSR1:
  553. exception_str = "SIGUSR1";
  554. break;
  555. # endif
  556. # ifdef SIGUSR2
  557. case SIGUSR2:
  558. exception_str = "SIGUSR2";
  559. break;
  560. # endif
  561. # ifdef SIGPIPE
  562. case SIGPIPE:
  563. exception_str = "SIGPIPE";
  564. break;
  565. # endif
  566. # ifdef SIGALRM
  567. case SIGALRM:
  568. exception_str = "SIGALRM";
  569. break;
  570. # endif
  571. # ifdef SIGSTKFLT
  572. case SIGSTKFLT:
  573. exception_str = "SIGSTKFLT";
  574. break;
  575. # endif
  576. # ifdef SIGCHLD
  577. case SIGCHLD:
  578. exception_str = "SIGCHLD";
  579. break;
  580. # elif defined(SIGCLD)
  581. case SIGCLD:
  582. exception_str = "SIGCLD";
  583. break;
  584. # endif
  585. # ifdef SIGCONT
  586. case SIGCONT:
  587. exception_str = "SIGCONT";
  588. break;
  589. # endif
  590. # ifdef SIGSTOP
  591. case SIGSTOP:
  592. exception_str = "SIGSTOP";
  593. break;
  594. # endif
  595. # ifdef SIGTSTP
  596. case SIGTSTP:
  597. exception_str = "SIGTSTP";
  598. break;
  599. # endif
  600. # ifdef SIGTTIN
  601. case SIGTTIN:
  602. exception_str = "SIGTTIN";
  603. break;
  604. # endif
  605. # ifdef SIGTTOU
  606. case SIGTTOU:
  607. exception_str = "SIGTTOU";
  608. break;
  609. # endif
  610. # ifdef SIGURG
  611. case SIGURG:
  612. exception_str = "SIGURG";
  613. break;
  614. # endif
  615. # ifdef SIGXCPU
  616. case SIGXCPU:
  617. exception_str = "SIGXCPU";
  618. break;
  619. # endif
  620. # ifdef SIGXFSZ
  621. case SIGXFSZ:
  622. exception_str = "SIGXFSZ";
  623. break;
  624. # endif
  625. # ifdef SIGVTALRM
  626. case SIGVTALRM:
  627. exception_str = "SIGVTALRM";
  628. break;
  629. # endif
  630. # ifdef SIGPROF
  631. case SIGPROF:
  632. exception_str = "SIGPROF";
  633. break;
  634. # endif
  635. # ifdef SIGWINCH
  636. case SIGWINCH:
  637. exception_str = "SIGWINCH";
  638. break;
  639. # endif
  640. # ifdef SIGPOLL
  641. case SIGPOLL:
  642. exception_str = "SIGPOLL";
  643. break;
  644. # endif
  645. # ifdef SIGIO
  646. # if !defined(SIGPOLL) || SIGIO != SIGPOLL
  647. case SIGIO:
  648. exception_str = "SIGIO";
  649. break;
  650. # endif
  651. # endif
  652. # ifdef SIGPWR
  653. case SIGPWR:
  654. exception_str = "SIGPWR";
  655. break;
  656. # endif
  657. # ifdef SIGSYS
  658. case SIGSYS:
  659. exception_str = "SIGSYS";
  660. break;
  661. # endif
  662. # ifdef SIGUNUSED
  663. # if !defined(SIGSYS) || SIGUNUSED != SIGSYS
  664. case SIGUNUSED:
  665. exception_str = "SIGUNUSED";
  666. break;
  667. # endif
  668. # endif
  669. default:
  670. exception_str = cmStrCat("Signal ", this->Signal);
  671. }
  672. #endif
  673. return exception_str;
  674. }