Re: fork() source code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Koichi Kawabata <kkoichi@lepoche.com> writes:

> Hi:
>
> I'm not the original poster, but I come to have the similar question
> as he may have.
>
> Ed L Cashin <ecashin@uga.edu> wrote on Sun, 14 Dec 2003 19:41:13 -0500
>> > Shinpei Kato <shinny@j02.itscom.net> writes:
>> > So I want to know how the fork() set the parameter.
>> > And to confirm it, I want the source code of fork().
>> 
>> In glibc, see ./sysdeps/unix/sysv/linux/i386/clone.S, where the

Check out that file if you haven't already.  It seems to have what
you're looking for.

>> registers are set up and the "int 0x80" instruction is used to trap
>> into the O.S. system call handler.
>> 
>> The clone system call is how forking is done nowadays.
>
> You mean to say "glibc implements fork() via clone()"? 

Not really.  In fact, I was a little misleading.  There are two
different linux system calls: clone and fork.  From glibc's
perspective, it could call either one to do a fork.  I don't know
whether on i386 linux it uses one or both, but the file I mentioned
above has code for using the clone system call.

-- 
--Ed L Cashin            |   PGP public key:
  ecashin@uga.edu        |   http://noserose.net/e/pgp/

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux