logo

utils-std

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

sendfile_linux.c (461B)


  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 <sys/sendfile.h>
  7. int
  8. main(void)
  9. {
  10. int fd_in = 0;
  11. int fd_out = 1;
  12. off_t *offset = (off_t)0;
  13. size_t len = 42;
  14. ssize_t ret = sendfile(fd_out, fd_in, offset, len);
  15. return ret > 0;
  16. }