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

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

Issue 801033002: Use the libc clone wrapper in sys_clone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo. Created 6 years 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
Index: sandbox/linux/services/syscall_wrappers_unittest.cc
diff --git a/sandbox/linux/services/syscall_wrappers_unittest.cc b/sandbox/linux/services/syscall_wrappers_unittest.cc
index 861dd5feb1c02aa7ece96186694f6b7b675a19f1..79ed63d68910ab0e64f134165a6bda9878856424 100644
--- a/sandbox/linux/services/syscall_wrappers_unittest.cc
+++ b/sandbox/linux/services/syscall_wrappers_unittest.cc
@@ -39,14 +39,18 @@ TEST(SyscallWrappers, CloneParentSettid) {
}
TEST(SyscallWrappers, CloneChildSettid) {
+ // Warm up the libc pid cache, if there is one.
+ ASSERT_EQ(sys_getpid(), getpid());
+
pid_t ctid = 0;
pid_t pid =
sys_clone(CLONE_CHILD_SETTID | SIGCHLD, nullptr, nullptr, &ctid, nullptr);
const int kSuccessExit = 0;
if (0 == pid) {
- // In child.
- if (sys_getpid() == ctid)
+ // In child. Check both the raw getpid syscall and the libc getpid wrapper
+ // (which may rely on a pid cache).
+ if (sys_getpid() == ctid && getpid() == ctid)
_exit(kSuccessExit);
_exit(1);
}
« sandbox/linux/services/syscall_wrappers.cc ('K') | « sandbox/linux/services/syscall_wrappers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698