Skip to content

Commit 58812e7

Browse files
committed
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 <[email protected]> Signed-off-by: Andrew Clayton <[email protected]>
1 parent b9c1a29 commit 58812e7

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

src/nxt_process.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,8 @@
1313
#endif
1414

1515

16-
#if (NXT_HAVE_LINUX_NS)
17-
/*
18-
* Old glibc wrapper for getpid(2) returns a cached pid invalidated only by
19-
* fork(2) calls. As we use clone(2) for container, it returns the wrong pid.
20-
*/
21-
#define nxt_getpid() \
22-
syscall(SYS_getpid)
23-
#else
2416
#define nxt_getpid() \
2517
getpid()
26-
#endif
2718

2819
typedef pid_t nxt_pid_t;
2920

0 commit comments

Comments
 (0)