This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/14433] setvbuf _IOLBF doesn't honor size
- From: "P at draigBrady dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Mon, 06 Aug 2012 13:55:20 +0000
- Subject: [Bug libc/14433] setvbuf _IOLBF doesn't honor size
- Auto-submitted: auto-generated
- References: <bug-14433-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=14433
--- Comment #2 from PÃdraig Brady <P at draigBrady dot com> 2012-08-06 13:55:20 UTC ---
If the buffer is full you output it obviously.
I meant atomic output of lines < the buffer size.
This can very useful and can take advantage of this from POSIX:
"Atomic/non-atomic: A write is atomic if the whole amount written in one
operation is not interleaved with data from any other process. This is useful
when there are multiple writers sending data to a single reader. Applications
need to know how large a write request can be expected to be performed
atomically.This maximum is called {PIPE_BUF}. This volume of IEEE Std
1003.1-2001 does not say whether write requests for more than {PIPE_BUF} bytes
are atomic, but requires that writes of {PIPE_BUF}or fewer bytes shall be
atomic."
So as a performance hint, for programs that output lines,
but don't care when they're output, they could just do:
setvbuf (stdout, NULL, _IOLBF, PIPE_BUF);
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.