equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1995, 2013, 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. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
42 #include <ctype.h> |
42 #include <ctype.h> |
43 #include <sys/wait.h> |
43 #include <sys/wait.h> |
44 #include <signal.h> |
44 #include <signal.h> |
45 #include <string.h> |
45 #include <string.h> |
46 |
46 |
47 #if defined(__solaris__) || defined(_ALLBSD_SOURCE) |
47 #if defined(__solaris__) || defined(_ALLBSD_SOURCE) || defined(_AIX) |
48 #include <spawn.h> |
48 #include <spawn.h> |
49 #endif |
49 #endif |
50 |
50 |
51 #include "childproc.h" |
51 #include "childproc.h" |
52 |
52 |
453 } |
453 } |
454 assert(resultPid != 0); /* childProcess never returns */ |
454 assert(resultPid != 0); /* childProcess never returns */ |
455 return resultPid; |
455 return resultPid; |
456 } |
456 } |
457 |
457 |
458 #if defined(__solaris__) || defined(_ALLBSD_SOURCE) |
458 #if defined(__solaris__) || defined(_ALLBSD_SOURCE) || defined(_AIX) |
459 static pid_t |
459 static pid_t |
460 spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) { |
460 spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) { |
461 pid_t resultPid; |
461 pid_t resultPid; |
462 jboolean isCopy; |
462 jboolean isCopy; |
463 int i, offset, rval, bufsize, magic; |
463 int i, offset, rval, bufsize, magic; |
549 switch (c->mode) { |
549 switch (c->mode) { |
550 case MODE_VFORK: |
550 case MODE_VFORK: |
551 return vforkChild(c); |
551 return vforkChild(c); |
552 case MODE_FORK: |
552 case MODE_FORK: |
553 return forkChild(c); |
553 return forkChild(c); |
554 #if defined(__solaris__) || defined(_ALLBSD_SOURCE) |
554 #if defined(__solaris__) || defined(_ALLBSD_SOURCE) || defined(_AIX) |
555 case MODE_POSIX_SPAWN: |
555 case MODE_POSIX_SPAWN: |
556 return spawnChild(env, process, c, helperpath); |
556 return spawnChild(env, process, c, helperpath); |
557 #endif |
557 #endif |
558 default: |
558 default: |
559 return -1; |
559 return -1; |