git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFH] plumber's puzzle

From
Junio C Hamano <junkio@cox.net>
Date
Apr 22, 2007, 23:52 UTC
Message-ID
<7vejmcklv0.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<alpine.LFD.0.98.0704221546160.9964@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 18 quoted lines
> On Sun, 22 Apr 2007, Junio C Hamano wrote:
>> 
>> I should be happy that I figured out what is going on, but I am
>> not very happy with this patch.
>
> That actually looks like the right patch.
>
> The "fflush() before fork()" thing is a real issue, and a real bug. Stdio 
> is buffered, and yes, fork() will duplicate the buffer if not flushed.
>
> Of course, I'm not 100% sure that is the right _place_ for the fflush() 
> call. I wonder if we should just do the fflush() closer to the place that 
> generates the data. As it is, we may have other things like that lurking.
>
> Of course, delaying the fflush as long as possible is likely good for 
> performance, so doing it just before the fork() (even if it may be ugly 
> and somewhat unexpected at that point to have to do it) may just be the 
> right thing regardless...

Another possibility I considered is to call low-level _exit so that we bypass not just stdio flushing but also atexit(). But I think "fflush() before fork()" is cleaner.

Previous: Linus TorvaldsNext: H. Peter Anvin
Message 6 of 8 in “[RFH] plumber's puzzle”
  1. Junio C HamanoApr 22, 2007
  2. Florian WeimerApr 22, 2007
  3. Linus TorvaldsApr 22, 2007
  4. Junio C HamanoApr 22, 2007
  5. Linus TorvaldsApr 22, 2007
  6. Junio C HamanoApr 22, 2007
  7. H. Peter AnvinApr 24, 2007
  8. Johannes SchindelinApr 24, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.