This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin 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]

Readv/writev patch


One last patch and the sandbox is empty (but a big one this time):

This patch adds readv and writev methods to the base fhandler
class and pushes all read and write calls through these.  I've
also added overridden versions of these methods to the socket
fhandler since it can implement them more efficiently.  (The same
is true of some other fhandler classes too but I haven't had the
energy to do any of the others.)  As part of this, I rewrote the
socket fhandler's recvmsg and sendmsg calls to use the winsock2
iovec-like i/face (i.e. WSABUF) where possible to avoid further
copying of the buffers.  I also re-arranged the other
fhandler_socket read/write-like methods to use the winsock2 calls
even in the nonblocking case: this is for the usual consistency
and beauty reasons apart from anything else.

There are two new functions to check incoming iovec arrays, called
check_iovec_for_read() and check_iovec_for_write().  I've put
these in miscfuncs.cc and declared them in winsup.h to match the
other check_XYZZY functions.

The readv(2) and writev(2) entry points are based on the old
read(2) and write(2) entry points but slightly modified to make
sure that the strace at the foot of the function is always reached
in all cases.  I also re-arranged the read/write access mode
checking to avoid relying on win32's impression of what might be
going on.

Finally, I updated the definition of the iovec struct to match the
SUSv3 definition.

I've tried to reduce the size of the patch by sending in some
unrelated parts over the last couple of days but I realize that
this is still quite large.  If you'ld like me to split the patch
up (e.g. into the base fhandler part and the socket part), give me
a call and I'll see if I can find the energy to do so; London's
now all cold and gray and it's not conducive to too much fun and
games.

Anyhow, enjoy!

// Conrad

Attachment: ChangeLog.txt
Description: Text document

Attachment: iovec.patch.txt
Description: Text document


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