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

Unified Diff: base/process/process.h

Issue 831373002: Move ForkWithFlags from sandbox/ to base/ and plug it into LaunchProcess. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
Index: base/process/process.h
diff --git a/base/process/process.h b/base/process/process.h
index ad8f8eec888f2e7c9297a15d0d693f36af0c871e..3047c3f03883e0c84c65fca4bcb7cea21a828ddb 100644
--- a/base/process/process.h
+++ b/base/process/process.h
@@ -112,6 +112,19 @@ class BASE_EXPORT Process {
#endif
};
+#if defined(OS_LINUX)
+// A wrapper for clone with fork-like behavior, meaning that it returns the
+// child's pid in the parent and 0 in the child. |flags|, |ptid|, and |ctid| are
+// as in the clone system call (the CLONE_VM flag is not supported).
+//
+// This function uses the libc clone wrapper (which updates libc's pid cache)
+// internally, so callers may expect things like getpid() to work correctly
+// after in both the child and parent. An exception is when this code is run
+// under Valgrind. Valgrind does not support the libc clone wrapper, so the libc
+// pid cache may be incorrect after this function is called under Valgrind.
+BASE_EXPORT pid_t ForkWithFlags(unsigned long flags, pid_t* ptid, pid_t* ctid);
jln (very slow on Chromium) 2015/01/06 00:22:31 It may be useful to warn about the usual fork() is
rickyz (no longer on Chrome) 2015/01/06 02:45:37 Done.
+#endif
+
} // namespace base
#endif // BASE_PROCESS_PROCESS_PROCESS_H_

Powered by Google App Engine
This is Rietveld 408576698