mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-28 12:57:57 +00:00
criu: Add raw fork() implementation
Glibc has BUG with process creation: https://sourceware.org/bugzilla/show_bug.cgi?id=21386 It doesn't behave well when parent and child are from different pid namespaces and have the same pid. Use raw syscall without glibc's asserts as workaround. Also, use raw syscall for getpid() in tests too, as these two function go in the pair (glibc's getpid() relies on glibc's fork()). Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
ad741662b8
commit
e997d34b0c
@ -1459,3 +1459,12 @@ int getpid()
|
||||
{
|
||||
return syscall(__NR_getpid);
|
||||
}
|
||||
|
||||
/*
|
||||
* In glibc 2.24, fork() may fail when parent and child are
|
||||
* from different pid namespaces and have the same pid.
|
||||
*/
|
||||
pid_t fork()
|
||||
{
|
||||
return (pid_t)syscall(__NR_clone, SIGCHLD, 0, NULL, 0, NULL);
|
||||
}
|
||||
|
@ -296,3 +296,13 @@ void test_waitsig(void)
|
||||
{
|
||||
futex_wait_while(&sig_received, 0);
|
||||
}
|
||||
|
||||
pid_t fork()
|
||||
{
|
||||
return (pid_t)syscall(__NR_clone, SIGCHLD, 0, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
int getpid()
|
||||
{
|
||||
return syscall(__NR_getpid);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user