mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
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
2 changed files with 10 additions and 2 deletions
|
@ -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.
|
// Use always vfork on AIX, since its safe and helps with analyzing OOM situations.
|
||||||
// Otherwise leave it up to the caller.
|
// Otherwise leave it up to the caller.
|
||||||
AIX_ONLY(prefer_vfork = true;)
|
AIX_ONLY(prefer_vfork = true;)
|
||||||
|
#ifdef __APPLE__
|
||||||
|
pid = ::fork();
|
||||||
|
#else
|
||||||
pid = prefer_vfork ? ::vfork() : ::fork();
|
pid = prefer_vfork ? ::vfork() : ::fork();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
// fork failed
|
// fork failed
|
||||||
|
|
|
@ -444,7 +444,8 @@ static int copystrings(char *buf, int offset, const char * const *arg) {
|
||||||
__attribute_noinline__
|
__attribute_noinline__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* vfork(2) is deprecated on Solaris */
|
/* vfork(2) is deprecated on Darwin */
|
||||||
|
#ifndef __APPLE__
|
||||||
static pid_t
|
static pid_t
|
||||||
vforkChild(ChildStuff *c) {
|
vforkChild(ChildStuff *c) {
|
||||||
volatile pid_t resultPid;
|
volatile pid_t resultPid;
|
||||||
|
@ -463,6 +464,7 @@ vforkChild(ChildStuff *c) {
|
||||||
assert(resultPid != 0); /* childProcess never returns */
|
assert(resultPid != 0); /* childProcess never returns */
|
||||||
return resultPid;
|
return resultPid;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static pid_t
|
static pid_t
|
||||||
forkChild(ChildStuff *c) {
|
forkChild(ChildStuff *c) {
|
||||||
|
@ -573,9 +575,11 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)
|
||||||
static pid_t
|
static pid_t
|
||||||
startChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) {
|
startChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) {
|
||||||
switch (c->mode) {
|
switch (c->mode) {
|
||||||
/* vfork(2) is deprecated on Solaris */
|
/* vfork(2) is deprecated on Darwin*/
|
||||||
|
#ifndef __APPLE__
|
||||||
case MODE_VFORK:
|
case MODE_VFORK:
|
||||||
return vforkChild(c);
|
return vforkChild(c);
|
||||||
|
#endif
|
||||||
case MODE_FORK:
|
case MODE_FORK:
|
||||||
return forkChild(c);
|
return forkChild(c);
|
||||||
case MODE_POSIX_SPAWN:
|
case MODE_POSIX_SPAWN:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue