lkml.org 
[lkml]   [1999]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Kernel 2.2.x bug. Standard output not flushed before fork
Date
In article <cistron.375C1AC0.30512697@ditec.um.es>,
Juan Piernas =?iso-8859-1?Q?C=E1novas?= <piernas@ditec.um.es> wrote:
>Hi all!
>This is not good, isn't it?. Well, I have a program that
>creates one o more process. Before fork, the father
>process write some messages to standard output and then it
>creates some sons. The problem is sons inherit
>father's non flushed standard output, so father's messages
>appear two o more times. If I flush standard output before
>fork(), all is fine -- that is, father's messages appear
>once.

Yes. That's standard Unix behaviour, and the kernel doesn't have anything
to do with it. The stdio buffers live in libc only - the kernel doesn't
know about them. It's the programmers responsibility to make sure all stdio
buffers are flushed before forking.

Mike.
--
Indifference will certainly be the downfall of mankind, but who cares?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.080 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site