summaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-04-09 01:17:55 -0400
committerRich Felker <dalias@aerifal.cx>2011-04-09 01:17:55 -0400
commit2cff36a84f268c09f4c9dc5a1340652c8e298dc0 (patch)
tree9304edd800f3388484b0882b27c26dfb2e48c943 /README
parent67e793e5e14fe031569117fd88328268e67ad4ee (diff)
downloadmusl-2cff36a84f268c09f4c9dc5a1340652c8e298dc0.tar.gz
work around a nasty bug in linux readv syscall
according to posix, readv "shall be equivalent to read(), except..." that it places the data into the buffers specified by the iov array. however on linux, when reading from a terminal, each iov element behaves almost like a separate read. this means that if the first iov exactly satisfied the request (e.g. a length-one read of '\n') and the second iov is nonzero length, the syscall will block again after getting the blank line from the terminal until another line is read. simply put, entering a single blank line becomes impossible. the solution, fortunately, is simple. whenever the buffer size is nonzero, reduce the length of the requested read by one byte and let the last byte go through the buffer. this way, readv will already be in the second (and last) iov, and won't re-block on the second iov.
Diffstat (limited to 'README')
0 files changed, 0 insertions, 0 deletions