cmProcess.cxx 17 KB

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