src/os/bsd/vm/os_bsd.cpp

changeset 9637
eef07cd490d4
parent 9448
73d689add964
parent 9620
97d605522fcb
child 9756
2be326848943
equal deleted inserted replaced
9581:95fce20624fc 9637:eef07cd490d4
1 /* 1 /*
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
4714 4714
4715 // Run the specified command in a separate process. Return its exit value, 4715 // Run the specified command in a separate process. Return its exit value,
4716 // or -1 on failure (e.g. can't fork a new process). 4716 // or -1 on failure (e.g. can't fork a new process).
4717 // Unlike system(), this function can be called from signal handler. It 4717 // Unlike system(), this function can be called from signal handler. It
4718 // doesn't block SIGINT et al. 4718 // doesn't block SIGINT et al.
4719 int os::fork_and_exec(char* cmd) { 4719 int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
4720 const char * argv[4] = {"sh", "-c", cmd, NULL}; 4720 const char * argv[4] = {"sh", "-c", cmd, NULL};
4721 4721
4722 // fork() in BsdThreads/NPTL is not async-safe. It needs to run 4722 // fork() in BsdThreads/NPTL is not async-safe. It needs to run
4723 // pthread_atfork handlers and reset pthread library. All we need is a 4723 // pthread_atfork handlers and reset pthread library. All we need is a
4724 // separate process to execve. Make a direct syscall to fork process. 4724 // separate process to execve. Make a direct syscall to fork process.

mercurial