diff options
author | Steffen Kieß <kiess@ki4.de> | 2019-10-08 13:04:45 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2019-10-08 13:04:45 +0300 |
commit | 8bb7b8645a2622462f065d53f252b922bb304134 (patch) | |
tree | 595185bf63ea89749e1b819421b11b0396e9a69e /mcs/class/Mono.Posix | |
parent | ad2132e611a7e8b7c7dcaed1c3ecc23d40dc17de (diff) |
Clean up map.c /map.h (#16746)
* [Mono.Posix] Move Mono_Posix_{From,To}MremapFlags() to support/sys-mman.c
Since b522eab5ff5466debaacf9e971e26cfc464ebba5 Mono_Posix_FromMremapFlags()
and Mono_Posix_ToMremapFlags() contain manual changes for NetBSD. Move the
functions from support/map.c to support/sys-mman.c so that they won't be
overwritten when create-native-map is rerun.
* [Mono.Posix] Fix prototypes in support/stdio.c
In ed892ccf27849c082ce6ca46fa8b96d86ca7c329 wrapper functions for several
stdio functions were added, but the prototypes in map.h were manually
written, not using create-native-map. This commit changes the prototypes so
that they match the output of create-native-map.
* [Mono.Posix] Undefine HAVE_STRUCT_SOCKADDR_IN6 in support/map.c on MSVC
In 22b6b9581418260397b701c17b16c3eb55136de7 a manual change to support/map.c
was added to prevent Mono_Posix_FromSockaddrIn6() and
Mono_Posix_ToSockaddrIn6() from being built for windows even if
HAVE_STRUCT_SOCKADDR_IN6 is defined. Instead undefine it in a header file
to avoid manual changes to map.c.
With this commit map.c, map.h and NativeConvert.generated.cs contain no
manual changes anymore.
Diffstat (limited to 'mcs/class/Mono.Posix')
3 files changed, 36 insertions, 34 deletions
diff --git a/mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.cs b/mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.cs index 810e13a7ca8..3c83aacd9e9 100644 --- a/mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.cs +++ b/mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.cs @@ -341,6 +341,38 @@ namespace Mono.Unix.Native { return fopen_mode; } + [DllImport (LIB, EntryPoint="Mono_Posix_FromMremapFlags")] + private static extern int FromMremapFlags (MremapFlags value, out UInt64 rval); + + public static bool TryFromMremapFlags (MremapFlags value, out UInt64 rval) + { + return FromMremapFlags (value, out rval) == 0; + } + + public static UInt64 FromMremapFlags (MremapFlags value) + { + UInt64 rval; + if (FromMremapFlags (value, out rval) == -1) + ThrowArgumentException (value); + return rval; + } + + [DllImport (LIB, EntryPoint="Mono_Posix_ToMremapFlags")] + private static extern int ToMremapFlags (UInt64 value, out MremapFlags rval); + + public static bool TryToMremapFlags (UInt64 value, out MremapFlags rval) + { + return ToMremapFlags (value, out rval) == 0; + } + + public static MremapFlags ToMremapFlags (UInt64 value) + { + MremapFlags rval; + if (ToMremapFlags (value, out rval) == -1) + ThrowArgumentException (value); + return rval; + } + [DllImport (LIB, EntryPoint="Mono_Posix_FromStat")] private static extern int FromStat (ref Stat source, IntPtr destination); diff --git a/mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.generated.cs b/mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.generated.cs index d980bbf22c6..cf538806236 100644 --- a/mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.generated.cs +++ b/mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.generated.cs @@ -1,5 +1,5 @@ /* - * This file was automatically generated by create-native-map from ./../../class/lib/net_4_x/Mono.Posix.dll. + * This file was automatically generated by create-native-map from ./../../class/lib/net_4_x-linux/Mono.Posix.dll. * * DO NOT MODIFY. */ @@ -598,38 +598,6 @@ namespace Mono.Unix.Native { return rval; } - [DllImport (LIB, EntryPoint="Mono_Posix_FromMremapFlags")] - private static extern int FromMremapFlags (MremapFlags value, out UInt64 rval); - - public static bool TryFromMremapFlags (MremapFlags value, out UInt64 rval) - { - return FromMremapFlags (value, out rval) == 0; - } - - public static UInt64 FromMremapFlags (MremapFlags value) - { - UInt64 rval; - if (FromMremapFlags (value, out rval) == -1) - ThrowArgumentException (value); - return rval; - } - - [DllImport (LIB, EntryPoint="Mono_Posix_ToMremapFlags")] - private static extern int ToMremapFlags (UInt64 value, out MremapFlags rval); - - public static bool TryToMremapFlags (UInt64 value, out MremapFlags rval) - { - return ToMremapFlags (value, out rval) == 0; - } - - public static MremapFlags ToMremapFlags (UInt64 value) - { - MremapFlags rval; - if (ToMremapFlags (value, out rval) == -1) - ThrowArgumentException (value); - return rval; - } - [DllImport (LIB, EntryPoint="Mono_Posix_FromMsyncFlags")] private static extern int FromMsyncFlags (MsyncFlags value, out Int32 rval); diff --git a/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs b/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs index c9eb750d222..e4f2b58e19a 100644 --- a/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs +++ b/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs @@ -725,7 +725,9 @@ namespace Mono.Unix.Native { MCL_FUTURE = 0x2, // Lock all additions to address } - [Map][Flags] + // Use manually written To/From methods because NetBSD needs special treatment for MREMAP_MAYMOVE + // This has to be kept in sync with sys-mman.c + [Flags] [CLSCompliant (false)] public enum MremapFlags : ulong { MREMAP_MAYMOVE = 0x1, |