cmProcess.cxx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  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 <utility>
  8. #include <cmext/algorithm>
  9. #include "cmsys/Process.h"
  10. #include "cmCTest.h"
  11. #include "cmCTestRunTest.h"
  12. #include "cmCTestTestHandler.h"
  13. #include "cmGetPipes.h"
  14. #include "cmStringAlgorithms.h"
  15. #if defined(_WIN32)
  16. # include <cm3p/kwiml/int.h>
  17. #endif
  18. #define CM_PROCESS_BUF_SIZE 65536
  19. cmProcess::cmProcess(std::unique_ptr<cmCTestRunTest> runner)
  20. : Runner(std::move(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 = this->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->Finish();
  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. this->ProcessState = cmProcess::State::Expired;
  238. bool const was_still_reading = !this->ReadHandleClosed;
  239. if (!this->ReadHandleClosed) {
  240. this->ReadHandleClosed = true;
  241. this->PipeReader.reset();
  242. }
  243. if (!this->ProcessHandleClosed) {
  244. // Kill the child and let our on-exit handler finish the test.
  245. cmsysProcess_KillPID(static_cast<unsigned long>(this->Process->pid));
  246. } else if (was_still_reading) {
  247. // Our on-exit handler already ran but did not finish the test
  248. // because we were still reading output. We've just dropped
  249. // our read handler, so we need to finish the test now.
  250. this->Finish();
  251. }
  252. }
  253. void cmProcess::OnExitCB(uv_process_t* process, int64_t exit_status,
  254. int term_signal)
  255. {
  256. auto self = static_cast<cmProcess*>(process->data);
  257. self->OnExit(exit_status, term_signal);
  258. }
  259. void cmProcess::OnExit(int64_t exit_status, int term_signal)
  260. {
  261. if (this->ProcessState != cmProcess::State::Expired) {
  262. if (
  263. #if defined(_WIN32)
  264. ((DWORD)exit_status & 0xF0000000) == 0xC0000000
  265. #else
  266. term_signal != 0
  267. #endif
  268. ) {
  269. this->ProcessState = cmProcess::State::Exception;
  270. } else {
  271. this->ProcessState = cmProcess::State::Exited;
  272. }
  273. }
  274. // Record exit information.
  275. this->ExitValue = exit_status;
  276. this->Signal = term_signal;
  277. this->ProcessHandleClosed = true;
  278. if (this->ReadHandleClosed) {
  279. uv_timer_stop(this->Timer);
  280. this->Finish();
  281. }
  282. }
  283. void cmProcess::Finish()
  284. {
  285. this->TotalTime = std::chrono::steady_clock::now() - this->StartTime;
  286. // Because of a processor clock scew the runtime may become slightly
  287. // negative. If someone changed the system clock while the process was
  288. // running this may be even more. Make sure not to report a negative
  289. // duration here.
  290. if (this->TotalTime <= cmDuration::zero()) {
  291. this->TotalTime = cmDuration::zero();
  292. }
  293. this->Runner->FinalizeTest();
  294. }
  295. cmProcess::State cmProcess::GetProcessStatus()
  296. {
  297. return this->ProcessState;
  298. }
  299. void cmProcess::ChangeTimeout(cmDuration t)
  300. {
  301. this->Timeout = t;
  302. this->StartTimer();
  303. }
  304. void cmProcess::ResetStartTime()
  305. {
  306. this->StartTime = std::chrono::steady_clock::now();
  307. }
  308. cmProcess::Exception cmProcess::GetExitException()
  309. {
  310. auto exception = Exception::None;
  311. #if defined(_WIN32) && !defined(__CYGWIN__)
  312. auto exit_code = (DWORD)this->ExitValue;
  313. if ((exit_code & 0xF0000000) != 0xC0000000) {
  314. return exception;
  315. }
  316. if (exit_code) {
  317. switch (exit_code) {
  318. case STATUS_DATATYPE_MISALIGNMENT:
  319. case STATUS_ACCESS_VIOLATION:
  320. case STATUS_IN_PAGE_ERROR:
  321. case STATUS_INVALID_HANDLE:
  322. case STATUS_NONCONTINUABLE_EXCEPTION:
  323. case STATUS_INVALID_DISPOSITION:
  324. case STATUS_ARRAY_BOUNDS_EXCEEDED:
  325. case STATUS_STACK_OVERFLOW:
  326. exception = Exception::Fault;
  327. break;
  328. case STATUS_FLOAT_DENORMAL_OPERAND:
  329. case STATUS_FLOAT_DIVIDE_BY_ZERO:
  330. case STATUS_FLOAT_INEXACT_RESULT:
  331. case STATUS_FLOAT_INVALID_OPERATION:
  332. case STATUS_FLOAT_OVERFLOW:
  333. case STATUS_FLOAT_STACK_CHECK:
  334. case STATUS_FLOAT_UNDERFLOW:
  335. # ifdef STATUS_FLOAT_MULTIPLE_FAULTS
  336. case STATUS_FLOAT_MULTIPLE_FAULTS:
  337. # endif
  338. # ifdef STATUS_FLOAT_MULTIPLE_TRAPS
  339. case STATUS_FLOAT_MULTIPLE_TRAPS:
  340. # endif
  341. case STATUS_INTEGER_DIVIDE_BY_ZERO:
  342. case STATUS_INTEGER_OVERFLOW:
  343. exception = Exception::Numerical;
  344. break;
  345. case STATUS_CONTROL_C_EXIT:
  346. exception = Exception::Interrupt;
  347. break;
  348. case STATUS_ILLEGAL_INSTRUCTION:
  349. case STATUS_PRIVILEGED_INSTRUCTION:
  350. exception = Exception::Illegal;
  351. break;
  352. default:
  353. exception = Exception::Other;
  354. }
  355. }
  356. #else
  357. if (this->Signal) {
  358. switch (this->Signal) {
  359. case SIGSEGV:
  360. exception = Exception::Fault;
  361. break;
  362. case SIGFPE:
  363. exception = Exception::Numerical;
  364. break;
  365. case SIGINT:
  366. exception = Exception::Interrupt;
  367. break;
  368. case SIGILL:
  369. exception = Exception::Illegal;
  370. break;
  371. default:
  372. exception = Exception::Other;
  373. }
  374. }
  375. #endif
  376. return exception;
  377. }
  378. std::string cmProcess::GetExitExceptionString()
  379. {
  380. std::string exception_str;
  381. #if defined(_WIN32)
  382. switch (this->ExitValue) {
  383. case STATUS_CONTROL_C_EXIT:
  384. exception_str = "User interrupt";
  385. break;
  386. case STATUS_FLOAT_DENORMAL_OPERAND:
  387. exception_str = "Floating-point exception (denormal operand)";
  388. break;
  389. case STATUS_FLOAT_DIVIDE_BY_ZERO:
  390. exception_str = "Divide-by-zero";
  391. break;
  392. case STATUS_FLOAT_INEXACT_RESULT:
  393. exception_str = "Floating-point exception (inexact result)";
  394. break;
  395. case STATUS_FLOAT_INVALID_OPERATION:
  396. exception_str = "Invalid floating-point operation";
  397. break;
  398. case STATUS_FLOAT_OVERFLOW:
  399. exception_str = "Floating-point overflow";
  400. break;
  401. case STATUS_FLOAT_STACK_CHECK:
  402. exception_str = "Floating-point stack check failed";
  403. break;
  404. case STATUS_FLOAT_UNDERFLOW:
  405. exception_str = "Floating-point underflow";
  406. break;
  407. # ifdef STATUS_FLOAT_MULTIPLE_FAULTS
  408. case STATUS_FLOAT_MULTIPLE_FAULTS:
  409. exception_str = "Floating-point exception (multiple faults)";
  410. break;
  411. # endif
  412. # ifdef STATUS_FLOAT_MULTIPLE_TRAPS
  413. case STATUS_FLOAT_MULTIPLE_TRAPS:
  414. exception_str = "Floating-point exception (multiple traps)";
  415. break;
  416. # endif
  417. case STATUS_INTEGER_DIVIDE_BY_ZERO:
  418. exception_str = "Integer divide-by-zero";
  419. break;
  420. case STATUS_INTEGER_OVERFLOW:
  421. exception_str = "Integer overflow";
  422. break;
  423. case STATUS_DATATYPE_MISALIGNMENT:
  424. exception_str = "Datatype misalignment";
  425. break;
  426. case STATUS_ACCESS_VIOLATION:
  427. exception_str = "Access violation";
  428. break;
  429. case STATUS_IN_PAGE_ERROR:
  430. exception_str = "In-page error";
  431. break;
  432. case STATUS_INVALID_HANDLE:
  433. exception_str = "Invalid handle";
  434. break;
  435. case STATUS_NONCONTINUABLE_EXCEPTION:
  436. exception_str = "Noncontinuable exception";
  437. break;
  438. case STATUS_INVALID_DISPOSITION:
  439. exception_str = "Invalid disposition";
  440. break;
  441. case STATUS_ARRAY_BOUNDS_EXCEEDED:
  442. exception_str = "Array bounds exceeded";
  443. break;
  444. case STATUS_STACK_OVERFLOW:
  445. exception_str = "Stack overflow";
  446. break;
  447. case STATUS_ILLEGAL_INSTRUCTION:
  448. exception_str = "Illegal instruction";
  449. break;
  450. case STATUS_PRIVILEGED_INSTRUCTION:
  451. exception_str = "Privileged instruction";
  452. break;
  453. case STATUS_NO_MEMORY:
  454. default:
  455. char buf[1024];
  456. const char* fmt = "Exit code 0x%" KWIML_INT_PRIx64 "\n";
  457. _snprintf(buf, 1024, fmt, this->ExitValue);
  458. exception_str.assign(buf);
  459. }
  460. #else
  461. switch (this->Signal) {
  462. # ifdef SIGSEGV
  463. case SIGSEGV:
  464. exception_str = "Segmentation fault";
  465. break;
  466. # endif
  467. # ifdef SIGBUS
  468. # if !defined(SIGSEGV) || SIGBUS != SIGSEGV
  469. case SIGBUS:
  470. exception_str = "Bus error";
  471. break;
  472. # endif
  473. # endif
  474. # ifdef SIGFPE
  475. case SIGFPE:
  476. exception_str = "Floating-point exception";
  477. break;
  478. # endif
  479. # ifdef SIGILL
  480. case SIGILL:
  481. exception_str = "Illegal instruction";
  482. break;
  483. # endif
  484. # ifdef SIGINT
  485. case SIGINT:
  486. exception_str = "User interrupt";
  487. break;
  488. # endif
  489. # ifdef SIGABRT
  490. case SIGABRT:
  491. exception_str = "Subprocess aborted";
  492. break;
  493. # endif
  494. # ifdef SIGKILL
  495. case SIGKILL:
  496. exception_str = "Subprocess killed";
  497. break;
  498. # endif
  499. # ifdef SIGTERM
  500. case SIGTERM:
  501. exception_str = "Subprocess terminated";
  502. break;
  503. # endif
  504. # ifdef SIGHUP
  505. case SIGHUP:
  506. exception_str = "SIGHUP";
  507. break;
  508. # endif
  509. # ifdef SIGQUIT
  510. case SIGQUIT:
  511. exception_str = "SIGQUIT";
  512. break;
  513. # endif
  514. # ifdef SIGTRAP
  515. case SIGTRAP:
  516. exception_str = "SIGTRAP";
  517. break;
  518. # endif
  519. # ifdef SIGIOT
  520. # if !defined(SIGABRT) || SIGIOT != SIGABRT
  521. case SIGIOT:
  522. exception_str = "SIGIOT";
  523. break;
  524. # endif
  525. # endif
  526. # ifdef SIGUSR1
  527. case SIGUSR1:
  528. exception_str = "SIGUSR1";
  529. break;
  530. # endif
  531. # ifdef SIGUSR2
  532. case SIGUSR2:
  533. exception_str = "SIGUSR2";
  534. break;
  535. # endif
  536. # ifdef SIGPIPE
  537. case SIGPIPE:
  538. exception_str = "SIGPIPE";
  539. break;
  540. # endif
  541. # ifdef SIGALRM
  542. case SIGALRM:
  543. exception_str = "SIGALRM";
  544. break;
  545. # endif
  546. # ifdef SIGSTKFLT
  547. case SIGSTKFLT:
  548. exception_str = "SIGSTKFLT";
  549. break;
  550. # endif
  551. # ifdef SIGCHLD
  552. case SIGCHLD:
  553. exception_str = "SIGCHLD";
  554. break;
  555. # elif defined(SIGCLD)
  556. case SIGCLD:
  557. exception_str = "SIGCLD";
  558. break;
  559. # endif
  560. # ifdef SIGCONT
  561. case SIGCONT:
  562. exception_str = "SIGCONT";
  563. break;
  564. # endif
  565. # ifdef SIGSTOP
  566. case SIGSTOP:
  567. exception_str = "SIGSTOP";
  568. break;
  569. # endif
  570. # ifdef SIGTSTP
  571. case SIGTSTP:
  572. exception_str = "SIGTSTP";
  573. break;
  574. # endif
  575. # ifdef SIGTTIN
  576. case SIGTTIN:
  577. exception_str = "SIGTTIN";
  578. break;
  579. # endif
  580. # ifdef SIGTTOU
  581. case SIGTTOU:
  582. exception_str = "SIGTTOU";
  583. break;
  584. # endif
  585. # ifdef SIGURG
  586. case SIGURG:
  587. exception_str = "SIGURG";
  588. break;
  589. # endif
  590. # ifdef SIGXCPU
  591. case SIGXCPU:
  592. exception_str = "SIGXCPU";
  593. break;
  594. # endif
  595. # ifdef SIGXFSZ
  596. case SIGXFSZ:
  597. exception_str = "SIGXFSZ";
  598. break;
  599. # endif
  600. # ifdef SIGVTALRM
  601. case SIGVTALRM:
  602. exception_str = "SIGVTALRM";
  603. break;
  604. # endif
  605. # ifdef SIGPROF
  606. case SIGPROF:
  607. exception_str = "SIGPROF";
  608. break;
  609. # endif
  610. # ifdef SIGWINCH
  611. case SIGWINCH:
  612. exception_str = "SIGWINCH";
  613. break;
  614. # endif
  615. # ifdef SIGPOLL
  616. case SIGPOLL:
  617. exception_str = "SIGPOLL";
  618. break;
  619. # endif
  620. # ifdef SIGIO
  621. # if !defined(SIGPOLL) || SIGIO != SIGPOLL
  622. case SIGIO:
  623. exception_str = "SIGIO";
  624. break;
  625. # endif
  626. # endif
  627. # ifdef SIGPWR
  628. case SIGPWR:
  629. exception_str = "SIGPWR";
  630. break;
  631. # endif
  632. # ifdef SIGSYS
  633. case SIGSYS:
  634. exception_str = "SIGSYS";
  635. break;
  636. # endif
  637. # ifdef SIGUNUSED
  638. # if !defined(SIGSYS) || SIGUNUSED != SIGSYS
  639. case SIGUNUSED:
  640. exception_str = "SIGUNUSED";
  641. break;
  642. # endif
  643. # endif
  644. default:
  645. exception_str = cmStrCat("Signal ", this->Signal);
  646. }
  647. #endif
  648. return exception_str;
  649. }