aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/Unix/Program.inc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Unix/Program.inc')
-rw-r--r--lib/Support/Unix/Program.inc24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/Support/Unix/Program.inc b/lib/Support/Unix/Program.inc
index 117151c91d..834b1cc5dc 100644
--- a/lib/Support/Unix/Program.inc
+++ b/lib/Support/Unix/Program.inc
@@ -99,6 +99,10 @@ Program::FindProgramByName(const std::string& progName) {
}
static bool RedirectIO(const Path *Path, int FD, std::string* ErrMsg) {
+#if defined(__native_client__)
+ MakeErrMsg(ErrMsg, "Cannot redirect I/O in NaCl");
+ return true;
+#else // (__native_client__)
if (Path == 0) // Noop
return false;
const char *File;
@@ -115,7 +119,6 @@ static bool RedirectIO(const Path *Path, int FD, std::string* ErrMsg) {
+ (FD == 0 ? "input" : "output"));
return true;
}
-
// Install it as the requested FD
if (dup2(InFD, FD) == -1) {
MakeErrMsg(ErrMsg, "Cannot dup2");
@@ -124,6 +127,7 @@ static bool RedirectIO(const Path *Path, int FD, std::string* ErrMsg) {
}
close(InFD); // Close the original FD
return false;
+#endif // (__native_client__)
}
#ifdef HAVE_POSIX_SPAWN
@@ -233,6 +237,7 @@ Program::Execute(const Path &path, const char **args, const char **envp,
}
#endif
+#if !defined(__native_client__)
// Create a child process.
int child = fork();
switch (child) {
@@ -293,6 +298,10 @@ Program::Execute(const Path &path, const char **args, const char **envp,
Data_ = reinterpret_cast<void*>(child);
return true;
+#else // (__native_client__)
+ MakeErrMsg(ErrMsg, "PNACL does not know how to execute child processes!");
+ return false;
+#endif // (__native_client__)
}
int
@@ -300,6 +309,7 @@ Program::Wait(const sys::Path &path,
unsigned secondsToWait,
std::string* ErrMsg)
{
+#if !defined(__native_client__)
#ifdef HAVE_SYS_WAIT_H
struct sigaction Act, Old;
@@ -392,6 +402,18 @@ Program::Wait(const sys::Path &path,
*ErrMsg = "Program::Wait is not implemented on this platform yet!";
return -1;
#endif
+#else // (__native_client__)
+// TODO(abetul): What should the proper return value be here?
+ MakeErrMsg(ErrMsg, "PNACL does not know how to wait for a child process!");
+ return -1;
+#endif // (__native_client__)
+#if !defined(__native_client__)
+
+#else // (__native_client__)
+ MakeErrMsg(ErrMsg, "PNACL does not know how to kill processes!");
+ return true;
+#endif // (__native_client__)
+
}
error_code Program::ChangeStdinToBinary(){