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 b01b36e9
......@@ -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"
......@@ -119,4 +120,13 @@ extern int lxc_namespace_2_cloneflag(const char *namespace);
extern int lxc_namespace_2_ns_idx(const 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