2 * <sys/uio.h> wrapper functions.
5 * Steffen Kiess (s-kiess@web.de)
7 * Copyright (C) 2012 Steffen Kiess
12 #endif /* ndef _GNU_SOURCE */
22 from_iovec (struct Mono_Posix_Iovec
*iov
, gint32 iovcnt
)
32 v
= malloc (iovcnt
* sizeof (struct iovec
));
37 for (i
= 0; i
< iovcnt
; i
++) {
38 if (Mono_Posix_FromIovec (&iov
[i
], &v
[i
]) != 0) {
49 Mono_Posix_Syscall_readv (int dirfd
, struct Mono_Posix_Iovec
*iov
, gint32 iovcnt
)
54 v
= from_iovec (iov
, iovcnt
);
59 res
= readv(dirfd
, v
, iovcnt
);
63 #endif /* def HAVE_READV */
67 Mono_Posix_Syscall_writev (int dirfd
, struct Mono_Posix_Iovec
*iov
, gint32 iovcnt
)
72 v
= from_iovec (iov
, iovcnt
);
77 res
= writev (dirfd
, v
, iovcnt
);
81 #endif /* def HAVE_WRITEV */
85 Mono_Posix_Syscall_preadv (int dirfd
, struct Mono_Posix_Iovec
*iov
, gint32 iovcnt
, gint64 off
)
90 mph_return_if_off_t_overflow (off
);
92 v
= from_iovec (iov
, iovcnt
);
97 res
= preadv (dirfd
, v
, iovcnt
, (off_t
) off
);
101 #endif /* def HAVE_PREADV */
105 Mono_Posix_Syscall_pwritev (int dirfd
, struct Mono_Posix_Iovec
*iov
, gint32 iovcnt
, gint64 off
)
110 mph_return_if_off_t_overflow (off
);
112 v
= from_iovec (iov
, iovcnt
);
117 res
= pwritev (dirfd
, v
, iovcnt
, (off_t
) off
);
121 #endif /* def HAVE_PWRITEV */