08-12-2009
difference between exit() and _exit()
By using exit() and _exit() we can terminate a program. What is the
difference between these two ???
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I'm receiving an exit code 64 in our batch scheduler (BMC product control-m) executing a PERL script on UX-HP. Can you tell me where I can find a list of exit codes and their meaning. I'm assuming the exit code is from the Unix operating system not PERL. (3 Replies)
Discussion started by: jkuchar747
3 Replies
2. Programming
What is the difference between using exit(0) and exit(1) to exit a program? Which should I use? (9 Replies)
Discussion started by: enuenu
9 Replies
3. UNIX for Dummies Questions & Answers
can u tell me what is the meaning of exit(0),exit(1),exit(2)
what is diff amonng these.
Amit (1 Reply)
Discussion started by: amitpansuria
1 Replies
4. Shell Programming and Scripting
I know that the exit codes in scripting "$*" will returns all the parameters/arguments passwd to the script.
But I also know that "$@" will also returns the same. What is the difference between those two ? (1 Reply)
Discussion started by: praveen_b744
1 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I am getting fatal error or core dump by using this command "_exit(-1)". I need to terminate the program at a certain condition, but continous calling of this exit function, I am getting core dump. Is there any other command can be used to avoid the core dump ?? (3 Replies)
Discussion started by: ronix007
3 Replies
6. Shell Programming and Scripting
I am running HP-UX & ksh
I have several validation programs that scan log files for error messages.
One of these files scan 3 diff files, thus I have the exit value in a variable and depending on which log-file I am scanning the value changes.
I am not getting the value I expect but a... (1 Reply)
Discussion started by: vslewis
1 Replies
7. Programming
I think both write at the end of the file ......
but is there a sharp difference between those 2 instruction .....
thank you
this is my 3rd question today forgive me :D (1 Reply)
Discussion started by: fwrlfo
1 Replies
8. Shell Programming and Scripting
Hi
In one of the script I am seeing some thing like exit 7,exit 1,exit 2,exit 3,exit 9,exit6.What is the difference between all of this exit.Can anyone help here please (3 Replies)
Discussion started by: ginrkf
3 Replies
9. Shell Programming and Scripting
Hi All,
I would like to know whether is there any difference in closing the sftp connection with exit, bye and quit.
And would like to know the reliable command. (3 Replies)
Discussion started by: Girish19
3 Replies
10. Shell Programming and Scripting
In the awk I am trying to subtract the difference $3-$2 of each matching $4 before the first _ (underscore) and print that value in $13.
I think the awk will do that, but added comments. What I am not sure off is how to add a line or lines that will add sum each matching $13 value and put it in... (2 Replies)
Discussion started by: cmccabe
2 Replies
_EXIT(2) Linux Programmer's Manual _EXIT(2)
NAME
_exit, _Exit - terminate the calling process
SYNOPSIS
#include <unistd.h>
void _exit(int status);
#include <stdlib.h>
void _Exit(int status);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
_Exit():
_XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
or cc -std=c99
DESCRIPTION
The function _exit() terminates the calling process "immediately". Any open file descriptors belonging to the process are closed; any
children of the process are inherited by process 1, init, and the process's parent is sent a SIGCHLD signal.
The value status is returned to the parent process as the process's exit status, and can be collected using one of the wait(2) family of
calls.
The function _Exit() is equivalent to _exit().
RETURN VALUE
These functions do not return.
CONFORMING TO
SVr4, POSIX.1-2001, 4.3BSD. The function _Exit() was introduced by C99.
NOTES
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(3), but does not call any functions registered with atexit(3) or on_exit(3). Whether it flushes standard
I/O buffers and removes temporary files created with tmpfile(3) is implementation-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(3) before calling _exit(). Whether any pending I/O is canceled, and which pending I/O may be canceled upon
_exit(), is implementation-dependent.
In glibc up to version 2.3, the _exit() wrapper function invoked the kernel system call of the same name. Since glibc 2.3, the wrapper
function invokes exit_group(2), in order to terminate all of the threads in a process.
SEE ALSO
execve(2), exit_group(2), fork(2), kill(2), wait(2), wait4(2), waitpid(2), atexit(3), exit(3), on_exit(3), termios(3)
COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2010-09-20 _EXIT(2)