This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/14565] New: Unnecessary failure case in sysdeps/posix/writev.c, etc.
- From: "bugdal at aerifal dot cx" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Sun, 09 Sep 2012 19:05:17 +0000
- Subject: [Bug libc/14565] New: Unnecessary failure case in sysdeps/posix/writev.c, etc.
- Auto-submitted: auto-generated
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.