This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/14565] New: Unnecessary failure case in sysdeps/posix/writev.c, etc.


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]