Bug #3278 » bug2739-kfreebsd.patch
process.c (作業コピー) | ||
---|---|---|
fflush(stderr);
|
||
#endif
|
||
#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
|
||
before_exec();
|
||
#endif
|
||
pid = fork();
|
||
#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
|
||
after_exec();
|
||
#endif
|
||
switch (pid) {
|
||
case 0:
|
||
#ifdef linux
|
||
... | ... | |
chfunc = signal(SIGCHLD, SIG_DFL);
|
||
retry:
|
||
#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
|
||
before_exec();
|
||
#endif
|
||
pid = fork();
|
||
if (pid == 0) {
|
||
/* child process */
|
||
... | ... | |
rb_protect(proc_exec_args, (VALUE)&earg, NULL);
|
||
_exit(127);
|
||
}
|
||
#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
|
||
after_exec();
|
||
#endif
|
||
if (pid < 0) {
|
||
if (errno == EAGAIN) {
|
||
rb_thread_sleep(1);
|
io.c (作業コピー) | ||
---|---|---|
}
|
||
retry:
|
||
#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
|
||
rb_thread_stop_timer();
|
||
#endif
|
||
switch ((pid = fork())) {
|
||
case 0: /* child */
|
||
if (modef & FMODE_READABLE) {
|
||
... | ... | |
ruby_sourcefile, ruby_sourceline, pname);
|
||
_exit(127);
|
||
}
|
||
#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
|
||
rb_thread_start_timer();
|
||
#endif
|
||
rb_io_synchronized(RFILE(orig_stdout)->fptr);
|
||
rb_io_synchronized(RFILE(orig_stderr)->fptr);
|
||
return Qnil;
|
||
case -1: /* fork failed */
|
||
#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
|
||
rb_thread_start_timer();
|
||
#endif
|
||
if (errno == EAGAIN) {
|
||
rb_thread_sleep(1);
|
||
goto retry;
|
||
... | ... | |
break;
|
||
default: /* parent */
|
||
#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
|
||
rb_thread_start_timer();
|
||
#endif
|
||
if (pid < 0) rb_sys_fail(pname);
|
||
else {
|
||
VALUE port = io_alloc(rb_cIO);
|
eval.c (作業コピー) | ||
---|---|---|
safe_mutex_lock(&time_thread.lock);
|
||
if (pthread_create(&time_thread.thread, 0, thread_timer, args) == 0) {
|
||
thread_init = 1;
|
||
#if !defined(__NetBSD__) && !defined(__APPLE__) && !defined(linux)
|
||
pthread_atfork(0, 0, rb_thread_stop_timer);
|
||
#endif
|
||
pthread_cond_wait(&start, &time_thread.lock);
|
||
}
|
||
pthread_cleanup_pop(1);
|