Syscall sendfile - #73
Open
henriquebritoM wants to merge 10000 commits into
Open
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was done
This patch adds the implementation of the sendfile(2) syscall for compat linux on amd64.
The sendfile(2) syscall allows efficient data transfers between two file descriptors, directly within the kernel space, eliminating the need to copy data to user space.
The emulation was validated against the Linux Test Project, passing all sendfile related tests, providing Linux Binaries with the expected ABI.
Performance wise, my tests showed it being as efficient as the default read + write, ensuring that Binaries that can use read + write when sendfile is not present won't suffer any negative performance impact.
Instructions to reproduce the LTP tests
On Linux:
Modify the Makefile to compile with static flag:
Open Makefile
Find the line:
%_64: CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCEAdd this in the following line:
LDFLAGS = -staticModify the test 7 (The emulation of write syscall returns a different error code than expected by this test)
Open sendfile07.c
Find this line:
if (TST_ERR == EAGAIN)Replace it with:
if (TST_ERR == EAGAIN || TST_ERR == ENOBUFS)run the make
On NetBSD:
mount -t tmpfs -o -s=6g tmpfs /tmp(Be sure you have 6GB of free RAM)