Restructure of mono.sln and build properties to better fix static/dynamic library...
[mono.git] / support / sys-sendfile.c
index 1e8092de82c4886adce8218a5232fc51d918843a..7b6797acb04160a9b17fdc038389dfaece9dae5a 100644 (file)
@@ -7,13 +7,21 @@
  * Copyright (C) 2004 Jonathan Pryor
  */
 
-#include <sys/sendfile.h>
+#include <config.h>
+
+#include <sys/types.h>
 #include <errno.h>
 
+#include "map.h"
 #include "mph.h"
 
+#ifdef HAVE_SYS_SENDFILE_H
+#include <sys/sendfile.h>
+#endif /* ndef HAVE_SYS_SENDFILE_H */
+
 G_BEGIN_DECLS
 
+#ifdef HAVE_SENDFILE
 mph_ssize_t
 Mono_Posix_Syscall_sendfile (int out_fd, int in_fd, mph_off_t *offset, mph_size_t count)
 {
@@ -23,12 +31,18 @@ Mono_Posix_Syscall_sendfile (int out_fd, int in_fd, mph_off_t *offset, mph_size_
 
        _offset = *offset;
 
+#if defined(HOST_DARWIN) || defined(HOST_BSD)
+       /* The BSD version has 6 arguments */
+       g_assert_not_reached ();
+#else
        r = sendfile (out_fd, in_fd, &_offset, (size_t) count);
+#endif
 
        *offset = _offset;
 
        return r;
 }
+#endif /* ndef HAVE_SENDFILE */
 
 G_END_DECLS