[msvc] Fix MONO_INTERNAL undefined in Boehm
[mono-project.git] / support / sys-sendfile.c
blob3edf7be4163bac5febd12a6987d64dfbaa5d2b86
1 /*
2 * <sys/sendfile.h> wrapper functions.
4 * Authors:
5 * Jonathan Pryor (jonpryor@vt.edu)
7 * Copyright (C) 2004 Jonathan Pryor
8 */
10 #include <config.h>
12 #include <sys/types.h>
13 #include <errno.h>
15 #include "map.h"
16 #include "mph.h"
18 #ifdef HAVE_SYS_SENDFILE_H
19 #include <sys/sendfile.h>
20 #endif /* ndef HAVE_SYS_SENDFILE_H */
22 G_BEGIN_DECLS
24 #ifdef HAVE_SENDFILE
25 mph_ssize_t
26 Mono_Posix_Syscall_sendfile (int out_fd, int in_fd, mph_off_t *offset, mph_size_t count)
28 off_t _offset;
29 ssize_t r;
30 mph_return_if_off_t_overflow (*offset);
32 _offset = *offset;
34 #if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD)
35 /* The BSD version has 6 arguments */
36 g_assert_not_reached ();
37 #else
38 r = sendfile (out_fd, in_fd, &_offset, (size_t) count);
39 #endif
41 *offset = _offset;
43 return r;
45 #endif /* ndef HAVE_SENDFILE */
47 G_END_DECLS
50 * vim: noexpandtab