Raymond Toy pushed to branch rtoy-fix-issue-41 at cmucl / cmucl
Commits:
-
65ce358d
by Raymond Toy at 2017-09-15T22:50:47-07:00
2 changed files:
Changes:
| ... | ... | @@ -85,7 +85,7 @@ |
| 85 | 85 |
(declare (ignore ret))
|
| 86 | 86 |
(when (plusp pid)
|
| 87 | 87 |
(values pid
|
| 88 |
- (aref #(nil :signaled :stopped :continued :exited) what)
|
|
| 88 |
+ (aref #(:signaled :stopped :continued :exited) what)
|
|
| 89 | 89 |
code
|
| 90 | 90 |
(not (zerop corep))))))
|
| 91 | 91 |
|
| ... | ... | @@ -217,7 +217,8 @@ |
| 217 | 217 |
(declare (type process proc))
|
| 218 | 218 |
(let ((status (process-status proc)))
|
| 219 | 219 |
(if (or (eq status :running)
|
| 220 |
- (eq status :stopped))
|
|
| 220 |
+ (eq status :stopped)
|
|
| 221 |
+ (eq status :continued))
|
|
| 221 | 222 |
t
|
| 222 | 223 |
nil)))
|
| 223 | 224 |
|
| ... | ... | @@ -3,6 +3,8 @@ |
| 3 | 3 |
*
|
| 4 | 4 |
*/
|
| 5 | 5 |
|
| 6 |
+#include <stdio.h>
|
|
| 7 |
+ |
|
| 6 | 8 |
#include <sys/ioctl.h>
|
| 7 | 9 |
#include <errno.h>
|
| 8 | 10 |
#include <fcntl.h>
|
| ... | ... | @@ -85,6 +87,17 @@ spawn(char *program, char *argv[], char *envp[], char *pty_name, |
| 85 | 87 |
* core - true (non-zero) if a core was produced
|
| 86 | 88 |
*/
|
| 87 | 89 |
|
| 90 |
+/*
|
|
| 91 |
+ * Status codes. Must be in the same order as in ext::prog-status in
|
|
| 92 |
+ * run-program.lisp
|
|
| 93 |
+ */
|
|
| 94 |
+enum status_code {
|
|
| 95 |
+ SIGNALED,
|
|
| 96 |
+ STOPPED,
|
|
| 97 |
+ CONTINUED,
|
|
| 98 |
+ EXITED
|
|
| 99 |
+};
|
|
| 100 |
+
|
|
| 88 | 101 |
void
|
| 89 | 102 |
prog_status(pid_t* pid, int* what, int* code, int* corep)
|
| 90 | 103 |
{
|
| ... | ... | @@ -100,21 +113,23 @@ prog_status(pid_t* pid, int* what, int* code, int* corep) |
| 100 | 113 |
}
|
| 101 | 114 |
|
| 102 | 115 |
if (WIFEXITED(status)) {
|
| 103 |
- *what = 4;
|
|
| 116 |
+ *what = EXITED;
|
|
| 104 | 117 |
*code = WEXITSTATUS(status);
|
| 105 | 118 |
*corep = 0;
|
| 106 | 119 |
} else if (WIFSIGNALED(status)) {
|
| 107 |
- *what = 1;
|
|
| 120 |
+ *what = SIGNALED;
|
|
| 108 | 121 |
*code = WTERMSIG(status);
|
| 109 | 122 |
*corep = WCOREDUMP(status);
|
| 110 | 123 |
} else if (WIFSTOPPED(status)) {
|
| 111 |
- *what = 2;
|
|
| 124 |
+ *what = STOPPED;
|
|
| 112 | 125 |
*code = WSTOPSIG(status);
|
| 113 | 126 |
*corep = 0;
|
| 114 | 127 |
} else if (WIFCONTINUED(status)) {
|
| 115 |
- *what = 3;
|
|
| 128 |
+ *what = CONTINUED;
|
|
| 116 | 129 |
*code = 0;
|
| 117 | 130 |
*corep = 0;
|
| 131 |
+ } else {
|
|
| 132 |
+ fprintf(stderr, "pid = %d, status = 0x%x\n", *pid, status);
|
|
| 118 | 133 |
}
|
| 119 | 134 |
|
| 120 | 135 |
return;
|