comparison src/ntproc.c @ 223:2c611d1463a6 r20-4b10

Import from CVS: tag r20-4b10
author cvs
date Mon, 13 Aug 2007 10:10:54 +0200
parents 41ff10fd062f
children 41f2f0e326e9
comparison
equal deleted inserted replaced
222:aae4c8b01452 223:2c611d1463a6
43 43
44 #include "lisp.h" 44 #include "lisp.h"
45 #include "nt.h" 45 #include "nt.h"
46 #include "ntheap.h" /* From 19.34.6 */ 46 #include "ntheap.h" /* From 19.34.6 */
47 #include "systime.h" 47 #include "systime.h"
48 #include "syssignal.h"
48 #include "syswait.h" 49 #include "syswait.h"
49 #include "process.h" 50 #include "process.h"
50 /*#include "w32term.h"*/ /* From 19.34.6: sync in ? --marcpa */ 51 /*#include "w32term.h"*/ /* From 19.34.6: sync in ? --marcpa */
51 52
52 /* Control whether spawnve quotes arguments as necessary to ensure 53 /* Control whether spawnve quotes arguments as necessary to ensure
103 va_end (args); 104 va_end (args);
104 OutputDebugString (buf); 105 OutputDebugString (buf);
105 } 106 }
106 #endif 107 #endif
107 108
108 typedef void (_CALLBACK_ *signal_handler)(int); 109 /* sys_signal moved to nt.c. It's now called msw_signal... */
109
110 /* Signal handlers...SIG_DFL == 0 so this is initialized correctly. */
111 static signal_handler sig_handlers[NSIG];
112
113 /* Fake signal implementation to record the SIGCHLD handler. */
114 signal_handler
115 sys_signal (int sig, signal_handler handler)
116 {
117 signal_handler old;
118
119 if (sig != SIGCHLD)
120 {
121 errno = EINVAL;
122 return SIG_ERR;
123 }
124 old = sig_handlers[sig];
125 sig_handlers[sig] = handler;
126 return old;
127 }
128 110
129 /* Defined in <process.h> which conflicts with the local copy */ 111 /* Defined in <process.h> which conflicts with the local copy */
130 #define _P_NOWAIT 1 112 #define _P_NOWAIT 1
131 113
132 /* Child process management list. */ 114 /* Child process management list. */
1203 SIGCHLD until we do. */ 1185 SIGCHLD until we do. */
1204 1186
1205 if (cp->fd >= 0 && (fd_info[cp->fd].flags & FILE_AT_EOF) == 0) 1187 if (cp->fd >= 0 && (fd_info[cp->fd].flags & FILE_AT_EOF) == 0)
1206 fd_info[cp->fd].flags |= FILE_SEND_SIGCHLD; 1188 fd_info[cp->fd].flags |= FILE_SEND_SIGCHLD;
1207 /* SIG_DFL for SIGCHLD is ignore */ 1189 /* SIG_DFL for SIGCHLD is ignore */
1208 else if (sig_handlers[SIGCHLD] != SIG_DFL && 1190 else
1209 sig_handlers[SIGCHLD] != SIG_IGN) 1191 {
1210 {
1211 #ifdef FULL_DEBUG 1192 #ifdef FULL_DEBUG
1212 DebPrint (("select calling SIGCHLD handler for pid %d\n", 1193 DebPrint (("select is raising SIGCHLD handler for pid %d\n",
1213 cp->pid)); 1194 cp->pid));
1214 #endif 1195 #endif
1215 dead_child = cp; 1196 dead_child = cp;
1216 sig_handlers[SIGCHLD] (SIGCHLD); 1197 msw_raise (SIGCHLD);
1217 dead_child = NULL; 1198 dead_child = NULL;
1218 } 1199 }
1219 } 1200 }
1220 else if (fdindex[active] == 0) 1201 else if (fdindex[active] == 0)
1221 { 1202 {
1222 /* Keyboard input available */ 1203 /* Keyboard input available */
1223 FD_SET (0, rfds); 1204 FD_SET (0, rfds);
1224 nr++; 1205 nr++;