Index: runtime/bin/process_android.cc |
diff --git a/runtime/bin/process_android.cc b/runtime/bin/process_android.cc |
index 41230452eddf253833a37e4be5d2c6047511600c..66fc280523091c99fa593a120e872a8b9738e42e 100644 |
--- a/runtime/bin/process_android.cc |
+++ b/runtime/bin/process_android.cc |
@@ -64,7 +64,6 @@ class ProcessInfo { |
DISALLOW_COPY_AND_ASSIGN(ProcessInfo); |
}; |
- |
// Singly-linked list of ProcessInfo objects for all active processes |
// started from Dart. |
class ProcessInfoList { |
@@ -76,7 +75,6 @@ class ProcessInfoList { |
active_processes_ = info; |
} |
- |
static intptr_t LookupProcessExitFd(pid_t pid) { |
MutexLocker locker(mutex_); |
ProcessInfo* current = active_processes_; |
@@ -89,7 +87,6 @@ class ProcessInfoList { |
return 0; |
} |
- |
static void RemoveProcess(pid_t pid) { |
MutexLocker locker(mutex_); |
ProcessInfo* prev = NULL; |
@@ -121,11 +118,9 @@ class ProcessInfoList { |
DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessInfoList); |
}; |
- |
ProcessInfo* ProcessInfoList::active_processes_ = NULL; |
Mutex* ProcessInfoList::mutex_ = new Mutex(); |
- |
// The exit code handler sets up a separate thread which waits for child |
// processes to terminate. That separate thread can then get the exit code from |
// processes that have exited and communicate it to Dart through the |
@@ -242,13 +237,11 @@ class ExitCodeHandler { |
DISALLOW_IMPLICIT_CONSTRUCTORS(ExitCodeHandler); |
}; |
- |
bool ExitCodeHandler::running_ = false; |
int ExitCodeHandler::process_count_ = 0; |
bool ExitCodeHandler::terminate_done_ = false; |
Monitor* ExitCodeHandler::monitor_ = new Monitor(); |
- |
class ProcessStarter { |
public: |
ProcessStarter(const char* path, |
@@ -301,7 +294,6 @@ class ProcessStarter { |
} |
} |
- |
int Start() { |
// Create pipes required. |
int err = CreatePipes(); |
@@ -426,7 +418,6 @@ class ProcessStarter { |
return 0; |
} |
- |
void NewProcess() { |
// Wait for parent process before setting up the child process. |
char msg; |
@@ -442,7 +433,6 @@ class ProcessStarter { |
} |
} |
- |
void ExecProcess() { |
if (TEMP_FAILURE_RETRY(dup2(write_out_[0], STDIN_FILENO)) == -1) { |
ReportChildError(); |
@@ -471,7 +461,6 @@ class ProcessStarter { |
ReportChildError(); |
} |
- |
void ExecDetachedProcess() { |
if (mode_ == kDetached) { |
ASSERT(write_out_[0] == -1); |
@@ -529,7 +518,6 @@ class ProcessStarter { |
} |
} |
- |
int RegisterProcess(pid_t pid) { |
int result; |
int event_fds[2]; |
@@ -544,7 +532,6 @@ class ProcessStarter { |
return 0; |
} |
- |
int ReadExecResult() { |
int child_errno; |
int bytes_read = -1; |
@@ -562,7 +549,6 @@ class ProcessStarter { |
return 0; |
} |
- |
int ReadDetachedExecResult(pid_t* pid) { |
int child_errno; |
int bytes_read = -1; |
@@ -585,7 +571,6 @@ class ProcessStarter { |
return 0; |
} |
- |
void SetupDetached() { |
ASSERT(mode_ == kDetached); |
@@ -648,7 +633,6 @@ class ProcessStarter { |
VOID_TEMP_FAILURE_RETRY(close(read_err_[1])); |
} |
- |
int CleanupAndReturnError() { |
int actual_errno = errno; |
// If CleanupAndReturnError is called without an actual errno make |
@@ -661,7 +645,6 @@ class ProcessStarter { |
return actual_errno; |
} |
- |
void SetChildOsErrorMessage() { |
const int kBufferSize = 1024; |
char* error_message = DartUtils::ScopedCString(kBufferSize); |
@@ -669,7 +652,6 @@ class ProcessStarter { |
*os_error_message_ = error_message; |
} |
- |
void ReportChildError() { |
// In the case of failure in the child process write the errno and |
// the OS error message to the exec control pipe and exit. |
@@ -690,7 +672,6 @@ class ProcessStarter { |
_exit(1); |
} |
- |
void ReportPid(int pid) { |
// In the case of starting a detached process the actual pid of that process |
// is communicated using the exec control pipe. |
@@ -700,7 +681,6 @@ class ProcessStarter { |
USE(bytes_written); |
} |
- |
void ReadChildError() { |
const int kMaxMessageSize = 256; |
char* message = DartUtils::ScopedCString(kMaxMessageSize); |
@@ -714,7 +694,6 @@ class ProcessStarter { |
} |
} |
- |
void ClosePipe(int* fds) { |
for (int i = 0; i < 2; i++) { |
if (fds[i] != -1) { |
@@ -724,7 +703,6 @@ class ProcessStarter { |
} |
} |
- |
void CloseAllPipes() { |
ClosePipe(exec_control_); |
ClosePipe(read_in_); |
@@ -732,7 +710,6 @@ class ProcessStarter { |
ClosePipe(write_out_); |
} |
- |
int read_in_[2]; // Pipe for stdout to child process. |
int read_err_[2]; // Pipe for stderr to child process. |
int write_out_[2]; // Pipe for stdin to child process. |
@@ -755,7 +732,6 @@ class ProcessStarter { |
DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessStarter); |
}; |
- |
int Process::Start(const char* path, |
char* arguments[], |
intptr_t arguments_length, |
@@ -775,7 +751,6 @@ int Process::Start(const char* path, |
return starter.Start(); |
} |
- |
static bool CloseProcessBuffers(struct pollfd fds[3]) { |
int e = errno; |
VOID_TEMP_FAILURE_RETRY(close(fds[0].fd)); |
@@ -785,7 +760,6 @@ static bool CloseProcessBuffers(struct pollfd fds[3]) { |
return false; |
} |
- |
bool Process::Wait(intptr_t pid, |
intptr_t in, |
intptr_t out, |
@@ -873,22 +847,18 @@ bool Process::Wait(intptr_t pid, |
return true; |
} |
- |
bool Process::Kill(intptr_t id, int signal) { |
return (TEMP_FAILURE_RETRY(kill(id, signal)) != -1); |
} |
- |
void Process::TerminateExitCodeHandler() { |
ExitCodeHandler::TerminateExitCodeThread(); |
} |
- |
intptr_t Process::CurrentProcessId() { |
return static_cast<intptr_t>(getpid()); |
} |
- |
int64_t Process::CurrentRSS() { |
// The second value in /proc/self/statm is the current RSS in pages. |
File* statm = File::Open("/proc/self/statm", File::kRead); |
@@ -911,7 +881,6 @@ int64_t Process::CurrentRSS() { |
return current_rss_pages * getpagesize(); |
} |
- |
int64_t Process::MaxRSS() { |
struct rusage usage; |
usage.ru_maxrss = 0; |
@@ -922,7 +891,6 @@ int64_t Process::MaxRSS() { |
return usage.ru_maxrss * KB; |
} |
- |
static Mutex* signal_mutex = new Mutex(); |
static SignalInfo* signal_handlers = NULL; |
static const int kSignalsCount = 7; |
@@ -931,12 +899,10 @@ static const int kSignals[kSignalsCount] = { |
SIGQUIT // Allow VMService to listen on SIGQUIT. |
}; |
- |
SignalInfo::~SignalInfo() { |
VOID_TEMP_FAILURE_RETRY(close(fd_)); |
} |
- |
static void SignalHandler(int signal) { |
MutexLocker lock(signal_mutex); |
const SignalInfo* handler = signal_handlers; |
@@ -949,7 +915,6 @@ static void SignalHandler(int signal) { |
} |
} |
- |
intptr_t Process::SetSignalHandler(intptr_t signal) { |
bool found = false; |
for (int i = 0; i < kSignalsCount; i++) { |
@@ -1000,7 +965,6 @@ intptr_t Process::SetSignalHandler(intptr_t signal) { |
return fds[0]; |
} |
- |
void Process::ClearSignalHandler(intptr_t signal, Dart_Port port) { |
// Either the port is illegal or there is no current isolate, but not both. |
ASSERT((port != ILLEGAL_PORT) || (Dart_CurrentIsolate() == NULL)); |