Visit Jeremy's Blog.
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 01-20-2006, 03:25 AM   #1
LQ Newbie
Registered: Sep 2005
Posts: 11

Rep: Reputation: 0
difference between _exit and exit???

I copied some rows from the vfork man page.
"The vfork() function can normally be used just like fork(). It does not work, however, to return while running in the child's context from the caller of vfork() since the eventual return from vfork() would then return to a no longer existent stack frame. Be careful, also, to call _exit() rather than exit() if you cannot exec, since exit() flushes and closes standard I/O channels, thereby damaging the parent process' standard I/O data structures. (Even with fork(), it is wrong to call exit(), since buffered data would then be flushed twice.)"

I don't understand the difference between _exit and exit could some one please tell me?
Thanks moonz
Old 01-20-2006, 07:17 AM   #2
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Found this in a Google search:
Old 01-20-2006, 07:24 AM   #3
LQ Newbie
Registered: Sep 2005
Posts: 11

Original Poster
Rep: Reputation: 0
Hi thank you for your replie!
But according to this document there isn't any difference, but there is.
I found this searching the web with google
For a discussion on the effects of an exit, the transmission of exit
status, zombie processes, signals sent, etc., see exit(3).

The function _exit() is like exit(), but does not call any functions
registered with atexit() or on_exit(). Whether it flushes standard I/O
buffers and removes temporary files created with tmpfile(3) is imple-
mentation dependent. On the other hand, _exit() does close open file
descriptors, and this may cause an unknown delay, waiting for pending
output to finish. If the delay is undesired, it may be useful to call
functions like tcflush() before calling _exit(). Whether any pending
I/O is cancelled, and which pending I/O may be cancelled upon _exit(),
is implementation-dependent.

At this location
Sorry that i wasted your time!
Old 01-20-2006, 11:05 AM   #4
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,445
Blog Entries: 4

Rep: Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897
It is often the case, in the Linux/Unix world, that names beginning with "_" refer to internal or primitive routines.


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
difference between exit 1 and exit kushalkoolwal Programming 6 10-20-2005 03:56 PM
_exit() and exit() greghua Programming 3 10-08-2005 01:23 PM
Exit X Risetaker2003 Linux - Software 5 09-30-2003 08:10 PM
exit X ? w00t Linux - Newbie 11 06-01-2003 08:04 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:13 AM.

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