diff options
author | Jonathan Pryor <jonpryor@vt.edu> | 2012-02-28 02:37:20 +0400 |
---|---|---|
committer | Jonathan Pryor <jonpryor@vt.edu> | 2012-02-28 02:41:37 +0400 |
commit | 163f9061e1d322417eac3bdb66568ce6f9151b09 (patch) | |
tree | 574a869ab8b9504a98e1dcfccd0ce21b671b83e8 /support | |
parent | 1fd5f9af5b08318f85a5d92babca1b97396f31d3 (diff) |
[MonoPosixHelper] Allow MmapFlags.MAP_ANON use on OS X.
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=3419
The problem is that OS X defines MAP_ANON but not MAP_ANONYMOUS, AND
MAP_ANON and MAP_ANONYMOUS have the same value. Furthermore,
create-native-map doesn't have any special support for constants with
the same value, so it emits the validation independently.
The result is that the following fails on OS X:
$ csharp -r:Mono.Posix.dll
csharp> int r;
csharp> using Mono.Unix.Native;
csharp> NativeConvert.TryFromMmapFlags(MmapFlags.MAP_ANONYMOUS, out r);
false
csharp> r;
The (hackish) fix is to provide MAP_ANONYMOUS on OS X, thus allowing
the existing validation logic to work as expected.
Diffstat (limited to 'support')
-rw-r--r-- | support/mph.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/support/mph.h b/support/mph.h index 8a619999426..aedff01b7f3 100644 --- a/support/mph.h +++ b/support/mph.h @@ -75,6 +75,16 @@ #endif /* ndef L_XTND */ /* + * OS X doesn't define MAP_ANONYMOUS, but it does define MAP_ANON. + * Alias them to fix: https://bugzilla.xamarin.com/show_bug.cgi?id=3419 + */ +#ifdef PLATFORM_MACOSX +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif /* ndef MAP_ANONYMOUS */ +#endif /* ndef PLATFORM_MACOSX */ + +/* * XATTR_AUTO is a synonym for 0 within XattrFlags, but most systems don't * define it. map.c doesn't know that, though, so we ensure that it's defined * so that the value 0 round-trips through MonoPosixHelper. |