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: Christian Brauner <christian.brauner@ubuntu.com>
#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"
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