2 * <sys/uio.h> wrapper functions.
5 * Steffen Kiess (s-kiess@web.de)
7 * Copyright (C) 2012 Steffen Kiess
12 #endif /* ndef _GNU_SOURCE */
15 #if defined(TARGET_MACH)
16 /* So we can use the declaration of preadv () */
17 #define _DARWIN_C_SOURCE
30 _mph_from_iovec_array (struct Mono_Posix_Iovec
*iov
, gint32 iovcnt
)
40 v
= malloc (iovcnt
* sizeof (struct iovec
));
45 for (i
= 0; i
< iovcnt
; i
++) {
46 if (Mono_Posix_FromIovec (&iov
[i
], &v
[i
]) != 0) {
57 Mono_Posix_Syscall_readv (int dirfd
, struct Mono_Posix_Iovec
*iov
, gint32 iovcnt
)
62 v
= _mph_from_iovec_array (iov
, iovcnt
);
67 res
= readv(dirfd
, v
, iovcnt
);
71 #endif /* def HAVE_READV */
75 Mono_Posix_Syscall_writev (int dirfd
, struct Mono_Posix_Iovec
*iov
, gint32 iovcnt
)
80 v
= _mph_from_iovec_array (iov
, iovcnt
);
85 res
= writev (dirfd
, v
, iovcnt
);
89 #endif /* def HAVE_WRITEV */
93 Mono_Posix_Syscall_preadv (int dirfd
, struct Mono_Posix_Iovec
*iov
, gint32 iovcnt
, gint64 off
)
98 mph_return_if_off_t_overflow (off
);
100 v
= _mph_from_iovec_array (iov
, iovcnt
);
105 res
= preadv (dirfd
, v
, iovcnt
, (off_t
) off
);
109 #endif /* def HAVE_PREADV */
113 Mono_Posix_Syscall_pwritev (int dirfd
, struct Mono_Posix_Iovec
*iov
, gint32 iovcnt
, gint64 off
)
118 mph_return_if_off_t_overflow (off
);
120 v
= _mph_from_iovec_array (iov
, iovcnt
);
125 res
= pwritev (dirfd
, v
, iovcnt
, (off_t
) off
);
129 #endif /* def HAVE_PWRITEV */