mirror of https://git.musl-libc.org/git/musl
Browse Source
The architecture-specific assembly versions of clone did not set errno on failure, which is inconsistent with glibc. __clone still returns the error via its return value, and clone is now a wrapper that sets errno as needed. The public clone has also been moved to src/linux, as it's not directly related to the pthreads API. __clone is called by pthread_create, which does not report errors via errno. Though not strictly necessary, it's nice to avoid clobbering errno here.rs-1.0
6 changed files with 22 additions and 18 deletions
@ -0,0 +1,19 @@ |
|||
#include <stdarg.h> |
|||
#include <unistd.h> |
|||
#include "pthread_impl.h" |
|||
#include "syscall.h" |
|||
|
|||
int clone(int (*func)(void *), void *stack, int flags, void *arg, ...) |
|||
{ |
|||
va_list ap; |
|||
pid_t *ptid, *ctid; |
|||
void *tls; |
|||
|
|||
va_start(ap, arg); |
|||
ptid = va_arg(ap, pid_t *); |
|||
tls = va_arg(ap, void *); |
|||
ctid = va_arg(ap, pid_t *); |
|||
va_end(ap); |
|||
|
|||
return __syscall_ret(__clone(func, stack, flags, arg, ptid, tls, ctid)); |
|||
} |
|||
Loading…
Reference in new issue