From dc509bfab4fd58ea0a483682711c497be6ea7e9b Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sat, 18 Feb 2023 11:38:48 -0500 Subject: [PATCH] fs_shell: Use proper readv/writev functions on Haiku hosts. Fixes #18269. --- src/tools/fs_shell/uio.cpp | 8 ++++++++ src/tools/fs_shell/unistd.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/tools/fs_shell/uio.cpp b/src/tools/fs_shell/uio.cpp index 9a323d8b2d..31d60099d3 100644 --- a/src/tools/fs_shell/uio.cpp +++ b/src/tools/fs_shell/uio.cpp @@ -79,7 +79,11 @@ fssh_readv_pos(int fd, fssh_off_t pos, const struct fssh_iovec *vec, int count) if (FSShell::restricted_file_restrict_io(fd, pos, length) < 0) return -1; +#if defined(__HAIKU__) + return readv_pos(fd, pos, systemVecs, count); +#else return _kern_readv(fd, pos, systemVecs, count); +#endif } @@ -114,5 +118,9 @@ fssh_writev_pos(int fd, fssh_off_t pos, const struct fssh_iovec *vec, int count) if (FSShell::restricted_file_restrict_io(fd, pos, length) < 0) return -1; +#if defined(__HAIKU__) + return writev_pos(fd, pos, systemVecs, count); +#else return _kern_writev(fd, pos, systemVecs, count); +#endif } diff --git a/src/tools/fs_shell/unistd.cpp b/src/tools/fs_shell/unistd.cpp index 8502a1ea96..c02b3a07e5 100644 --- a/src/tools/fs_shell/unistd.cpp +++ b/src/tools/fs_shell/unistd.cpp @@ -390,7 +390,11 @@ fssh_read_pos(int fd, fssh_off_t pos, void *buffer, fssh_size_t count) { if (FSShell::restricted_file_restrict_io(fd, pos, count) < 0) return -1; +#if defined(__HAIKU__) + return read_pos(fd, pos, buffer, count); +#else return _kern_read(fd, pos, buffer, count); +#endif } @@ -417,7 +421,11 @@ fssh_write_pos(int fd, fssh_off_t pos, const void *buffer, fssh_size_t count) { if (FSShell::restricted_file_restrict_io(fd, pos, count) < 0) return -1; +#if defined(__HAIKU__) + return write_pos(fd, pos, buffer, count); +#else return _kern_write(fd, pos, buffer, count); +#endif }