From 3619fe9c4c88b87f95dfe7fe967d15df281fdb21 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Thu, 15 Jan 2015 18:22:37 -0500 Subject: [PATCH] [Mono.Posix] Add overloads to pass ints and pointers --- mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs | 8 ++++++++ support/fcntl.c | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs b/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs index c7860c7e183..c4ff89c0573 100644 --- a/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs +++ b/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs @@ -2060,6 +2060,14 @@ namespace Mono.Unix.Native { EntryPoint="Mono_Posix_Syscall_fcntl_arg")] public static extern int fcntl (int fd, FcntlCommand cmd, long arg); + [DllImport (MPH, SetLastError=true, + EntryPoint="Mono_Posix_Syscall_fcntl_arg_int")] + public static extern int fcntl (int fd, FcntlCommand cmd, int arg); + + [DllImport (MPH, SetLastError=true, + EntryPoint="Mono_Posix_Syscall_fcntl_arg_ptr")] + public static extern int fcntl (int fd, FcntlCommand cmd, IntPtr ptr); + public static int fcntl (int fd, FcntlCommand cmd, DirectoryNotifyFlags arg) { if (cmd != FcntlCommand.F_NOTIFY) { diff --git a/support/fcntl.c b/support/fcntl.c index 12947991c00..85605d1bc21 100644 --- a/support/fcntl.c +++ b/support/fcntl.c @@ -30,6 +30,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) { -- 2.25.1