namespace: add lxc_raw_getpid()

Because of older glibc's pid cache (up to 2.25) whenever clone() is called the child must must retrieve it's own pid via lxc_raw_getpid(). Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 7831a82c
......@@ -23,8 +23,9 @@
#ifndef __LXC_NAMESPACE_H
#define __LXC_NAMESPACE_H
#include <sys/syscall.h>
#include <sched.h>
#include <unistd.h>
#include <sys/syscall.h>
#include "config.h"
......@@ -117,4 +118,13 @@ extern pid_t lxc_raw_clone(unsigned long flags);
extern int lxc_namespace_2_cloneflag(char *namespace);
extern int lxc_fill_namespace_flags(char *flaglist, int *flags);
/**
* Because of older glibc's pid cache (up to 2.25) whenever clone() is called
* the child must must retrieve it's own pid via lxc_raw_getpid().
*/
static inline pid_t lxc_raw_getpid(void)
{
return (pid_t) syscall(SYS_getpid);
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment