OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 // Modern Linux has the waitid call, which is like waitpid, but more useful | 359 // Modern Linux has the waitid call, which is like waitpid, but more useful |
360 // if you want a timeout. If we don't have waitid we can't limit the time | 360 // if you want a timeout. If we don't have waitid we can't limit the time |
361 // waiting for the process to exit without losing the information about | 361 // waiting for the process to exit without losing the information about |
362 // whether it exited normally. In the common case this doesn't matter because | 362 // whether it exited normally. In the common case this doesn't matter because |
363 // we don't get here before the child has closed stdout and most programs don't | 363 // we don't get here before the child has closed stdout and most programs don't |
364 // do that before they exit. | 364 // do that before they exit. |
365 // | 365 // |
366 // We're disabling usage of waitid in Mac OS X because it doens't work for us: | 366 // We're disabling usage of waitid in Mac OS X because it doens't work for us: |
367 // a parent process hangs on waiting while a child process is already a zombie. | 367 // a parent process hangs on waiting while a child process is already a zombie. |
368 // See http://code.google.com/p/v8/issues/detail?id=401. | 368 // See http://code.google.com/p/v8/issues/detail?id=401. |
369 #if defined(WNOWAIT) && !defined(ANDROID) && !defined(__APPLE__) \ | 369 #if defined(WNOWAIT) && !V8_OS_ANDROID && !V8_OS_DARWN && \ |
370 && !defined(__NetBSD__) | 370 !V8_OS_NETBSD && !V8_OS_FREEBSD |
371 #if !defined(__FreeBSD__) | |
372 #define HAS_WAITID 1 | 371 #define HAS_WAITID 1 |
373 #endif | 372 #endif |
374 #endif | |
375 | 373 |
376 | 374 |
377 // Get exit status of child. | 375 // Get exit status of child. |
378 static bool WaitForChild(int pid, | 376 static bool WaitForChild(int pid, |
379 ZombieProtector& child_waiter, | 377 ZombieProtector& child_waiter, |
380 struct timeval& start_time, | 378 struct timeval& start_time, |
381 int read_timeout, | 379 int read_timeout, |
382 int total_timeout) { | 380 int total_timeout) { |
383 #ifdef HAS_WAITID | 381 #ifdef HAS_WAITID |
384 | 382 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 os_templ->Set(String::New("chdir"), FunctionTemplate::New(ChangeDirectory)); | 694 os_templ->Set(String::New("chdir"), FunctionTemplate::New(ChangeDirectory)); |
697 os_templ->Set(String::New("setenv"), FunctionTemplate::New(SetEnvironment)); | 695 os_templ->Set(String::New("setenv"), FunctionTemplate::New(SetEnvironment)); |
698 os_templ->Set(String::New("unsetenv"), | 696 os_templ->Set(String::New("unsetenv"), |
699 FunctionTemplate::New(UnsetEnvironment)); | 697 FunctionTemplate::New(UnsetEnvironment)); |
700 os_templ->Set(String::New("umask"), FunctionTemplate::New(SetUMask)); | 698 os_templ->Set(String::New("umask"), FunctionTemplate::New(SetUMask)); |
701 os_templ->Set(String::New("mkdirp"), FunctionTemplate::New(MakeDirectory)); | 699 os_templ->Set(String::New("mkdirp"), FunctionTemplate::New(MakeDirectory)); |
702 os_templ->Set(String::New("rmdir"), FunctionTemplate::New(RemoveDirectory)); | 700 os_templ->Set(String::New("rmdir"), FunctionTemplate::New(RemoveDirectory)); |
703 } | 701 } |
704 | 702 |
705 } // namespace v8 | 703 } // namespace v8 |
OLD | NEW |