Last active
August 29, 2015 14:24
-
-
Save mathiasuk/cf46d0f0caf1dd597e59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <errno.h> | |
#include <sys/sendfile.h> | |
int main() { | |
int input, output; | |
ssize_t count, written; | |
count = 4294967296; | |
input = open("/tmp/bigfile", O_RDONLY); | |
output = open("/tmp/output", O_WRONLY | O_CREAT); | |
written = sendfile(output, input, NULL, count); | |
if (written == -1) { | |
perror("Sendfile error"); | |
} | |
else { | |
printf("Success, asked for: %zu, written: %zu\n", count, written); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment