comparison src/process.c @ 4639:76f242eb1fa8

Include syswait.h. (wait_reading_process_input): Exit without waiting if wait_for_cell is already non-nil.
author Richard M. Stallman <rms@gnu.org>
date Sun, 15 Aug 1993 03:52:43 +0000
parents 4055472194b5
children c4d471244116
comparison
equal deleted inserted replaced
4638:3872f91770fc 4639:76f242eb1fa8
102 #define SIGCHLD SIGCLD 102 #define SIGCHLD SIGCLD
103 #endif /* SIGCLD */ 103 #endif /* SIGCLD */
104 104
105 #include "syssignal.h" 105 #include "syssignal.h"
106 106
107 /* Define the structure that the wait system call stores. 107 #include "syswait.h"
108 On many systems, there is a structure defined for this.
109 But on vanilla-ish USG systems there is not. */
110
111 #ifndef VMS
112 #ifndef WAITTYPE
113 #if (!defined (BSD) && !defined (UNIPLUS) && !defined (STRIDE) && !(defined (HPUX) && !defined (NOMULTIPLEJOBS)) && !defined (HAVE_WAIT_HEADER)) || defined (LINUX)
114 #define WAITTYPE int
115 #define WIFSTOPPED(w) ((w&0377) == 0177)
116 #define WIFSIGNALED(w) ((w&0377) != 0177 && (w&~0377) == 0)
117 #define WIFEXITED(w) ((w&0377) == 0)
118 #define WRETCODE(w) (w >> 8)
119 #define WSTOPSIG(w) (w >> 8)
120 #define WTERMSIG(w) (w & 0377)
121 #ifndef WCOREDUMP
122 #define WCOREDUMP(w) ((w&0200) != 0)
123 #endif
124 #else
125 #ifdef BSD4_1
126 #include <wait.h>
127 #else
128 #include <sys/wait.h>
129 #endif /* not BSD 4.1 */
130
131 #define WAITTYPE union wait
132 #define WRETCODE(w) w.w_retcode
133 #define WCOREDUMP(w) w.w_coredump
134
135 #ifdef HPUX
136 /* HPUX version 7 has broken definitions of these. */
137 #undef WTERMSIG
138 #undef WSTOPSIG
139 #undef WIFSTOPPED
140 #undef WIFSIGNALED
141 #undef WIFEXITED
142 #endif
143
144 #ifndef WTERMSIG
145 #define WTERMSIG(w) w.w_termsig
146 #endif
147 #ifndef WSTOPSIG
148 #define WSTOPSIG(w) w.w_stopsig
149 #endif
150 #ifndef WIFSTOPPED
151 #define WIFSTOPPED(w) (WTERMSIG (w) == 0177)
152 #endif
153 #ifndef WIFSIGNALED
154 #define WIFSIGNALED(w) (WTERMSIG (w) != 0177 && (WSTOPSIG (w)) == 0)
155 #endif
156 #ifndef WIFEXITED
157 #define WIFEXITED(w) (WTERMSIG (w) == 0)
158 #endif
159 #endif /* BSD or UNIPLUS or STRIDE */
160 #endif /* no WAITTYPE */
161 #else /* VMS */
162 #define WAITTYPE int
163 #define WIFSTOPPED(w) 0
164 #define WIFSIGNALED(w) 0
165 #define WIFEXITED(w) ((w) != -1)
166 #define WRETCODE(w) (w)
167 #define WSTOPSIG(w) (w)
168 #define WCOREDUMP(w) 0
169 #define WTERMSIG(w) (w)
170 #include <ssdef.h>
171 #include <iodef.h>
172 #include <clidef.h>
173 #include "vmsproc.h"
174 #endif /* VMS */
175 108
176 extern errno; 109 extern errno;
177 extern sys_nerr; 110 extern sys_nerr;
178 extern char *sys_errlist[]; 111 extern char *sys_errlist[];
179 112
1748 /* If calling from keyboard input, do not quit 1681 /* If calling from keyboard input, do not quit
1749 since we want to return C-g as an input character. 1682 since we want to return C-g as an input character.
1750 Otherwise, do pending quit if requested. */ 1683 Otherwise, do pending quit if requested. */
1751 if (XINT (read_kbd) >= 0) 1684 if (XINT (read_kbd) >= 0)
1752 QUIT; 1685 QUIT;
1686
1687 /* Exit now if the cell we're waiting for became non-nil. */
1688 if (wait_for_cell && ! NILP (*wait_for_cell))
1689 break;
1753 1690
1754 /* Compute time from now till when time limit is up */ 1691 /* Compute time from now till when time limit is up */
1755 /* Exit if already run out */ 1692 /* Exit if already run out */
1756 if (time_limit == -1) 1693 if (time_limit == -1)
1757 { 1694 {