• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <unistd.h>
2 #include "pthread_impl.h"
3 #include "syscall.h"
4 
__get_cached_pid()5 static pid_t __get_cached_pid()
6 {
7 	return __pthread_self()->pid;
8 }
9 
getpid(void)10 pid_t getpid(void)
11 {
12 	pid_t pid = __get_cached_pid();
13 	if (pid != 0) {
14 		return pid;
15 	}
16 	return __syscall(SYS_getpid);
17 }
18