Created
November 12, 2020 21:42
-
-
Save infinity0/93bcaa9951434a757843d6f595fd2c71 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
#define _GNU_SOURCE | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <limits.h> | |
#include <stdio.h> | |
#include <linux/types.h> | |
size_t max = (size_t)LONG_MAX +1; // (size_t)LONG_MAX+1 | |
loff_t off = 0; | |
#define ISUNSIGNED(a) (a >= 0 && ~a >= 0) | |
int main() { | |
FILE *fa = fopen("a.txt", "rb"); | |
FILE *fb = fopen("b.txt", "wb"); | |
printf("sizes: size_t %p, ssize_t %p, loff_t %p, loff_t unsigned %d\n", sizeof((size_t)0), sizeof((ssize_t)0), sizeof((loff_t)0), ISUNSIGNED(off)); | |
printf("calling copy_file_range with len %p\n", max); | |
if (copy_file_range(fileno(fa), NULL, fileno(fb), NULL, max, 0) < 0) { | |
perror(NULL); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment