Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 08-05-2013, 11:55 AM   #1
LQ Newbie
Registered: Aug 2013
Posts: 1

Rep: Reputation: Disabled
about return value in fork system call

a process runs(using fork system calls),it returns 2 this is possible?
Old 08-05-2013, 12:06 PM   #2
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
It's like if you break a magnet in half you don't get separate N and S poles - you get 2 magnets. fork() is supposed to work like that otherwise your processes would lose their sense of direction.

What did you expect?
Old 08-05-2013, 12:08 PM   #3
LQ Newbie
Registered: May 2013
Location: Utah
Distribution: Mint, Debian, CentOS
Posts: 10

Rep: Reputation: Disabled
Well, if the process Forks, then it is a process and a child process, each requiring an end before returning control to the OS. So that is probably the 2 returns, the parent return, and child return.

What is the program you are running? Or did you program it yourself? Maybe we can test it on another Linux system and see if we get the same results.


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
[SOLVED] System Call Return Values jj7 Linux - Newbie 2 05-04-2012 06:32 PM
[SOLVED] php, immediate return from system call? MrUmunhum Programming 1 11-29-2011 05:28 PM
Fork System call bangoram Linux - General 8 07-16-2006 03:24 AM
does a system call return value?? docetes Programming 2 03-16-2006 06:40 PM
Changing the fork system call seshuch Programming 0 10-02-2004 06:18 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:02 PM.

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