diff options
| author | Gerd Moellmann | 2001-09-20 11:44:26 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-09-20 11:44:26 +0000 |
| commit | 3fed8ad5b94dc8a362a545cd393a5c471b7722cd (patch) | |
| tree | 8e65d6703af92b25b9b7ca863164e18f8d51ea18 /src/process.c | |
| parent | db92b288420f8528cdb62a3d78052c1deb4504a8 (diff) | |
| download | emacs-3fed8ad5b94dc8a362a545cd393a5c471b7722cd.tar.gz emacs-3fed8ad5b94dc8a362a545cd393a5c471b7722cd.zip | |
(sigchld_handler): Use GC_CONSP, GC_INTEGERP, GC_EQ
since this function can be called during GC.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/src/process.c b/src/process.c index d23c4e169d5..58daaf75d6a 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -4086,7 +4086,7 @@ text to PROCESS after you call this function.") | |||
| 4086 | } | 4086 | } |
| 4087 | 4087 | ||
| 4088 | /* Kill all processes associated with `buffer'. | 4088 | /* Kill all processes associated with `buffer'. |
| 4089 | If `buffer' is nil, kill all processes */ | 4089 | If `buffer' is nil, kill all processes */ |
| 4090 | 4090 | ||
| 4091 | void | 4091 | void |
| 4092 | kill_buffer_processes (buffer) | 4092 | kill_buffer_processes (buffer) |
| @@ -4108,26 +4108,27 @@ kill_buffer_processes (buffer) | |||
| 4108 | } | 4108 | } |
| 4109 | } | 4109 | } |
| 4110 | 4110 | ||
| 4111 | /* On receipt of a signal that a child status has changed, | 4111 | /* On receipt of a signal that a child status has changed, loop asking |
| 4112 | loop asking about children with changed statuses until | 4112 | about children with changed statuses until the system says there |
| 4113 | the system says there are no more. | 4113 | are no more. |
| 4114 | All we do is change the status; | 4114 | |
| 4115 | we do not run sentinels or print notifications. | 4115 | All we do is change the status; we do not run sentinels or print |
| 4116 | That is saved for the next time keyboard input is done, | 4116 | notifications. That is saved for the next time keyboard input is |
| 4117 | in order to avoid timing errors. */ | 4117 | done, in order to avoid timing errors. |
| 4118 | 4118 | ||
| 4119 | /** WARNING: this can be called during garbage collection. | 4119 | ** WARNING: this can be called during garbage collection. |
| 4120 | Therefore, it must not be fooled by the presence of mark bits in | 4120 | Therefore, it must not be fooled by the presence of mark bits in |
| 4121 | Lisp objects. */ | 4121 | Lisp objects. |
| 4122 | 4122 | ||
| 4123 | /** USG WARNING: Although it is not obvious from the documentation | 4123 | ** USG WARNING: Although it is not obvious from the documentation |
| 4124 | in signal(2), on a USG system the SIGCLD handler MUST NOT call | 4124 | in signal(2), on a USG system the SIGCLD handler MUST NOT call |
| 4125 | signal() before executing at least one wait(), otherwise the handler | 4125 | signal() before executing at least one wait(), otherwise the |
| 4126 | will be called again, resulting in an infinite loop. The relevant | 4126 | handler will be called again, resulting in an infinite loop. The |
| 4127 | portion of the documentation reads "SIGCLD signals will be queued | 4127 | relevant portion of the documentation reads "SIGCLD signals will be |
| 4128 | and the signal-catching function will be continually reentered until | 4128 | queued and the signal-catching function will be continually |
| 4129 | the queue is empty". Invoking signal() causes the kernel to reexamine | 4129 | reentered until the queue is empty". Invoking signal() causes the |
| 4130 | the SIGCLD queue. Fred Fish, UniSoft Systems Inc. */ | 4130 | kernel to reexamine the SIGCLD queue. Fred Fish, UniSoft Systems |
| 4131 | Inc. */ | ||
| 4131 | 4132 | ||
| 4132 | SIGTYPE | 4133 | SIGTYPE |
| 4133 | sigchld_handler (signo) | 4134 | sigchld_handler (signo) |
| @@ -4159,11 +4160,12 @@ sigchld_handler (signo) | |||
| 4159 | errno = 0; | 4160 | errno = 0; |
| 4160 | pid = wait3 (&w, WNOHANG | WUNTRACED, 0); | 4161 | pid = wait3 (&w, WNOHANG | WUNTRACED, 0); |
| 4161 | } | 4162 | } |
| 4162 | while (pid <= 0 && errno == EINTR); | 4163 | while (pid < 0 && errno == EINTR); |
| 4163 | 4164 | ||
| 4164 | if (pid <= 0) | 4165 | if (pid <= 0) |
| 4165 | { | 4166 | { |
| 4166 | /* A real failure. We have done all our job, so return. */ | 4167 | /* PID == 0 means no processes found, PID == -1 means a real |
| 4168 | failure. We have done all our job, so return. */ | ||
| 4167 | 4169 | ||
| 4168 | /* USG systems forget handlers when they are used; | 4170 | /* USG systems forget handlers when they are used; |
| 4169 | must reestablish each time */ | 4171 | must reestablish each time */ |
| @@ -4184,11 +4186,11 @@ sigchld_handler (signo) | |||
| 4184 | /* Find the process that signaled us, and record its status. */ | 4186 | /* Find the process that signaled us, and record its status. */ |
| 4185 | 4187 | ||
| 4186 | p = 0; | 4188 | p = 0; |
| 4187 | for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) | 4189 | for (tail = Vprocess_alist; GC_CONSP (tail); tail = XCDR (tail)) |
| 4188 | { | 4190 | { |
| 4189 | proc = XCDR (XCAR (tail)); | 4191 | proc = XCDR (XCAR (tail)); |
| 4190 | p = XPROCESS (proc); | 4192 | p = XPROCESS (proc); |
| 4191 | if (EQ (p->childp, Qt) && XFASTINT (p->pid) == pid) | 4193 | if (GC_EQ (p->childp, Qt) && XINT (p->pid) == pid) |
| 4192 | break; | 4194 | break; |
| 4193 | p = 0; | 4195 | p = 0; |
| 4194 | } | 4196 | } |
| @@ -4196,11 +4198,11 @@ sigchld_handler (signo) | |||
| 4196 | /* Look for an asynchronous process whose pid hasn't been filled | 4198 | /* Look for an asynchronous process whose pid hasn't been filled |
| 4197 | in yet. */ | 4199 | in yet. */ |
| 4198 | if (p == 0) | 4200 | if (p == 0) |
| 4199 | for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) | 4201 | for (tail = Vprocess_alist; GC_CONSP (tail); tail = XCDR (tail)) |
| 4200 | { | 4202 | { |
| 4201 | proc = XCDR (XCAR (tail)); | 4203 | proc = XCDR (XCAR (tail)); |
| 4202 | p = XPROCESS (proc); | 4204 | p = XPROCESS (proc); |
| 4203 | if (INTEGERP (p->pid) && XINT (p->pid) == -1) | 4205 | if (GC_INTEGERP (p->pid) && XINT (p->pid) == -1) |
| 4204 | break; | 4206 | break; |
| 4205 | p = 0; | 4207 | p = 0; |
| 4206 | } | 4208 | } |