1 /* 2 ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 ** Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <syscalls.h> 8 9 #include <sys/uio.h> 10 #include <errno.h> 11 12 #include <errno_private.h> 13 #include <syscall_utils.h> 14 15 16 ssize_t 17 readv(int fd, const struct iovec *vecs, size_t count) 18 { 19 ssize_t bytes = _kern_readv(fd, -1, vecs, count); 20 21 RETURN_AND_SET_ERRNO(bytes); 22 } 23 24 25 ssize_t 26 readv_pos(int fd, off_t pos, const struct iovec *vecs, size_t count) 27 { 28 ssize_t bytes; 29 if (pos < 0) { 30 __set_errno(B_BAD_VALUE); 31 return -1; 32 } 33 bytes = _kern_readv(fd, pos, vecs, count); 34 35 RETURN_AND_SET_ERRNO(bytes); 36 } 37 38 39 ssize_t 40 writev(int fd, const struct iovec *vecs, size_t count) 41 { 42 ssize_t bytes = _kern_writev(fd, -1, vecs, count); 43 44 RETURN_AND_SET_ERRNO(bytes); 45 } 46 47 48 ssize_t 49 writev_pos(int fd, off_t pos, const struct iovec *vecs, size_t count) 50 { 51 ssize_t bytes; 52 if (pos < 0) { 53 __set_errno(B_BAD_VALUE); 54 return -1; 55 } 56 bytes = _kern_writev(fd, pos, vecs, count); 57 58 RETURN_AND_SET_ERRNO(bytes); 59 } 60 61