Re: fork() source code

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

 



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
> 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()"? I saw the same
description about fork() in the book "Linux Kernel Development"
written by Mr. Robert Love. The page 23 of the book says :

	The fork(), vfork(), and __clone() library calls call clone()
	with the requisite flags. The clone() system call, in turn,
	calls do_fork().

I checked the glibc-2.3.2 source, and found the following files:
  ./sysdeps/unix/sysv/linux/ia64/fork.S
  ./sysdeps/unix/sysv/linux/ia64/vfork.S 
implemented fork() and vfork() by using clone(). So I think the
description above is perfectly true as the glibc for the ia64
architecture.

But as for the i386 or ia32 architecture, I couldn't found any source
which implements fork() or vfork() via clone().

I (and maybe the original poster) want to know how clone() is called
by fork or vfork in the glibc for i386, and which fork or vfork source
is used. If you knew the trick of it, please let us know.

=---=---=---=---=---=---=---=---=---=---=---=---=---=
Kawabata Koichi                   kkoichi@lepoche.com
L'epoche.com: Put all practical interests in brackets
=---=---=---=---=---=---=---=---=---=---=---=---=---=
--
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