LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-24-2007, 03:02 AM   #1
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
Question How to implement vfork using clone?


Hi everyone! I am using a 2.6.10 kernel. In user space, how will I implement the vfork() system call using the clone system call? what should I place in the child stack argument knowing that in vfork, the child execute in the same address space as in the parent?

The definition of clone is:
int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg);

Thanks!
 
Old 04-24-2007, 08:00 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
You might want to look at an open source libc implementation (e.g., glibc, dietlibc, uClibc, etc.).
 
Old 04-24-2007, 08:23 PM   #3
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Original Poster
Rep: Reputation: 41
Thanks! But where can I find these libc's? I have tried to use this one:

void *child_stack;
child stack = malloc(10000);

clone(myfunc, child_stack, CLONE_VM|CLONE_VFORK|SIGCHLD, 0);

but it gives me an error like library something not found in "lib.so" something.
However when I tried not to include the CLONE_VM, the task is created but at the end, there is always a segmentation fault message.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
best way to implement syslog slug420 Linux - General 2 03-21-2007 01:23 PM
rsync : how to use and implement indiancosmonaut Solaris / OpenSolaris 8 03-04-2007 11:54 PM
vfork: resource temporarily unavailable verbose Linux - General 5 02-04-2007 04:17 AM
Shell implement in c SatYr_84 Programming 8 10-06-2005 12:44 AM
fork vs. vfork gearoid Programming 2 11-28-2003 02:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration