process-util: use clone2 on ia64

glibc does not provide clone() on ia64, only clone2. But only as a
symbol in the shared library, there's no prototype in the gblic
headers, so we have to define it, copied from the manpage.
This commit is contained in:
Luca Boccassi
2023-07-10 11:39:35 +01:00
parent 5bf36ce524
commit 840ac5cd1a
2 changed files with 18 additions and 0 deletions
+4
View File
@@ -1177,7 +1177,11 @@ pid_t clone_with_nested_stack(int (*fn)(void *), int flags, void *userdata) {
mystack = (uint8_t*) mystack + ps; /* move pointer one page ahead since stacks usually grow backwards */
mystack = (void*) ALIGN_TO((uintptr_t) mystack, ps); /* align to page size (moving things further ahead) */
#if HAVE_CLONE
pid = clone(fn, mystack, flags, userdata);
#else
pid = __clone2(fn, mystack, ps, flags, userdata);
#endif
if (pid < 0)
return -errno;