| ▲ | oguz-ismail2 5 hours ago | |||||||||||||||||||||||||||||||
> But it cannot be called directly from C No system call can, you need a wrapper like syscall() provided by glibc. glibc also provides a dedicated wrapper for the clone system call which properly sets up the return address for the child thread. No idea what you're angry about | ||||||||||||||||||||||||||||||||
| ▲ | muvlon 5 hours ago | parent [-] | |||||||||||||||||||||||||||||||
Sure, you need a tiny bit of asm to do the actual syscall. That's not what I'm talking about. Most syscalls are easy to wrap, clone is slightly harder but doable (as evidenced by glibc). clone3 is for all intents and purposes impossible to write a general C wrapper for. It allows you to create situations such as threads that share virtual memory but not file descriptors, or vice-versa. That is, it can leave the caller in a situation that violates core assumptions by libc. | ||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||