author | stuefe |
Wed, 05 Jun 2019 09:12:45 +0200 | |
changeset 55240 | 57b93b113ec0 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
19399
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
1 |
/* |
28665
fe8344cf6496
8071481: (Process) Merge UNIXProcess.java into ProcessImpl.java
rriggs
parents:
25859
diff
changeset
|
2 |
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
19399
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
4 |
* |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
10 |
* |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
15 |
* accompanied this code). |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
16 |
* |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
20 |
* |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
23 |
* questions. |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
24 |
*/ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
25 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
26 |
#ifndef CHILDPROC_MD_H |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
27 |
#define CHILDPROC_MD_H |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
28 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
29 |
#include <sys/types.h> |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
30 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
31 |
#ifdef __APPLE__ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
32 |
#include <crt_externs.h> |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
33 |
#define environ (*_NSGetEnviron()) |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
34 |
#else |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
35 |
/* This is one of the rare times it's more portable to declare an |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
36 |
* external symbol explicitly, rather than via a system header. |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
37 |
* The declaration is standardized as part of UNIX98, but there is |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
38 |
* no standard (not even de-facto) header file where the |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
39 |
* declaration is to be found. See: |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
40 |
* http://www.opengroup.org/onlinepubs/009695399/functions/environ.html |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
41 |
* http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_02.html |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
42 |
* |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
43 |
* "All identifiers in this volume of IEEE Std 1003.1-2001, except |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
44 |
* environ, are defined in at least one of the headers" (!) |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
45 |
*/ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
46 |
extern char **environ; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
47 |
#endif |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
48 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
49 |
#ifdef __linux__ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
50 |
#include <sched.h> |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
51 |
#endif |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
52 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
53 |
#ifndef STDIN_FILENO |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
54 |
#define STDIN_FILENO 0 |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
55 |
#endif |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
56 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
57 |
#ifndef STDOUT_FILENO |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
58 |
#define STDOUT_FILENO 1 |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
59 |
#endif |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
60 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
61 |
#ifndef STDERR_FILENO |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
62 |
#define STDERR_FILENO 2 |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
63 |
#endif |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
64 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
65 |
#ifndef SA_NOCLDSTOP |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
66 |
#define SA_NOCLDSTOP 0 |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
67 |
#endif |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
68 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
69 |
#ifndef SA_RESTART |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
70 |
#define SA_RESTART 0 |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
71 |
#endif |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
72 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
73 |
#define FAIL_FILENO (STDERR_FILENO + 1) |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
74 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
75 |
/* TODO: Refactor. */ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
76 |
#define RESTARTABLE(_cmd, _result) do { \ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
77 |
do { \ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
78 |
_result = _cmd; \ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
79 |
} while((_result == -1) && (errno == EINTR)); \ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
80 |
} while(0) |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
81 |
|
28665
fe8344cf6496
8071481: (Process) Merge UNIXProcess.java into ProcessImpl.java
rriggs
parents:
25859
diff
changeset
|
82 |
/* These numbers must be the same as the Enum in ProcessImpl.java |
19399
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
83 |
* Must be a better way of doing this. |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
84 |
*/ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
85 |
#define MODE_FORK 1 |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
86 |
#define MODE_POSIX_SPAWN 2 |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
87 |
#define MODE_VFORK 3 |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
88 |
#define MODE_CLONE 4 |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
89 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
90 |
typedef struct _ChildStuff |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
91 |
{ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
92 |
int in[2]; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
93 |
int out[2]; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
94 |
int err[2]; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
95 |
int fail[2]; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
96 |
int childenv[2]; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
97 |
int fds[3]; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
98 |
int mode; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
99 |
const char **argv; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
100 |
int argc; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
101 |
const char **envv; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
102 |
const char *pdir; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
103 |
int redirectErrorStream; |
55240
57b93b113ec0
8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error
stuefe
parents:
47216
diff
changeset
|
104 |
int sendAlivePing; |
19399
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
105 |
} ChildStuff; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
106 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
107 |
/* following used in addition when mode is SPAWN */ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
108 |
typedef struct _SpawnInfo { |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
109 |
int nargv; /* number of argv array elements */ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
110 |
int argvBytes; /* total number of bytes in argv array */ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
111 |
int nenvv; /* number of envv array elements */ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
112 |
int envvBytes; /* total number of bytes in envv array */ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
113 |
int dirlen; /* length of home directory string */ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
114 |
int nparentPathv; /* number of elements in parentPathv array */ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
115 |
int parentPathvBytes; /* total number of bytes in parentPathv array */ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
116 |
} SpawnInfo; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
117 |
|
55240
57b93b113ec0
8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error
stuefe
parents:
47216
diff
changeset
|
118 |
/* If ChildStuff.sendAlivePing is true, child shall signal aliveness to |
57b93b113ec0
8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error
stuefe
parents:
47216
diff
changeset
|
119 |
* the parent the moment it gains consciousness, before any subsequent |
57b93b113ec0
8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error
stuefe
parents:
47216
diff
changeset
|
120 |
* pre-exec errors could happen. |
57b93b113ec0
8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error
stuefe
parents:
47216
diff
changeset
|
121 |
* This code must fit into an int and not be a valid errno value on any of |
57b93b113ec0
8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error
stuefe
parents:
47216
diff
changeset
|
122 |
* our platforms. */ |
57b93b113ec0
8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error
stuefe
parents:
47216
diff
changeset
|
123 |
#define CHILD_IS_ALIVE 65535 |
57b93b113ec0
8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error
stuefe
parents:
47216
diff
changeset
|
124 |
|
19399
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
125 |
/** |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
126 |
* The cached and split version of the JDK's effective PATH. |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
127 |
* (We don't support putenv("PATH=...") in native code) |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
128 |
*/ |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
129 |
const char * const *parentPathv; |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
130 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
131 |
ssize_t restartableWrite(int fd, const void *buf, size_t count); |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
132 |
int restartableDup2(int fd_from, int fd_to); |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
133 |
int closeSafely(int fd); |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
134 |
int isAsciiDigit(char c); |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
135 |
int closeDescriptors(void); |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
136 |
int moveDescriptor(int fd_from, int fd_to); |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
137 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
138 |
int magicNumber(); |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
139 |
ssize_t readFully(int fd, void *buf, size_t nbyte); |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
140 |
void initVectorFromBlock(const char**vector, const char* block, int count); |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
141 |
void execve_as_traditional_shell_script(const char *file, |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
142 |
const char *argv[], |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
143 |
const char *const envp[]); |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
144 |
void execve_with_shell_fallback(int mode, const char *file, |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
145 |
const char *argv[], |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
146 |
const char *const envp[]); |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
147 |
void JDK_execvpe(int mode, const char *file, |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
148 |
const char *argv[], |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
149 |
const char *const envp[]); |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
150 |
int childProcess(void *arg); |
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
151 |
|
e2e5122cd62e
5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
robm
parents:
diff
changeset
|
152 |
#endif |