Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Unified Diff: base/files/file_util_posix.cc

Issue 2401863004: Revert of Open MessagePumpLibevent's pipe with O_CLOEXEC (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/files/file_util.h ('k') | base/message_loop/message_pump_libevent.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_util_posix.cc
diff --git a/base/files/file_util_posix.cc b/base/files/file_util_posix.cc
index 2f32b50fd202b8dcea365b2dbdc5d7fadd74db73..42de9316f1c9b02aa803feb8113c6a03d958e5c7 100644
--- a/base/files/file_util_posix.cc
+++ b/base/files/file_util_posix.cc
@@ -351,29 +351,6 @@
}
#endif // !defined(OS_NACL_NONSFI)
-bool CreateLocalNonBlockingPipe(int fds[2]) {
-#if defined(OS_LINUX)
- return pipe2(fds, O_CLOEXEC | O_NONBLOCK) == 0;
-#else
- int raw_fds[2];
- if (pipe(raw_fds) != 0)
- return false;
- ScopedFD fd_out(raw_fds[0]);
- ScopedFD fd_in(raw_fds[1]);
- if (!SetCloseOnExec(fd_out.get()))
- return false;
- if (!SetCloseOnExec(fd_in.get()))
- return false;
- if (!SetNonBlocking(fd_out.get()))
- return false;
- if (!SetNonBlocking(fd_in.get()))
- return false;
- fds[0] = fd_out.release();
- fds[1] = fd_in.release();
- return true;
-#endif
-}
-
bool SetNonBlocking(int fd) {
const int flags = fcntl(fd, F_GETFL);
if (flags == -1)
@@ -381,17 +358,6 @@
if (flags & O_NONBLOCK)
return true;
if (HANDLE_EINTR(fcntl(fd, F_SETFL, flags | O_NONBLOCK)) == -1)
- return false;
- return true;
-}
-
-bool SetCloseOnExec(int fd) {
- const int flags = fcntl(fd, F_GETFD);
- if (flags == -1)
- return false;
- if (flags & FD_CLOEXEC)
- return true;
- if (HANDLE_EINTR(fcntl(fd, F_SETFD, flags | FD_CLOEXEC)) == -1)
return false;
return true;
}
« no previous file with comments | « base/files/file_util.h ('k') | base/message_loop/message_pump_libevent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698