libc 库中 pthread_create 通过层层封装,最终通过调用clone 系统调用创建线程。
libc 代码中:
pthread_create.c中,
函数调用关系 __pthread_create_2_1 -》create_thread-》do_clone
create_thread 函数传递给do_clone 的flag 为
/* We rely heavily on various flags the CLONE function understands:
CLONE_VM (共享内存描述符和所有页表), CLONE_FS (共享根目录和当前工作目录所在的表,以及用于屏蔽新文件许可权的位掩码值), CLONE_FILES(共享打开文件表)
These flags select semantics with shared address space and
file descriptors according to what POSIX requires.
CLONE_SIGNAL
This flag selects the POSIX signal semantics.
CLONE_SETTLS
The sixth parameter to CLONE determines the TLS area for the