#include "EXTERN.h" #include "perl.h" #include "XSUB.h" // readv/writev #include // errno/EINTR #include // IOV_MAX #include #ifndef IOV_MAX # ifdef UIO_MAXIOV # define IOV_MAX UIO_MAXIOV # endif #endif #ifndef IOV_MAX # error "Unable to determine IOV_MAX from system headers" #endif MODULE = IO::Vectored PACKAGE = IO::Vectored PROTOTYPES: ENABLE unsigned long _backend(fileno, is_write, ...) int fileno int is_write CODE: ssize_t rv; int iovcnt; if (items < 3) croak("need more arguments to %s", is_write ? "syswritev" : "sysreadv"); iovcnt = items - 2; if (iovcnt > IOV_MAX) croak("too many arguments to %s", is_write ? "syswritev" : "sysreadv"); { struct iovec v[iovcnt]; // Needs C99 compiler SV *item; int i; size_t len; for(i=0; i