Isolation: Remove the syscall(SYS_getpid) wrapper.
When using SYS_clone we used the getpid kernel system call directly via syscall(SYS_getpid) to avoid issues with cached pids. However since we are now only using fork(2) (+ unshare(2) for namespaces) we no longer need to call the kernel getpid directly as the fork(2) will ensure the cached pid is invalidated. Reviewed-by: Alejandro Colomar <alx@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
This commit is contained in:
@@ -13,17 +13,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if (NXT_HAVE_LINUX_NS)
|
|
||||||
/*
|
|
||||||
* Old glibc wrapper for getpid(2) returns a cached pid invalidated only by
|
|
||||||
* fork(2) calls. As we use clone(2) for container, it returns the wrong pid.
|
|
||||||
*/
|
|
||||||
#define nxt_getpid() \
|
|
||||||
syscall(SYS_getpid)
|
|
||||||
#else
|
|
||||||
#define nxt_getpid() \
|
#define nxt_getpid() \
|
||||||
getpid()
|
getpid()
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef pid_t nxt_pid_t;
|
typedef pid_t nxt_pid_t;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user