libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / system / libroot / posix / sys / uio.c
blob3f71b4c28639721499a00e1ce620b481f603c459
1 /*
2 ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the Haiku License.
4 */
7 #include <syscalls.h>
9 #include <sys/uio.h>
10 #include <errno.h>
12 #include <errno_private.h>
15 #define RETURN_AND_SET_ERRNO(err) \
16 if (err < 0) { \
17 __set_errno(err); \
18 return -1; \
19 } \
20 return err;
23 ssize_t
24 readv(int fd, const struct iovec *vecs, size_t count)
26 ssize_t bytes = _kern_readv(fd, -1, vecs, count);
28 RETURN_AND_SET_ERRNO(bytes);
32 ssize_t
33 readv_pos(int fd, off_t pos, const struct iovec *vecs, size_t count)
35 ssize_t bytes;
36 if (pos < 0) {
37 __set_errno(B_BAD_VALUE);
38 return -1;
40 bytes = _kern_readv(fd, pos, vecs, count);
42 RETURN_AND_SET_ERRNO(bytes);
46 ssize_t
47 writev(int fd, const struct iovec *vecs, size_t count)
49 ssize_t bytes = _kern_writev(fd, -1, vecs, count);
51 RETURN_AND_SET_ERRNO(bytes);
55 ssize_t
56 writev_pos(int fd, off_t pos, const struct iovec *vecs, size_t count)
58 ssize_t bytes;
59 if (pos < 0) {
60 __set_errno(B_BAD_VALUE);
61 return -1;
63 bytes = _kern_writev(fd, pos, vecs, count);
65 RETURN_AND_SET_ERRNO(bytes);