| 1 | #ifndef _CLONE_INTERNAL_H |
| 2 | #define _CLONE_INTERNAL_H |
| 3 | |
| 4 | #include <clone3.h> |
| 5 | |
| 6 | /* The clone3 syscall provides a superset of the functionality of the clone |
| 7 | interface. The kernel might extend __CL_ARGS struct in the future, with |
| 8 | each version with a different __SIZE. If the child is created, it will |
| 9 | start __FUNC function with __ARG arguments. |
| 10 | |
| 11 | Different than kernel, the implementation also returns EINVAL for an |
| 12 | invalid NULL __CL_ARGS or __FUNC (similar to __clone). |
| 13 | |
| 14 | All callers are responsible for correctly aligning the stack. The stack is |
| 15 | not aligned prior to the syscall (this differs from the exported __clone). |
| 16 | |
| 17 | This function is only implemented if the ABI defines HAVE_CLONE3_WRAPPER. |
| 18 | */ |
| 19 | extern int __clone3 (struct clone_args *__cl_args, size_t __size, |
| 20 | int (*__func) (void *__arg), void *__arg); |
| 21 | |
| 22 | /* The internal wrapper of clone/clone2 and clone3. Different than __clone3, |
| 23 | it will align the stack if required. If __clone3 returns -1 with ENOSYS, |
| 24 | fall back to clone or clone2. */ |
| 25 | extern int __clone_internal (struct clone_args *__cl_args, |
| 26 | int (*__func) (void *__arg), void *__arg); |
| 27 | /* clone3 wrapper with a sticky check to avoid re-issuing the syscall if |
| 28 | it fails with ENOSYS. */ |
| 29 | extern int __clone3_internal (struct clone_args *cl_args, |
| 30 | int (*func) (void *args), void *arg) |
| 31 | attribute_hidden; |
| 32 | /* The fallback code which calls clone/clone2 based on clone3 arguments. */ |
| 33 | extern int __clone_internal_fallback (struct clone_args *__cl_args, |
| 34 | int (*__func) (void *__arg), |
| 35 | void *__arg) |
| 36 | attribute_hidden; |
| 37 | |
| 38 | #ifndef _ISOMAC |
| 39 | libc_hidden_proto (__clone3) |
| 40 | libc_hidden_proto (__clone_internal) |
| 41 | #endif |
| 42 | |
| 43 | #endif |
| 44 | |