Ask a Question related to UNIX Programming, Design and Development.
-
Barry Margolin #1
Re: WIFEXITED()
In article <Xns93BCA7757547whitesuneapollolv@130.133.1.4>,
Peteris Krumins <pkruminsREMOVETHIS@inbox.lv> wrote:Exited normally means that it called the exit() function (actually, the>int main(void) {
> int child, cs;
>
> child = fork();
> switch(child) {
> case -1:
> printf("fork() failed\n");
> exit(EXIT_FAILURE);
> case 0:
> /* child */
> exit(EXIT_FAILURE);
> default:
> wait(&cs);
> if (WIFEXITED(cs))
> printf("child did exit normally\n");
> else
> printf("child did NOT exit normally\n");
> }
>}
>--
>output:
>child did exit normally
>--
>
>How is this possible?
_exit() system call), rather than being terminated by a signal. It doesn't
mean that the exit code was 0; you can check that separately.
--
Barry Margolin, [email]barry.margolin@level3.com[/email]
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
Barry Margolin Guest
-
Peteris Krumins #2
Re: WIFEXITED()
Barry Margolin <barry.margolin@level3.com> wrote in
news:M6FRa.257$0z4.180@news.level3.com:
[...]Thanks again!>
> Exited normally means that it called the exit() function (actually,
> the _exit() system call), rather than being terminated by a signal.
> It doesn't mean that the exit code was 0; you can check that
> separately.
>
P.Krumins
Peteris Krumins Guest



Reply With Quote

