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

Unified Diff: sandbox/linux/services/proc_util.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « sandbox/linux/services/proc_util.h ('k') | sandbox/linux/services/resource_limits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/services/proc_util.cc
diff --git a/sandbox/linux/services/proc_util.cc b/sandbox/linux/services/proc_util.cc
index fd0e34826e787c58ea07ed2aa98044bd95002908..13d8842f788b453393f7ca802e2f3c0b6d2110a1 100644
--- a/sandbox/linux/services/proc_util.cc
+++ b/sandbox/linux/services/proc_util.cc
@@ -13,6 +13,7 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/posix/eintr_wrapper.h"
#include "base/strings/string_number_conversions.h"
namespace sandbox {
@@ -31,7 +32,8 @@ typedef scoped_ptr<DIR, DIRCloser> ScopedDIR;
int ProcUtil::CountOpenFds(int proc_fd) {
DCHECK_LE(0, proc_fd);
- int proc_self_fd = openat(proc_fd, "self/fd", O_DIRECTORY | O_RDONLY);
+ int proc_self_fd = HANDLE_EINTR(
+ openat(proc_fd, "self/fd", O_DIRECTORY | O_RDONLY | O_CLOEXEC));
PCHECK(0 <= proc_self_fd);
// Ownership of proc_self_fd is transferred here, it must not be closed
@@ -109,4 +111,13 @@ bool ProcUtil::HasOpenDirectory(int proc_fd) {
return false;
}
+//static
+base::ScopedFD ProcUtil::OpenProcSelfTask() {
+ base::ScopedFD proc_self_task(
+ HANDLE_EINTR(
+ open("/proc/self/task/", O_RDONLY | O_DIRECTORY | O_CLOEXEC)));
+ PCHECK(proc_self_task.is_valid());
+ return proc_self_task.Pass();
+}
+
} // namespace sandbox
« no previous file with comments | « sandbox/linux/services/proc_util.h ('k') | sandbox/linux/services/resource_limits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698