add support for the basic sendfile syscall

Mostly refactoring fixes so we can use the same codepaths for `sendfile` and `sendfile64`.