sys-sendfile.c 705 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * <sys/sendfile.h> wrapper functions.
  3. *
  4. * Authors:
  5. * Jonathan Pryor ([email protected])
  6. *
  7. * Copyright (C) 2004 Jonathan Pryor
  8. */
  9. #include <sys/types.h>
  10. #include <errno.h>
  11. #include "map.h"
  12. #include "mph.h"
  13. #ifdef HAVE_SYS_SENDFILE_H
  14. #include <sys/sendfile.h>
  15. #endif /* ndef HAVE_SYS_SENDFILE_H */
  16. G_BEGIN_DECLS
  17. #ifdef HAVE_SENDFILE
  18. mph_ssize_t
  19. Mono_Posix_Syscall_sendfile (int out_fd, int in_fd, mph_off_t *offset, mph_size_t count)
  20. {
  21. off_t _offset;
  22. ssize_t r;
  23. mph_return_if_off_t_overflow (*offset);
  24. _offset = *offset;
  25. r = sendfile (out_fd, in_fd, &_offset, (size_t) count);
  26. *offset = _offset;
  27. return r;
  28. }
  29. #endif /* ndef HAVE_SENDFILE */
  30. G_END_DECLS
  31. /*
  32. * vim: noexpandtab
  33. */