|
|
发表于 2005-9-5 22:00:01
|
显示全部楼层
Post by 弥敦路九号
errno=retval
Buddy, are you trying to say that “errno is just the exit status of a process“?
If this is what you mean, then I am so sorry that you are wrong, except that you explicitly save the errno's value after a particular system call/library function you are interested in, and then use the saved value as the exit()'s argument or return the saved value when returning from main().
check man errno
The <errno.h> header file defines the integer variable errno , which is set by system calls and some library functions in the event of an error to indicate what went wrong.
and check man 2 wait
WEXITSTATUS(status)
returns the exit status of the child. This consists of the
least significant 8 bits of the status argument that the child
specified in a call to exit() or _exit() or as the argument for
a return statement in main(). This macro should only be
employed if WIFEXITED returned true. |
|