From: Volker Lendecke Date: Sun, 21 Dec 2008 22:22:30 +0000 (+0100) Subject: Add sys_writev X-Git-Tag: samba-3.3.0~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a443c09ee81416394592bafbba40620705166da6;p=thirdparty%2Fsamba.git Add sys_writev (cherry picked from commit 886ebe3b6f7b5304ae9c185ee14a444977afac24) --- diff --git a/source/include/proto.h b/source/include/proto.h index f6b1906068b..d29a108ac48 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -1037,6 +1037,7 @@ void *sys_memalign( size_t align, size_t size ); int sys_usleep(long usecs); ssize_t sys_read(int fd, void *buf, size_t count); ssize_t sys_write(int fd, const void *buf, size_t count); +ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt); ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off); ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off); ssize_t sys_send(int s, const void *msg, size_t len, int flags); diff --git a/source/lib/system.c b/source/lib/system.c index eabb6d6dc48..5b06d3c7600 100644 --- a/source/lib/system.c +++ b/source/lib/system.c @@ -141,6 +141,20 @@ ssize_t sys_write(int fd, const void *buf, size_t count) return ret; } +/******************************************************************* +A writev wrapper that will deal with EINTR. +********************************************************************/ + +ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt) +{ + ssize_t ret; + + do { + ret = writev(fd, iov, iovcnt); + } while (ret == -1 && errno == EINTR); + return ret; +} + /******************************************************************* A pread wrapper that will deal with EINTR and 64-bit file offsets. ********************************************************************/