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

Side by Side Diff: sandbox/linux/services/scoped_process.cc

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sandbox/linux/services/scoped_process.h" 5 #include "sandbox/linux/services/scoped_process.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <signal.h> 8 #include <signal.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <sys/syscall.h> 10 #include <sys/syscall.h>
11 #include <sys/types.h> 11 #include <sys/types.h>
12 #include <sys/wait.h> 12 #include <sys/wait.h>
13 #include <unistd.h> 13 #include <unistd.h>
14 14
15 #include "base/basictypes.h"
16 #include "base/callback.h" 15 #include "base/callback.h"
17 #include "base/logging.h" 16 #include "base/logging.h"
18 #include "base/posix/eintr_wrapper.h" 17 #include "base/posix/eintr_wrapper.h"
19 #include "build/build_config.h" 18 #include "build/build_config.h"
20 #include "sandbox/linux/services/syscall_wrappers.h" 19 #include "sandbox/linux/services/syscall_wrappers.h"
21 #include "sandbox/linux/services/thread_helpers.h" 20 #include "sandbox/linux/services/thread_helpers.h"
22 21
23 namespace sandbox { 22 namespace sandbox {
24 23
25 namespace { 24 namespace {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // It would be problematic if after a fork(), another process would start using 110 // It would be problematic if after a fork(), another process would start using
112 // this object. 111 // this object.
113 // This method allows to assert it is not happening. 112 // This method allows to assert it is not happening.
114 bool ScopedProcess::IsOriginalProcess() { 113 bool ScopedProcess::IsOriginalProcess() {
115 // Make a direct syscall to bypass glibc caching of PIDs. 114 // Make a direct syscall to bypass glibc caching of PIDs.
116 pid_t pid = sys_getpid(); 115 pid_t pid = sys_getpid();
117 return pid == process_id_; 116 return pid == process_id_;
118 } 117 }
119 118
120 } // namespace sandbox 119 } // namespace sandbox
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698