1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +00:00

Kernel+LibC+Tests: Implement pwritev(2)

While this isn't really POSIX, it's needed by the Zig port and was
simple enough to implement.
This commit is contained in:
sin-ack 2022-10-01 13:21:20 +00:00 committed by Andrew Kaster
parent 70337f3a4b
commit 9b425b860c
6 changed files with 28 additions and 12 deletions

View file

@ -13,10 +13,7 @@ extern "C" {
ssize_t writev(int fd, const struct iovec* iov, int iov_count)
{
__pthread_maybe_cancel();
int rc = syscall(SC_writev, fd, iov, iov_count);
__RETURN_WITH_ERRNO(rc, rc, -1);
return pwritev(fd, iov, iov_count, -1);
}
ssize_t readv(int fd, const struct iovec* iov, int iov_count)
@ -26,4 +23,12 @@ ssize_t readv(int fd, const struct iovec* iov, int iov_count)
int rc = syscall(SC_readv, fd, iov, iov_count);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
ssize_t pwritev(int fd, struct iovec const* iov, int iov_count, off_t offset)
{
__pthread_maybe_cancel();
int rc = syscall(SC_pwritev, fd, iov, iov_count, &offset);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
}