equal
deleted
inserted
replaced
3783 |
3783 |
3784 // Run the specified command in a separate process. Return its exit value, |
3784 // Run the specified command in a separate process. Return its exit value, |
3785 // or -1 on failure (e.g. can't fork a new process). |
3785 // or -1 on failure (e.g. can't fork a new process). |
3786 // Unlike system(), this function can be called from signal handler. It |
3786 // Unlike system(), this function can be called from signal handler. It |
3787 // doesn't block SIGINT et al. |
3787 // doesn't block SIGINT et al. |
3788 int os::fork_and_exec(char* cmd) { |
3788 int os::fork_and_exec(char* cmd, bool use_vfork_if_available) { |
3789 const char * argv[4] = {"sh", "-c", cmd, NULL}; |
3789 const char * argv[4] = {"sh", "-c", cmd, NULL}; |
3790 |
3790 |
3791 // fork() in BsdThreads/NPTL is not async-safe. It needs to run |
3791 // fork() in BsdThreads/NPTL is not async-safe. It needs to run |
3792 // pthread_atfork handlers and reset pthread library. All we need is a |
3792 // pthread_atfork handlers and reset pthread library. All we need is a |
3793 // separate process to execve. Make a direct syscall to fork process. |
3793 // separate process to execve. Make a direct syscall to fork process. |