public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "P at draigBrady dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/14433] setvbuf _IOLBF doesn't honor size
Date: Mon, 06 Aug 2012 13:55:00 -0000	[thread overview]
Message-ID: <bug-14433-131-LVkHsosCKg@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <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.


  parent reply	other threads:[~2012-08-06 13:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-05 18:15 [Bug libc/14433] New: " P at draigBrady dot com
2012-08-06 11:36 ` [Bug libc/14433] " bugdal at aerifal dot cx
2012-08-06 13:55 ` P at draigBrady dot com [this message]
2012-08-06 16:06 ` bugdal at aerifal dot cx
2014-06-17 18:48 ` fweimer at redhat dot com

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=bug-14433-131-LVkHsosCKg@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).