logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git

copy_file_range.c (489B)


  1. // utils-std: Collection of commonly available Unix tools
  2. // SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. // SPDX-License-Identifier: MPL-2.0
  4. // For copy_file_range
  5. #define _GNU_SOURCE // musl, glibc
  6. #define _DEFAULT_SOURCE // FreeBSD
  7. #include <stdint.h> // SIZE_MAX
  8. #include <sys/types.h>
  9. #include <unistd.h>
  10. ssize_t
  11. test(int in, int out)
  12. {
  13. off_t in_pos = 0, out_pos = 0;
  14. return copy_file_range(in, &in_pos, out, &out_pos, SIZE_MAX, 0);
  15. }