Linux kernel development by Robert Love describes the fork process as fork() -> clone() -> do_fork() -> copy_process() I am unable to find the clone() system call in linux 3.13. Can someone explain the proper flow of fork() system call initiated by the user? Where can I find the libc implementation for fork()? I want the code of all the functions involved in fork.
On Mon, Apr 18, 2016 at 12:48 AM, Nitin Varyani <varyani.nitin1@gmail.com> wrote:
Linux kernel development by Robert Love describes the fork process as
fork() -> clone() -> do_fork() -> copy_process()
I am unable to find the clone() system call in linux 3.13. Can someone explain the proper flow of fork() system call initiated by the user?
Where can I find the libc implementation for fork()? I want the code of all the functions involved in fork.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
I believe the fork and clone syscalls are found at /kernel/fork.c under 3.13. (see link below) They're wrapped in the nice SYSCALL_DEFINE# macros and all seem to call do_fork(). http://lxr.free-electrons.com/source/kernel/fork.c?v=3.13#L1641 Can't really help you on the libc part, and you would need to specify which libc implementation you're interested in.
On Mon, Apr 18, 2016 at 12:18:00PM +0530, Nitin Varyani wrote:
Linux kernel development by Robert Love describes the fork process as
fork() -> clone() -> do_fork() -> copy_process()
I am unable to find the clone() system call in linux 3.13. Can someone explain the proper flow of fork() system call initiated by the user?
Where can I find the libc implementation for fork()? I want the code of all the functions involved in fork.
There are a couple of libc implemetations out there, say musl, dietlibc, uClibc and so on. But If you mean GNU libc aka. glibc then this is what you are looking for: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/nptl/fork.c;h=1a68c... __libc_fork() calls clone() syscall internally using a bit of assembler magic.
participants (3)
-
Alex Wilson -
Cihangir Akturk -
Nitin Varyani