Project

General

Profile

Backport #2739 ยป 0002-for-linux.patch

kosaki (Motohiro KOSAKI), 03/09/2010 02:28 AM

View differences:

eval.c
12348 12348
    safe_mutex_lock(&time_thread.lock);
12349 12349
    if (pthread_create(&time_thread.thread, 0, thread_timer, args) == 0) {
12350 12350
	thread_init = 1;
12351
#ifndef __NetBSD__
12351
#if !defined(__NetBSD__) && !defined(linux)
12352 12352
	pthread_atfork(0, 0, rb_thread_stop_timer);
12353 12353
#endif
12354 12354
	pthread_cond_wait(&start, &time_thread.lock);
io.c
3245 3245
    }
3246 3246

  
3247 3247
  retry:
3248
#ifdef __NetBSD__
3248
#if defined(__NetBSD__) || defined(linux)
3249 3249
    rb_thread_stop_timer();
3250 3250
#endif
3251 3251
    switch ((pid = fork())) {
......
3275 3275
		    ruby_sourcefile, ruby_sourceline, pname);
3276 3276
	    _exit(127);
3277 3277
	}
3278
#ifdef __NetBSD__
3278
#if defined(__NetBSD__) || defined(linux)
3279 3279
	rb_thread_start_timer();
3280 3280
#endif
3281 3281
	rb_io_synchronized(RFILE(orig_stdout)->fptr);
......
3283 3283
	return Qnil;
3284 3284

  
3285 3285
      case -1:			/* fork failed */
3286
#ifdef __NetBSD__
3286
#if defined(__NetBSD__) || defined(linux)
3287 3287
	rb_thread_start_timer();
3288 3288
#endif
3289 3289
	if (errno == EAGAIN) {
......
3306 3306
	break;
3307 3307

  
3308 3308
      default:			/* parent */
3309
#ifdef __NetBSD__
3309
#if defined(__NetBSD__) || defined(linux)
3310 3310
	rb_thread_start_timer();
3311 3311
#endif
3312 3312
	if (pid < 0) rb_sys_fail(pname);
process.c
1330 1330
    fflush(stderr);
1331 1331
#endif
1332 1332

  
1333
#ifdef __NetBSD__
1333
#if defined(__NetBSD__) || defined(linux)
1334 1334
    before_exec();
1335 1335
    pid = fork();
1336 1336
    after_exec();
......
1577 1577

  
1578 1578
    chfunc = signal(SIGCHLD, SIG_DFL);
1579 1579
  retry:
1580
#ifdef __NetBSD__
1580
#if defined(__NetBSD__) || defined(linux)
1581 1581
    before_exec();
1582 1582
#endif
1583 1583
    pid = fork();
......
1587 1587
	rb_protect(proc_exec_args, (VALUE)&earg, NULL);
1588 1588
	_exit(127);
1589 1589
    }
1590
#ifdef __NetBSD__
1590
#if defined(__NetBSD__) || defined(linux)
1591 1591
    after_exec();
1592 1592
#endif
1593 1593
    if (pid < 0) {