2 static const char rcsid
[] = "$Id: writev.c,v 1.3 2005/04/27 04:56:13 sra Exp $";
5 #include "port_before.h"
10 #include <sys/socket.h>
12 #include "port_after.h"
15 int __bindcompat_writev
;
21 __writev(int fd
, struct iovec
*iov
, int iovlen
)
25 if (fstat(fd
, &statbuf
) < 0)
29 * Allow for atomic writes to network.
31 if (statbuf
.st_mode
& S_IFSOCK
) {
34 memset(&mesg
, 0, sizeof(mesg
));
38 mesg
.msg_iovlen
= iovlen
;
39 mesg
.msg_accrights
= 0;
40 mesg
.msg_accrightslen
= 0;
41 return (sendmsg(fd
, &mesg
, 0));
44 int i
, rcode
= 0, count
= 0;
46 for (i
= 0, tv
= iov
; i
<= iovlen
; tv
++) {
47 rcode
= write(fd
, tv
->iov_base
, tv
->iov_len
);
65 __writev(fd
, vp
, vpcount
)
67 const struct iovec
*vp
;
72 while (vpcount
-- > 0) {
73 int written
= write(fd
, vp
->iov_base
, vp
->iov_len
);
78 if (written
!= vp
->iov_len
)
87 #endif /*NEED_WRITEV*/