LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-06-2007, 05:18 AM   #1
jack_zhou
LQ Newbie
 
Registered: Aug 2007
Posts: 3

Rep: Reputation: 0
uclinux fork problem


hi all,
my uclinux kernel version is 2.4.22, and uclibc version is 0.9.26. Now I have cross compiled konq/e and qte. but i have found fork() does not work well on my system.
when it calls fork(), the child process halted. I changed it to vfork(), then parent process halted. here is the test program.
Code:
#include <stdio.h>
#include <unistd.h>
int main()
{
        if(vfork() == 0){
                printf("Child process\n");
                sleep(5);
        }
        else{
                printf("Parent process\n");
        }
        return 0;
}
result is:
Child process
(after 5s)
Parent process

then I change to fork():
Code:
#include <stdio.h>
#include <unistd.h>
int main()
{
        if(fork() == 0){
                printf("Child process\n");
                sleep(5);
        }
        else{
                printf("Parent process\n");
        }
        return 0;
}
the result is:
Parent process

It seems the child process never run. Why does this happen. The konq/e crashs here.
By the way, my arm toolchain is 2.95.3.

Last edited by jack_zhou; 08-06-2007 at 05:19 AM.
 
  


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
uclinux fork problem jack_zhou Programming 3 08-07-2007 04:11 AM
problem in building uClinux kernel bm_soe Red Hat 0 05-29-2007 11:55 PM
Fork() problem MrBrain Programming 3 10-10-2004 04:52 PM
Fork problem Rajneesh Programming 3 12-22-2003 06:45 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:10 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
Open Source Consulting | Domain Registration