From: "Li Xiaodong" <lixd@cn.fujitsu.com>
To: <linux-kernel@vger.kernel.org>
Subject: [HELP]Problem with exit(0) and _exit(0) on RHEL x86
Date: Mon, 21 Jan 2008 16:40:21 +0800 [thread overview]
Message-ID: <007501c85c09$420a6e20$978da70a@fujitsulixd> (raw)
I thought the effects of exit(0) and _exit(0) should be different.
----
int main(void)
{
int var = 0;
pid_t pid;
printf("before vfork\n");
if ( (pid = vfork()) < 0 )
printf("error\n");
else if ( pid == 0 )
{
var++;
exit(0); /* Clear parent's IO */
}
printf("%d\n",var);
return 0;
}
----
int main(void)
{
int var = 0;
pid_t pid;
printf("before vfork\n");
if ( (pid = vfork()) < 0 )
printf("error\n");
else if ( pid == 0 )
{
var++;
_exit(0); /* Do not clear parent's IO */
}
printf("%d\n",var);
return 0;
}
----
But the actual results on RHEL5 x86 were beyond my ken. The outputs of the
above two are the same.
$./a.out
before vfork
1
Could anyone help me with this? Thanks.
next reply other threads:[~2008-01-21 8:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-21 8:40 Li Xiaodong [this message]
[not found] <fa.YRcO5m0fsaAu8VNfQMYpdgaX5qk@ifi.uio.no>
2008-01-21 23:54 ` Robert Hancock
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='007501c85c09$420a6e20$978da70a@fujitsulixd' \
--to=lixd@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®