Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/posix/handlers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "handlers/access.hpp"
#include "handlers/chdir.hpp"
#include "handlers/close.hpp"
#include "handlers/copy_file_range.hpp"
#include "handlers/dup.hpp"
#include "handlers/execve.hpp"
#include "handlers/exit.hpp"
Expand Down
21 changes: 21 additions & 0 deletions src/posix/handlers/copy_file_range.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef CAPIO_COPY_FILE_RANGE_HPP
#define CAPIO_COPY_FILE_RANGE_HPP
int copy_file_range_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long arg5,
long *result) {
auto tid = static_cast<pid_t>(syscall_no_intercept(SYS_gettid));
auto fd_in = static_cast<int>(arg0);
auto fd_out = static_cast<int>(arg2);
auto off_in = static_cast<capio_off64_t>(arg1);
auto off_out = static_cast<capio_off64_t>(arg3);
START_LOG(tid, "call()");

// TODO: support in memory read / write
if (exists_capio_fd(fd_in)) {
auto path = get_capio_fd_path(fd_in);
LOG("Handling copy for source file: %s", path.c_str());
read_request_cache_fs->read_request(path, off_in, tid, fd_in);
}

return CAPIO_POSIX_SYSCALL_SKIP;
}
#endif // CAPIO_COPY_FILE_RANGE_HPP
6 changes: 6 additions & 0 deletions src/posix/libcapio_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ static constexpr long CAPIO_NR_SYSCALLS = 1 + std::max({
#endif
#ifdef SYS_writev
SYS_writev,
#endif
#ifdef SYS_copy_file_range
SYS_copy_file_range,
#endif
});

Expand Down Expand Up @@ -356,6 +359,9 @@ static constexpr std::array<CPHandler_t, CAPIO_NR_SYSCALLS> build_syscall_table(
#ifdef SYS_writev
_syscallTable[SYS_writev] = writev_handler;
#endif
#ifdef SYS_copy_file_range
_syscallTable[SYS_copy_file_range] = copy_file_range_handler;
#endif

return _syscallTable;
}
Expand Down