OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/process_proxy/process_proxy.h" | 5 #include "chromeos/process_proxy/process_proxy.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <sys/ioctl.h> | 9 #include <sys/ioctl.h> |
10 | 10 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 CloseFdPair(shutdown_pipe_); | 237 CloseFdPair(shutdown_pipe_); |
238 } | 238 } |
239 | 239 |
240 void ProcessProxy::CloseFdPair(int* pipe) { | 240 void ProcessProxy::CloseFdPair(int* pipe) { |
241 CloseFd(&(pipe[PIPE_END_READ])); | 241 CloseFd(&(pipe[PIPE_END_READ])); |
242 CloseFd(&(pipe[PIPE_END_WRITE])); | 242 CloseFd(&(pipe[PIPE_END_WRITE])); |
243 } | 243 } |
244 | 244 |
245 void ProcessProxy::CloseFd(int* fd) { | 245 void ProcessProxy::CloseFd(int* fd) { |
246 if (*fd != kInvalidFd) { | 246 if (*fd != kInvalidFd) { |
247 if (HANDLE_EINTR(close(*fd)) != 0) | 247 if (IGNORE_EINTR(close(*fd)) != 0) |
248 DPLOG(WARNING) << "close fd failed."; | 248 DPLOG(WARNING) << "close fd failed."; |
249 } | 249 } |
250 *fd = kInvalidFd; | 250 *fd = kInvalidFd; |
251 } | 251 } |
252 | 252 |
253 void ProcessProxy::ClearAllFdPairs() { | 253 void ProcessProxy::ClearAllFdPairs() { |
254 ClearFdPair(pt_pair_); | 254 ClearFdPair(pt_pair_); |
255 ClearFdPair(shutdown_pipe_); | 255 ClearFdPair(shutdown_pipe_); |
256 } | 256 } |
257 | 257 |
258 void ProcessProxy::ClearFdPair(int* pipe) { | 258 void ProcessProxy::ClearFdPair(int* pipe) { |
259 pipe[PIPE_END_READ] = kInvalidFd; | 259 pipe[PIPE_END_READ] = kInvalidFd; |
260 pipe[PIPE_END_WRITE] = kInvalidFd; | 260 pipe[PIPE_END_WRITE] = kInvalidFd; |
261 } | 261 } |
262 | 262 |
263 } // namespace chromeos | 263 } // namespace chromeos |
OLD | NEW |