84 */
85 #define MODE_FORK 1
86 #define MODE_POSIX_SPAWN 2
87 #define MODE_VFORK 3
88 #define MODE_CLONE 4
89
90 typedef struct _ChildStuff
91 {
92 int in[2];
93 int out[2];
94 int err[2];
95 int fail[2];
96 int childenv[2];
97 int fds[3];
98 int mode;
99 const char **argv;
100 int argc;
101 const char **envv;
102 const char *pdir;
103 int redirectErrorStream;
104 } ChildStuff;
105
106 /* following used in addition when mode is SPAWN */
107 typedef struct _SpawnInfo {
108 int nargv; /* number of argv array elements */
109 int argvBytes; /* total number of bytes in argv array */
110 int nenvv; /* number of envv array elements */
111 int envvBytes; /* total number of bytes in envv array */
112 int dirlen; /* length of home directory string */
113 int nparentPathv; /* number of elements in parentPathv array */
114 int parentPathvBytes; /* total number of bytes in parentPathv array */
115 } SpawnInfo;
116
117 /**
118 * The cached and split version of the JDK's effective PATH.
119 * (We don't support putenv("PATH=...") in native code)
120 */
121 const char * const *parentPathv;
122
123 ssize_t restartableWrite(int fd, const void *buf, size_t count);
124 int restartableDup2(int fd_from, int fd_to);
125 int closeSafely(int fd);
126 int isAsciiDigit(char c);
127 int closeDescriptors(void);
128 int moveDescriptor(int fd_from, int fd_to);
129
130 int magicNumber();
131 ssize_t readFully(int fd, void *buf, size_t nbyte);
132 void initVectorFromBlock(const char**vector, const char* block, int count);
133 void execve_as_traditional_shell_script(const char *file,
134 const char *argv[],
135 const char *const envp[]);
|
84 */
85 #define MODE_FORK 1
86 #define MODE_POSIX_SPAWN 2
87 #define MODE_VFORK 3
88 #define MODE_CLONE 4
89
90 typedef struct _ChildStuff
91 {
92 int in[2];
93 int out[2];
94 int err[2];
95 int fail[2];
96 int childenv[2];
97 int fds[3];
98 int mode;
99 const char **argv;
100 int argc;
101 const char **envv;
102 const char *pdir;
103 int redirectErrorStream;
104 int sendAlivePing;
105 } ChildStuff;
106
107 /* following used in addition when mode is SPAWN */
108 typedef struct _SpawnInfo {
109 int nargv; /* number of argv array elements */
110 int argvBytes; /* total number of bytes in argv array */
111 int nenvv; /* number of envv array elements */
112 int envvBytes; /* total number of bytes in envv array */
113 int dirlen; /* length of home directory string */
114 int nparentPathv; /* number of elements in parentPathv array */
115 int parentPathvBytes; /* total number of bytes in parentPathv array */
116 } SpawnInfo;
117
118 /* If ChildStuff.sendAlivePing is true, child shall signal aliveness to
119 * the parent the moment it gains consciousness, before any subsequent
120 * pre-exec errors could happen.
121 * This code must fit into an int and not be a valid errno value on any of
122 * our platforms. */
123 #define CHILD_IS_ALIVE 65535
124
125 /**
126 * The cached and split version of the JDK's effective PATH.
127 * (We don't support putenv("PATH=...") in native code)
128 */
129 const char * const *parentPathv;
130
131 ssize_t restartableWrite(int fd, const void *buf, size_t count);
132 int restartableDup2(int fd_from, int fd_to);
133 int closeSafely(int fd);
134 int isAsciiDigit(char c);
135 int closeDescriptors(void);
136 int moveDescriptor(int fd_from, int fd_to);
137
138 int magicNumber();
139 ssize_t readFully(int fd, void *buf, size_t nbyte);
140 void initVectorFromBlock(const char**vector, const char* block, int count);
141 void execve_as_traditional_shell_script(const char *file,
142 const char *argv[],
143 const char *const envp[]);
|