public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/14565] New: Unnecessary failure case in sysdeps/posix/writev.c, etc.
@ 2012-09-09 19:05 bugdal at aerifal dot cx
  2012-09-09 22:19 ` [Bug libc/14565] " joseph at codesourcery dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bugdal at aerifal dot cx @ 2012-09-09 19:05 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14565

             Bug #: 14565
           Summary: Unnecessary failure case in sysdeps/posix/writev.c,
                    etc.
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: minor
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: bugdal@aerifal.cx
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


The atomic writev emulation in sysdeps/posix/writev.c (and likewise readv)
depends on being able to obtain a potentially-large buffer via malloc, and
fails when memory is unavailable. It would be much nicer to have an automatic
buffer of size PIPE_BUF for use when malloc fails, and simply write at most
PIPE_BUF bytes in that case. This is permitted behavior, per POSIX; writes on
non-pipes are not required to be atomic, and writes on pipes need only be
atomic if the size to be written is bounded by PIPE_BUF. Aside from that case,
"short writes" (and likewise, for readv, "short reads") are permitted, and it's
the caller's responsibility to resubmit the rest if desired.

I have no idea if this code is actually used anywhere, but it would be nice to
fix it anyway, and it could be useful to people porting to obscure systems
(especially if the same code is used in newlib..?)

-- 
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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-17 11:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-09 19:05 [Bug libc/14565] New: Unnecessary failure case in sysdeps/posix/writev.c, etc bugdal at aerifal dot cx
2012-09-09 22:19 ` [Bug libc/14565] " joseph at codesourcery dot com
2014-06-17  4:39 ` fweimer at redhat dot com
2014-06-17 11:46 ` jsm28 at gcc dot gnu.org

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).