From: Bernd Petrovitsch <bernd@firmix.at>
To: Valdis.Kletnieks@vt.edu
Cc: walking.to.remember@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: what will connect the fork() with its following code ? a simple example below:
Date: Wed, 07 Sep 2005 09:08:48 +0200 [thread overview]
Message-ID: <1126076928.24425.12.camel@tara.firmix.at> (raw)
In-Reply-To: <200509061658.j86GwB5w029481@turing-police.cc.vt.edu>
On Tue, 2005-09-06 at 12:58 -0400, Valdis.Kletnieks@vt.edu wrote:
> On Tue, 06 Sep 2005 17:15:51 +0800, "Sat." said:
>
> Not a kernel problem, please consult an intro-to-C list next time....
>
> > if(!(pid=fork())){
> > ......
> > printk("in child process");
> > ......
> > }else{
> > .....
> > printk("in father process");
> > .....
> > }
> >
>
> > values., and do nothing . so the bridge between the new process and
> > its following code, printk("in child process"), seems disappear
>
> I'm assuming you actually meant printf() (which is the userspace stdio call)
> rather than printk() (which is the inside-the-kernel variant).
I actually assumed the same.
> 'man setbuf' - most likely the output of the child process is buffered and
> never actually output before it exits. You want to set stdout to be
It is buffered since the above printf() lacks a terminating "\n". So
either put a "\n" at the end or call "fflush(stdout);"
> line-buffered or unbuffered, or write to stderr (unbuffered by default) rather
> than stdout.
Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services
prev parent reply other threads:[~2005-09-07 7:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-06 9:15 what will connect the fork() with its following code ? a simple example below: Sat.
2005-09-06 10:37 ` Bernd Petrovitsch
[not found] ` <003a01c5b2d6$610d6360$6464a8c0@pc0001>
2005-09-06 11:59 ` Sat.
2005-09-06 12:41 ` linux-os (Dick Johnson)
2005-09-06 13:01 ` Dirk Gerdes
2005-09-06 16:58 ` Valdis.Kletnieks
2005-09-07 7:08 ` Bernd Petrovitsch [this message]
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=1126076928.24425.12.camel@tara.firmix.at \
--to=bernd@firmix.at \
--cc=Valdis.Kletnieks@vt.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=walking.to.remember@gmail.com \
/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