8274293: Build failure on macOS with Xcode 13.0 as vfork is deprecated
Reviewed-by: alanb, stuefe, rriggs
This commit is contained in:
parent
7700b25460
commit
252aaa9249
src
@ -1946,7 +1946,11 @@ int os::fork_and_exec(const char* cmd, bool prefer_vfork) {
|
||||
// Use always vfork on AIX, since its safe and helps with analyzing OOM situations.
|
||||
// Otherwise leave it up to the caller.
|
||||
AIX_ONLY(prefer_vfork = true;)
|
||||
#ifdef __APPLE__
|
||||
pid = ::fork();
|
||||
#else
|
||||
pid = prefer_vfork ? ::vfork() : ::fork();
|
||||
#endif
|
||||
|
||||
if (pid < 0) {
|
||||
// fork failed
|
||||
|
@ -444,7 +444,8 @@ static int copystrings(char *buf, int offset, const char * const *arg) {
|
||||
__attribute_noinline__
|
||||
#endif
|
||||
|
||||
/* vfork(2) is deprecated on Solaris */
|
||||
/* vfork(2) is deprecated on Darwin */
|
||||
#ifndef __APPLE__
|
||||
static pid_t
|
||||
vforkChild(ChildStuff *c) {
|
||||
volatile pid_t resultPid;
|
||||
@ -463,6 +464,7 @@ vforkChild(ChildStuff *c) {
|
||||
assert(resultPid != 0); /* childProcess never returns */
|
||||
return resultPid;
|
||||
}
|
||||
#endif
|
||||
|
||||
static pid_t
|
||||
forkChild(ChildStuff *c) {
|
||||
@ -573,9 +575,11 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)
|
||||
static pid_t
|
||||
startChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) {
|
||||
switch (c->mode) {
|
||||
/* vfork(2) is deprecated on Solaris */
|
||||
/* vfork(2) is deprecated on Darwin*/
|
||||
#ifndef __APPLE__
|
||||
case MODE_VFORK:
|
||||
return vforkChild(c);
|
||||
#endif
|
||||
case MODE_FORK:
|
||||
return forkChild(c);
|
||||
case MODE_POSIX_SPAWN:
|
||||
|
Loading…
x
Reference in New Issue
Block a user