/* * Sample sendpath() code. It should mainly be used for sockets. */ #include #include #include #include #include #include #define __NR_sendpath 223 _syscall4 (int, sendpath, int, out_fd, char *, path, off_t *, off, size_t, size) int main (int argc, char **argv) { int out_fd; int ret; out_fd = open("./tmpfile", O_RDWR|O_CREAT|O_TRUNC, 0700); ret = sendpath(out_fd, "/usr/include/unistd.h", NULL, 300); printf("sendpath wrote %d bytes into ./tmpfile.\n", ret); return 0; }