From f5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 7 Mar 2024 17:28:52 -0500 Subject: build: Build mlibc + add distclean target Signed-off-by: Ian Moffett --- lib/mlibc/options/posix/generic/sys-uio.cpp | 67 ----------------------------- 1 file changed, 67 deletions(-) delete mode 100644 lib/mlibc/options/posix/generic/sys-uio.cpp (limited to 'lib/mlibc/options/posix/generic/sys-uio.cpp') diff --git a/lib/mlibc/options/posix/generic/sys-uio.cpp b/lib/mlibc/options/posix/generic/sys-uio.cpp deleted file mode 100644 index 0f14bc0..0000000 --- a/lib/mlibc/options/posix/generic/sys-uio.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -ssize_t readv(int fd, const struct iovec *iovs, int iovc) { - ssize_t read_bytes = 0; - - auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_readv, -1); - - if (int e = sysdep(fd, iovs, iovc, &read_bytes); e) { - errno = e; - return -1; - } - - return read_bytes; -} - -ssize_t writev(int fd, const struct iovec *iovs, int iovc) { - __ensure(iovc); - - ssize_t written = 0; - size_t bytes = 0; - for(int i = 0; i < iovc; i++) { - if(SSIZE_MAX - bytes < iovs[i].iov_len) { - errno = EINVAL; - return -1; - } - bytes += iovs[i].iov_len; - } - frg::vector buffer{getAllocator()}; - buffer.resize(bytes); - - size_t to_copy = bytes; - char *bp = buffer.data(); - for(int i = 0; i < iovc; i++) { - size_t copy = frg::min(iovs[i].iov_len, to_copy); - - bp = (char *)mempcpy((void *)bp, (void *)iovs[i].iov_base, copy); - - to_copy -= copy; - if(to_copy == 0) - break; - } - - written = write(fd, buffer.data(), bytes); - return written; -} - -ssize_t preadv(int, const struct iovec *, int, off_t) { - __ensure(!"Not implemented"); - __builtin_unreachable(); -} - -ssize_t pwritev(int, const struct iovec *, int, off_t) { - __ensure(!"Not implemented"); - __builtin_unreachable(); -} -- cgit v1.2.3