зеркало из https://github.com/github/ruby.git
* process.c (retry_fork): call after_fork except in a child process.
(rb_fork_internal): restrict after_fork call condition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d9f3198dd9
Коммит
8fdd48d69f
|
@ -1,3 +1,8 @@
|
|||
Sun Jun 10 15:49:47 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* process.c (retry_fork): call after_fork except in a child process.
|
||||
(rb_fork_internal): restrict after_fork call condition.
|
||||
|
||||
Sun Jun 10 14:19:33 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* configure.in: NetBSD 6 adds libexecinfo but it only works on amd64.
|
||||
|
|
17
process.c
17
process.c
|
@ -2805,10 +2805,13 @@ retry_fork(int *status, int *ep, int chfunc_is_async_signal_safe)
|
|||
if (!chfunc_is_async_signal_safe)
|
||||
before_fork();
|
||||
pid = fork();
|
||||
if (0 <= pid)
|
||||
break;
|
||||
if (pid == 0) /* fork succeed, child process */
|
||||
return pid;
|
||||
if (!chfunc_is_async_signal_safe)
|
||||
after_fork();
|
||||
preserving_errno(after_fork());
|
||||
if (0 < pid) /* fork succeed, parent process */
|
||||
return pid;
|
||||
/* fork failed */
|
||||
switch (errno) {
|
||||
case EAGAIN:
|
||||
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
|
||||
|
@ -2832,7 +2835,6 @@ retry_fork(int *status, int *ep, int chfunc_is_async_signal_safe)
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
return pid;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2913,9 +2915,10 @@ rb_fork_internal(int *status, int (*chfunc)(void*, char *, size_t), void *charg,
|
|||
pid = retry_fork(status, NULL, FALSE);
|
||||
if (pid < 0)
|
||||
return pid;
|
||||
if (!pid)
|
||||
if (!pid) {
|
||||
forked_child = 1;
|
||||
after_fork();
|
||||
after_fork();
|
||||
}
|
||||
return pid;
|
||||
}
|
||||
else {
|
||||
|
@ -2949,8 +2952,6 @@ rb_fork_internal(int *status, int (*chfunc)(void*, char *, size_t), void *charg,
|
|||
_exit(127);
|
||||
#endif
|
||||
}
|
||||
if (!chfunc_is_async_signal_safe)
|
||||
after_fork();
|
||||
close(ep[1]);
|
||||
error_occured = recv_child_error(ep[0], &state, &exc, &err, errmsg, errmsg_buflen, chfunc_is_async_signal_safe);
|
||||
if (state || error_occured) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче