summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-03 14:10:59 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-03 14:10:59 +0000
commitd89eec809e2d25aee8d386186653699f5017b15b (patch)
treeb8b0433f5766958907ea4cebb7b954e82fc1148a /content
parent34b5946e889071a9c838a4b87d32437415148fed (diff)
downloadchromium_src-d89eec809e2d25aee8d386186653699f5017b15b.zip
chromium_src-d89eec809e2d25aee8d386186653699f5017b15b.tar.gz
chromium_src-d89eec809e2d25aee8d386186653699f5017b15b.tar.bz2
Don't HANDLE_EINTR(close). Either IGNORE_EINTR(close) or just close.
It is incorrect to wrap close in HANDLE_EINTR on Linux. Correctness is generally undefined on Mac, but as of r223369, it is incorrect in Chrome on Mac. To avoid new offenders, a PRESUBMIT check ensures that HANDLE_EINTR is not used with close, and that IGNORE_EINTR is only used with close. Unnecessary #includes of eintr_wrapper.h are also removed. base/posix/einter_wrapper.h, PRESUBMIT.py, and ppapi/tests/test_broker.cc contain non-mechanical changes. Variable naming within the latter is updated per r178174. Missing #includes for <errno.h> in content/zygote/zygote_main_linux.cc and tools/android/common/daemon.cc were manually added. Mechanical changes were generated by running: sed -E -i '' \ -e 's/((=|if|return|CHECK|EXPECT|ASSERT).*)HANDLE(_EINTR\(.*close)/\1IGNORE\3/' \ -e 's/(ignore_result|void ?)\(HANDLE_EINTR\((.*close\(.*)\)\)/\2/' \ -e 's/(\(void\) ?)?HANDLE_EINTR\((.*close\(.*)\)/\2/' \ $(git grep -El 'HANDLE_EINTR.*close') sed -E -i '' -e '/#include.*eintr_wrapper\.h"/d' \ $(grep -EL '(HANDLE|IGNORE)_EINTR' \ $(git grep -El '#include.*eintr_wrapper\.h"')) BUG=269623 R=agl@chromium.org, jln@chromium.org TBR=OWNERS Review URL: https://codereview.chromium.org/100253002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238390 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/render_sandbox_host_linux.cc12
-rw-r--r--content/browser/renderer_host/render_widget_helper.cc4
-rw-r--r--content/common/font_config_ipc_linux.cc2
-rw-r--r--content/common/gpu/media/exynos_video_decode_accelerator.cc6
-rw-r--r--content/common/gpu/media/exynos_video_encode_accelerator.cc8
-rw-r--r--content/common/plugin_list_posix.cc2
-rw-r--r--content/common/sandbox_linux.cc2
-rw-r--r--content/plugin/plugin_channel.cc1
-rw-r--r--content/zygote/zygote_main_linux.cc4
9 files changed, 20 insertions, 21 deletions
diff --git a/content/browser/renderer_host/render_sandbox_host_linux.cc b/content/browser/renderer_host/render_sandbox_host_linux.cc
index b35ac73..a018043 100644
--- a/content/browser/renderer_host/render_sandbox_host_linux.cc
+++ b/content/browser/renderer_host/render_sandbox_host_linux.cc
@@ -241,7 +241,7 @@ class SandboxIPCProcess {
SendRendererReply(fds, reply, result_fd);
if (result_fd >= 0) {
- int err = HANDLE_EINTR(close(result_fd));
+ int err = IGNORE_EINTR(close(result_fd));
DCHECK(!err);
}
}
@@ -516,7 +516,7 @@ class SandboxIPCProcess {
SendRendererReply(fds, reply, font_fd);
if (font_fd >= 0) {
- if (HANDLE_EINTR(close(font_fd)) < 0)
+ if (IGNORE_EINTR(close(font_fd)) < 0)
PLOG(ERROR) << "close";
}
}
@@ -718,9 +718,9 @@ void RenderSandboxHostLinux::Init(const std::string& sandbox_path) {
#endif
pid_ = fork();
if (pid_ == 0) {
- if (HANDLE_EINTR(close(fds[0])) < 0)
+ if (IGNORE_EINTR(close(fds[0])) < 0)
DPLOG(ERROR) << "close";
- if (HANDLE_EINTR(close(pipefds[1])) < 0)
+ if (IGNORE_EINTR(close(pipefds[1])) < 0)
DPLOG(ERROR) << "close";
SandboxIPCProcess handler(child_lifeline_fd, browser_socket, sandbox_path);
@@ -731,9 +731,9 @@ void RenderSandboxHostLinux::Init(const std::string& sandbox_path) {
RenderSandboxHostLinux::~RenderSandboxHostLinux() {
if (initialized_) {
- if (HANDLE_EINTR(close(renderer_socket_)) < 0)
+ if (IGNORE_EINTR(close(renderer_socket_)) < 0)
PLOG(ERROR) << "close";
- if (HANDLE_EINTR(close(childs_lifeline_fd_)) < 0)
+ if (IGNORE_EINTR(close(childs_lifeline_fd_)) < 0)
PLOG(ERROR) << "close";
}
}
diff --git a/content/browser/renderer_host/render_widget_helper.cc b/content/browser/renderer_host/render_widget_helper.cc
index 7f772e3..10e4e0f 100644
--- a/content/browser/renderer_host/render_widget_helper.cc
+++ b/content/browser/renderer_host/render_widget_helper.cc
@@ -381,7 +381,7 @@ void RenderWidgetHelper::FreeTransportDIB(TransportDIB::Id dib_id) {
i = allocated_dibs_.find(dib_id);
if (i != allocated_dibs_.end()) {
- if (HANDLE_EINTR(close(i->second)) < 0)
+ if (IGNORE_EINTR(close(i->second)) < 0)
PLOG(ERROR) << "close";
allocated_dibs_.erase(i);
} else {
@@ -392,7 +392,7 @@ void RenderWidgetHelper::FreeTransportDIB(TransportDIB::Id dib_id) {
void RenderWidgetHelper::ClearAllocatedDIBs() {
for (std::map<TransportDIB::Id, int>::iterator
i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) {
- if (HANDLE_EINTR(close(i->second)) < 0)
+ if (IGNORE_EINTR(close(i->second)) < 0)
PLOG(ERROR) << "close: " << i->first;
}
diff --git a/content/common/font_config_ipc_linux.cc b/content/common/font_config_ipc_linux.cc
index b61a8cc..2d976c4 100644
--- a/content/common/font_config_ipc_linux.cc
+++ b/content/common/font_config_ipc_linux.cc
@@ -33,7 +33,7 @@ SkStream* StreamFromFD(int fd) {
}
void CloseFD(int fd) {
- int err = HANDLE_EINTR(close(fd));
+ int err = IGNORE_EINTR(close(fd));
DCHECK(!err);
}
diff --git a/content/common/gpu/media/exynos_video_decode_accelerator.cc b/content/common/gpu/media/exynos_video_decode_accelerator.cc
index 26fe624..cfa3443 100644
--- a/content/common/gpu/media/exynos_video_decode_accelerator.cc
+++ b/content/common/gpu/media/exynos_video_decode_accelerator.cc
@@ -221,13 +221,13 @@ ExynosVideoDecodeAccelerator::~ExynosVideoDecodeAccelerator() {
DCHECK(!device_poll_thread_.IsRunning());
if (device_poll_interrupt_fd_ != -1) {
- HANDLE_EINTR(close(device_poll_interrupt_fd_));
+ close(device_poll_interrupt_fd_);
device_poll_interrupt_fd_ = -1;
}
if (mfc_fd_ != -1) {
DestroyMfcInputBuffers();
DestroyMfcOutputBuffers();
- HANDLE_EINTR(close(mfc_fd_));
+ close(mfc_fd_);
mfc_fd_ = -1;
}
@@ -1906,7 +1906,7 @@ void ExynosVideoDecodeAccelerator::DestroyMfcOutputBuffers() {
MfcOutputRecord& output_record = mfc_output_buffer_map_[i];
for (size_t j = 0; j < arraysize(output_record.fds); ++j) {
if (output_record.fds[j] != -1)
- HANDLE_EINTR(close(output_record.fds[j]));
+ close(output_record.fds[j]);
if (output_record.egl_image != EGL_NO_IMAGE_KHR)
eglDestroyImageKHR(egl_display_, output_record.egl_image);
if (output_record.egl_sync != EGL_NO_SYNC_KHR)
diff --git a/content/common/gpu/media/exynos_video_encode_accelerator.cc b/content/common/gpu/media/exynos_video_encode_accelerator.cc
index 4c8e8e5..e8a2196 100644
--- a/content/common/gpu/media/exynos_video_encode_accelerator.cc
+++ b/content/common/gpu/media/exynos_video_encode_accelerator.cc
@@ -115,19 +115,19 @@ ExynosVideoEncodeAccelerator::~ExynosVideoEncodeAccelerator() {
DCHECK(!device_poll_thread_.IsRunning());
if (device_poll_interrupt_fd_ != -1) {
- HANDLE_EINTR(close(device_poll_interrupt_fd_));
+ close(device_poll_interrupt_fd_);
device_poll_interrupt_fd_ = -1;
}
if (gsc_fd_ != -1) {
DestroyGscInputBuffers();
DestroyGscOutputBuffers();
- HANDLE_EINTR(close(gsc_fd_));
+ close(gsc_fd_);
gsc_fd_ = -1;
}
if (mfc_fd_ != -1) {
DestroyMfcInputBuffers();
DestroyMfcOutputBuffers();
- HANDLE_EINTR(close(mfc_fd_));
+ close(mfc_fd_);
mfc_fd_ = -1;
}
}
@@ -1512,7 +1512,7 @@ void ExynosVideoEncodeAccelerator::DestroyMfcInputBuffers() {
MfcInputRecord& input_record = mfc_input_buffer_map_[buf];
for (size_t plane = 0; plane < arraysize(input_record.fd); ++plane)
- HANDLE_EINTR(close(mfc_input_buffer_map_[buf].fd[plane]));
+ close(mfc_input_buffer_map_[buf].fd[plane]);
}
struct v4l2_requestbuffers reqbufs;
diff --git a/content/common/plugin_list_posix.cc b/content/common/plugin_list_posix.cc
index a5d7fac..abc74ba 100644
--- a/content/common/plugin_list_posix.cc
+++ b/content/common/plugin_list_posix.cc
@@ -173,7 +173,7 @@ bool ELFMatchesCurrentArchitecture(const base::FilePath& filename) {
if (fd < 0)
return false;
bool ret = (fstat(fd, &stat_buf) >= 0 && S_ISREG(stat_buf.st_mode));
- if (HANDLE_EINTR(close(fd)) < 0)
+ if (IGNORE_EINTR(close(fd)) < 0)
return false;
if (!ret)
return false;
diff --git a/content/common/sandbox_linux.cc b/content/common/sandbox_linux.cc
index b9cfe0e..85a3e36 100644
--- a/content/common/sandbox_linux.cc
+++ b/content/common/sandbox_linux.cc
@@ -289,7 +289,7 @@ bool LinuxSandbox::HasOpenDirectories() {
void LinuxSandbox::SealSandbox() {
if (proc_fd_ >= 0) {
- int ret = HANDLE_EINTR(close(proc_fd_));
+ int ret = IGNORE_EINTR(close(proc_fd_));
CHECK_EQ(0, ret);
proc_fd_ = -1;
}
diff --git a/content/plugin/plugin_channel.cc b/content/plugin/plugin_channel.cc
index fe618c7..089c4ed 100644
--- a/content/plugin/plugin_channel.cc
+++ b/content/plugin/plugin_channel.cc
@@ -23,7 +23,6 @@
#include "third_party/WebKit/public/web/WebBindings.h"
#if defined(OS_POSIX)
-#include "base/posix/eintr_wrapper.h"
#include "ipc/ipc_channel_posix.h"
#endif
diff --git a/content/zygote/zygote_main_linux.cc b/content/zygote/zygote_main_linux.cc
index 93ab269..1d32ab0 100644
--- a/content/zygote/zygote_main_linux.cc
+++ b/content/zygote/zygote_main_linux.cc
@@ -5,6 +5,7 @@
#include "content/zygote/zygote_main.h"
#include <dlfcn.h>
+#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <stdio.h>
@@ -21,7 +22,6 @@
#include "base/linux_util.h"
#include "base/native_library.h"
#include "base/pickle.h"
-#include "base/posix/eintr_wrapper.h"
#include "base/posix/unix_domain_socket_linux.h"
#include "base/rand_util.h"
#include "base/sys_info.h"
@@ -311,7 +311,7 @@ static void PreSandboxInit() {
}
static void CloseFdAndHandleEintr(int fd) {
- (void) HANDLE_EINTR(close(fd));
+ close(fd);
}
// This will set the *using_suid_sandbox variable to true if the SUID sandbox