logo

utils-std

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

sendfile_linux.c (485B)


  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. // Because that's what our utilities will use :)
  5. #define _POSIX_C_SOURCE 200809L
  6. #include <stddef.h> // NULL
  7. #include <sys/sendfile.h>
  8. int
  9. main(void)
  10. {
  11. int fd_in = 0;
  12. int fd_out = 1;
  13. off_t *offset = NULL;
  14. size_t len = 42;
  15. ssize_t ret = sendfile(fd_out, fd_in, offset, len);
  16. return ret > 0;
  17. }