2004-10-14 00:21:07 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
University Research and Technology
|
|
|
|
Corporation. All rights reserved.
|
|
|
|
Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
of Tennessee Research Foundation. All rights
|
|
|
|
reserved.
|
2014-07-27 00:17:09 +04:00
|
|
|
Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2004-11-28 23:09:25 +03:00
|
|
|
University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
$COPYRIGHT$
|
2014-07-27 00:17:09 +04:00
|
|
|
|
2004-11-22 04:38:40 +03:00
|
|
|
Additional copyrights may follow
|
2014-07-27 00:17:09 +04:00
|
|
|
|
2004-10-14 00:21:07 +04:00
|
|
|
$HEADER$
|
|
|
|
*/
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal_config.h"
|
2014-07-27 00:17:09 +04:00
|
|
|
#include "opal/win32/opal_uio.h"
|
2004-10-14 00:21:07 +04:00
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
Highly doubt if the windows sockets ever set errno to EAGAIN. There might
|
|
|
|
be some weird conversion to map this or I might have to rewrite this piece
|
2014-07-27 00:17:09 +04:00
|
|
|
of code to handle the windows error flags
|
2004-10-14 00:21:07 +04:00
|
|
|
*/
|
|
|
|
|
2006-08-20 22:50:47 +04:00
|
|
|
int writev( int fd, struct iovec * iov, int cnt )
|
2004-11-03 06:57:20 +03:00
|
|
|
{
|
2005-12-18 01:07:04 +03:00
|
|
|
int err;
|
|
|
|
DWORD sendlen;
|
2004-11-03 06:57:20 +03:00
|
|
|
|
2005-12-18 01:07:04 +03:00
|
|
|
err = WSASend((SOCKET) fd, &(iov->data), cnt, &sendlen, 0, NULL, NULL);
|
2004-11-03 06:57:20 +03:00
|
|
|
|
2005-12-18 01:07:04 +03:00
|
|
|
if (err < 0) {
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
return (int) sendlen;
|
2004-10-14 00:21:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-08-20 22:50:47 +04:00
|
|
|
int readv( int fd, struct iovec * iov, int cnt )
|
2004-11-03 06:57:20 +03:00
|
|
|
{
|
|
|
|
int err;
|
|
|
|
DWORD recvlen = 0;
|
|
|
|
DWORD flags = 0;
|
2005-12-18 01:07:04 +03:00
|
|
|
|
2004-11-03 06:57:20 +03:00
|
|
|
err = WSARecv((SOCKET) fd, &(iov->data), cnt, &recvlen, &flags, NULL, NULL);
|
2004-10-14 00:21:07 +04:00
|
|
|
|
2005-12-18 01:07:04 +03:00
|
|
|
if( err < 0 ) {
|
2004-11-03 06:57:20 +03:00
|
|
|
return err;
|
|
|
|
}
|
2005-12-18 01:07:04 +03:00
|
|
|
return (int) recvlen;
|
2004-10-14 00:21:07 +04:00
|
|
|
}
|
2005-12-18 01:07:04 +03:00
|
|
|
|