root/opal/win32/opal_uio.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. writev
  2. readv

   1 /*
   2  Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   3                          University Research and Technology
   4                          Corporation.  All rights reserved.
   5  Copyright (c) 2004-2005 The University of Tennessee and The University
   6                          of Tennessee Research Foundation.  All rights
   7                          reserved.
   8  Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9                          University of Stuttgart.  All rights reserved.
  10  Copyright (c) 2004-2005 The Regents of the University of California.
  11                          All rights reserved.
  12  $COPYRIGHT$
  13 
  14  Additional copyrights may follow
  15 
  16  $HEADER$
  17  */
  18 
  19 #include "opal_config.h"
  20 #include "opal/win32/opal_uio.h"
  21 #include <errno.h>
  22 
  23 /*
  24  Highly doubt if the windows sockets ever set errno to EAGAIN. There might
  25  be some weird conversion to map this or I might have to rewrite this piece
  26  of code to handle the windows error flags
  27  */
  28 
  29 int writev( int fd, struct iovec * iov, int cnt )
  30 {
  31    int err;
  32    DWORD sendlen;
  33 
  34    err = WSASend((SOCKET) fd, &(iov->data), cnt, &sendlen, 0, NULL, NULL);
  35 
  36    if (err < 0) {
  37       return err;
  38    }
  39    return (int) sendlen;
  40 }
  41 
  42 
  43 int readv( int fd, struct iovec * iov, int cnt )
  44 {
  45    int err;
  46    DWORD recvlen = 0;
  47    DWORD flags = 0;
  48 
  49    err = WSARecv((SOCKET) fd, &(iov->data), cnt, &recvlen, &flags, NULL, NULL);
  50 
  51    if( err < 0 ) {
  52            return err;
  53    }
  54    return (int) recvlen;
  55 }
  56 

/* [<][>][^][v][top][bottom][index][help] */