LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 04: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, 09:00 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 75
You might want to look at an open source libc implementation (e.g., glibc, dietlibc, uClibc, etc.).
 
Old 04-24-2007, 09: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 02:23 PM
rsync : how to use and implement indiancosmonaut Solaris / OpenSolaris 8 03-05-2007 12:54 AM
vfork: resource temporarily unavailable verbose Linux - General 5 02-04-2007 05:17 AM
Shell implement in c SatYr_84 Programming 8 10-06-2005 01:44 AM
fork vs. vfork gearoid Programming 2 11-28-2003 03:51 AM


All times are GMT -5. The time now is 10:51 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration