Fix gettid() in functions that call fork() or equivalent.
Bug: https://github.com/android/ndk/issues/2024
Change-Id: Ia264ce219fac99e8823e60c4a2e0607af8518056
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index 2732214..bc708e1 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -113,8 +113,22 @@
*/
pid_t vfork(void) __returns_twice;
+/**
+ * [getpid(2)](http://man7.org/linux/man-pages/man2/getpid.2.html) returns
+ * the caller's process ID.
+ *
+ * Returns the caller's process ID.
+ */
pid_t getpid(void);
-pid_t gettid(void) __attribute_const__;
+
+/**
+ * [gettid(2)](http://man7.org/linux/man-pages/man2/gettid.2.html) returns
+ * the caller's thread ID.
+ *
+ * Returns the caller's thread ID.
+ */
+pid_t gettid(void);
+
pid_t getpgid(pid_t __pid);
int setpgid(pid_t __pid, pid_t __pgid);
pid_t getppid(void);