From mboxrd@z Thu Jan 1 00:00:00 1970 From: cakturk@gmail.com (Cihangir Akturk) Date: Mon, 18 Apr 2016 11:18:50 +0300 Subject: fork In-Reply-To: References: Message-ID: <20160418081850.GA12586@portege.ulakbim.gov.tr> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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=1a68cbd6476b3268b5b7ac09ae60c35ce7069219;hb=HEAD#l47 __libc_fork() calls clone() syscall internally using a bit of assembler magic.