Prepare Mono for Android NDK with unified headers (#5680)
[mono.git] / support / fcntl.c
index 12947991c00fa9387a9d1b2896e2c008e5313256..1fd324e399f1a2b684b81ab99425096f9f3b181c 100644 (file)
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <fcntl.h>
 #include <errno.h>
+#ifdef HOST_WIN32
+#include <corecrt_io.h>
+#endif
 
+#include "mph.h" /* Don't remove or move after map.h! Works around issues with Android SDK unified headers */
 #include "map.h"
-#include "mph.h"
 
 G_BEGIN_DECLS
 
+#ifndef HOST_WIN32
 gint32
 Mono_Posix_Syscall_fcntl (gint32 fd, gint32 cmd)
 {
@@ -30,6 +36,22 @@ Mono_Posix_Syscall_fcntl (gint32 fd, gint32 cmd)
        return fcntl (fd, cmd);
 }
 
+gint32
+Mono_Posix_Syscall_fcntl_arg_int (gint32 fd, gint32 cmd, int arg)
+{
+       if (Mono_Posix_FromFcntlCommand (cmd, &cmd) == -1)
+               return -1;
+       return fcntl (fd, cmd, arg);
+}
+
+gint32
+Mono_Posix_Syscall_fcntl_arg_ptr (gint32 fd, gint32 cmd, void *arg)
+{
+       if (Mono_Posix_FromFcntlCommand (cmd, &cmd) == -1)
+               return -1;
+       return fcntl (fd, cmd, arg);
+}
+
 gint32
 Mono_Posix_Syscall_fcntl_arg (gint32 fd, gint32 cmd, gint64 arg)
 {
@@ -79,6 +101,7 @@ Mono_Posix_Syscall_fcntl_lock (gint32 fd, gint32 cmd, struct Mono_Posix_Flock *l
 
        return r;
 }
+#endif
 
 gint32
 Mono_Posix_Syscall_open (const char *pathname, gint32 flags)