Skip to content

Commit

Permalink
Remove MONO_IOMAP / portability from mono (#56458)
Browse files Browse the repository at this point in the history
It's not used in netcore mono (since it only works in mono but not the PAL) and judging by the discussion in #35299 the consensus is that we should not bring that feature back.
  • Loading branch information
akoeplinger committed Jul 28, 2021
1 parent a3ddef1 commit 6789379
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 527 deletions.
1 change: 0 additions & 1 deletion src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(HOST_WIN32 1)
set(EXE_SUFFIX ".exe")
set(DISABLE_CRASH_REPORTING 1)
set(DISABLE_PORTABILITY 1)
set(HOST_NO_SYMLINKS 1)
set(MONO_KEYWORD_THREAD "__declspec (thread)")
set(MONO_ZERO_LEN_ARRAY 1)
Expand Down
3 changes: 0 additions & 3 deletions src/mono/cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@
/* Define to the home page for this package. */
#cmakedefine PACKAGE_URL 1

/* Disables the IO portability layer */
#cmakedefine DISABLE_PORTABILITY 1

/* This platform does not support symlinks */
#cmakedefine HOST_NO_SYMLINKS 1

Expand Down
1 change: 0 additions & 1 deletion src/mono/cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Configure options
#

option (DISABLE_PORTABILITY "Disables the IO portability layer")
option (DISABLE_AOT "Disable AOT Compiler")
option (DISABLE_PROFILER "Disable default profiler support")
option (DISABLE_DECIMAL "Disable System.Decimal support")
Expand Down
6 changes: 3 additions & 3 deletions src/mono/mono.proj
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
<_MonoMinimal Condition="'$(Configuration)' == 'Release' and '$(MonoEnableAssertMessages)' != 'true'">$(_MonoMinimal),assert_messages</_MonoMinimal>
</PropertyGroup>
<ItemGroup Condition="'$(TargetsBrowser)' == 'true'">
<_MonoCMakeArgs Include="-DENABLE_MINIMAL=jit,portability,sgen_major_marksweep_conc,sgen_split_nursery,sgen_gc_bridge,sgen_toggleref,sgen_debug_helpers,sgen_binary_protocol,logging,shared_perfcounters,interpreter,threads,qcalls$(_MonoMinimal)"/>
<_MonoCMakeArgs Include="-DENABLE_MINIMAL=jit,sgen_major_marksweep_conc,sgen_split_nursery,sgen_gc_bridge,sgen_toggleref,sgen_debug_helpers,sgen_binary_protocol,logging,shared_perfcounters,interpreter,threads,qcalls$(_MonoMinimal)"/>
<_MonoCMakeArgs Include="-DENABLE_INTERP_LIB=1"/>
<_MonoCMakeArgs Include="-DDISABLE_ICALL_TABLES=1"/>
<_MonoCMakeArgs Include="-DDISABLE_CRASH_REPORTING=1"/>
Expand Down Expand Up @@ -351,7 +351,7 @@
</ItemGroup>
<!-- iOS/tvOS device specific options -->
<ItemGroup Condition="('$(TargetsiOS)' == 'true' and '$(TargetsiOSSimulator)' != 'true') or ('$(TargetstvOS)' == 'true' and '$(TargetstvOSSimulator)' != 'true')">
<_MonoCMakeArgs Include="-DENABLE_MINIMAL=jit,portability,logging,shared_perfcounters" />
<_MonoCMakeArgs Include="-DENABLE_MINIMAL=jit,logging,shared_perfcounters" />
<_MonoCMakeArgs Include="-DENABLE_VISIBILITY_HIDDEN=1"/>
<_MonoCMakeArgs Include="-DENABLE_LAZY_GC_THREAD_CREATION=1"/>
<_MonoCMakeArgs Include="-DENABLE_SIGALTSTACK=0"/>
Expand Down Expand Up @@ -381,7 +381,7 @@
<_MonoCMakeArgs Condition="'$(Platform)' == 'arm'" Include="-DANDROID_ABI=armeabi-v7a" />
<_MonoCMakeArgs Condition="'$(Platform)' == 'x86'" Include="-DANDROID_ABI=x86" />
<_MonoCMakeArgs Condition="'$(Platform)' == 'x64'" Include="-DANDROID_ABI=x86_64" />
<_MonoCMakeArgs Include="-DENABLE_MINIMAL=ssa,portability,logging" />
<_MonoCMakeArgs Include="-DENABLE_MINIMAL=ssa,logging" />
<_MonoCMakeArgs Include="-DENABLE_SIGALTSTACK=1"/>
<_MonoCMakeArgs Include="-DDISABLE_CRASH_REPORTING=1"/>

Expand Down
13 changes: 1 addition & 12 deletions src/mono/mono/metadata/appdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
#include <mono/utils/mono-logger-internals.h>
#include <mono/utils/mono-path.h>
#include <mono/utils/mono-stdlib.h>
#include <mono/utils/mono-io-portability.h>
#include <mono/utils/mono-error-internals.h>
#include <mono/utils/atomic.h>
#include <mono/utils/mono-memory-model.h>
Expand Down Expand Up @@ -250,8 +249,6 @@ mono_runtime_init_checked (MonoDomain *domain, MonoThreadStartCB start_cb, MonoT

error_init (error);

mono_portability_helpers_init ();

mono_gc_base_init ();
mono_monitor_init ();
mono_marshal_init ();
Expand Down Expand Up @@ -620,15 +617,7 @@ try_load_from (MonoAssembly **assembly,
*assembly = NULL;
fullpath = g_build_filename (path1, path2, path3, path4, (const char*)NULL);

if (IS_PORTABILITY_SET) {
gchar *new_fullpath = mono_portability_find_file (fullpath, TRUE);
if (new_fullpath) {
g_free (fullpath);
fullpath = new_fullpath;
found = TRUE;
}
} else
found = g_file_test (fullpath, G_FILE_TEST_IS_REGULAR);
found = g_file_test (fullpath, G_FILE_TEST_IS_REGULAR);

if (found) {
*assembly = mono_assembly_request_open (fullpath, req, NULL);
Expand Down
1 change: 0 additions & 1 deletion src/mono/mono/metadata/assembly.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include <mono/metadata/reflection.h>
#include <mono/metadata/coree.h>
#include <mono/metadata/cil-coff.h>
#include <mono/utils/mono-io-portability.h>
#include <mono/utils/atomic.h>
#include <mono/utils/mono-os-mutex.h>
#include <mono/metadata/mono-private-unstable.h>
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/file-mmap-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ open_file_map (const char *c_path, int input_fd, int mode, gint64 *capacity, int
}

MONO_ENTER_GC_SAFE;
if (c_path) //FIXME use io portability?
if (c_path)
fd = open (c_path, file_mode_to_unix (mode) | access_mode_to_unix (access), DEFAULT_FILEMODE);
else
fd = dup (input_fd);
Expand Down
1 change: 0 additions & 1 deletion src/mono/mono/metadata/icall.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
#include <mono/utils/mono-string.h>
#include <mono/utils/mono-error-internals.h>
#include <mono/utils/mono-mmap.h>
#include <mono/utils/mono-io-portability.h>
#include <mono/utils/mono-digest.h>
#include <mono/utils/bsearch.h>
#include <mono/utils/mono-os-mutex.h>
Expand Down
15 changes: 2 additions & 13 deletions src/mono/mono/metadata/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <mono/utils/mono-errno.h>
#include <mono/utils/mono-path.h>
#include <mono/utils/mono-mmap.h>
#include <mono/utils/mono-io-portability.h>
#include <mono/utils/atomic.h>
#include <mono/utils/mono-proclib.h>
#include <mono/metadata/class-internals.h>
Expand Down Expand Up @@ -1374,18 +1373,8 @@ mono_image_storage_open (const char *fname)

MonoFileMap *filed;
if ((filed = mono_file_map_open (fname)) == NULL){
if (IS_PORTABILITY_SET) {
gchar *ffname = mono_portability_find_file (fname, TRUE);
if (ffname) {
filed = mono_file_map_open (ffname);
g_free (ffname);
}
}

if (filed == NULL) {
g_free (key);
return NULL;
}
g_free (key);
return NULL;
}

MonoImageStorage *storage = g_new0 (MonoImageStorage, 1);
Expand Down
76 changes: 4 additions & 72 deletions src/mono/mono/metadata/w32file-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#include "w32error.h"
#include "fdhandle.h"
#include "utils/mono-error-internals.h"
#include "utils/mono-io-portability.h"
#include "utils/mono-logger-internals.h"
#include "utils/mono-os-mutex.h"
#include "utils/mono-threads.h"
Expand Down Expand Up @@ -235,39 +234,10 @@ static gint
_wapi_open (const gchar *pathname, gint flags, mode_t mode)
{
gint fd;
gchar *located_filename;

if (flags & O_CREAT) {
located_filename = mono_portability_find_file (pathname, FALSE);
if (located_filename == NULL) {
MONO_ENTER_GC_SAFE;
fd = open (pathname, flags, mode);
MONO_EXIT_GC_SAFE;
} else {
MONO_ENTER_GC_SAFE;
fd = open (located_filename, flags, mode);
MONO_EXIT_GC_SAFE;
g_free (located_filename);
}
} else {
MONO_ENTER_GC_SAFE;
fd = open (pathname, flags, mode);
MONO_EXIT_GC_SAFE;
if (fd == -1 && (errno == ENOENT || errno == ENOTDIR) && IS_PORTABILITY_SET) {
gint saved_errno = errno;
located_filename = mono_portability_find_file (pathname, TRUE);

if (located_filename == NULL) {
mono_set_errno (saved_errno);
return -1;
}

MONO_ENTER_GC_SAFE;
fd = open (located_filename, flags, mode);
MONO_EXIT_GC_SAFE;
g_free (located_filename);
}
}

MONO_ENTER_GC_SAFE;
fd = open (pathname, flags, mode);
MONO_EXIT_GC_SAFE;

return(fd);
}
Expand All @@ -280,20 +250,6 @@ _wapi_access (const gchar *pathname, gint mode)
MONO_ENTER_GC_SAFE;
ret = access (pathname, mode);
MONO_EXIT_GC_SAFE;
if (ret == -1 && (errno == ENOENT || errno == ENOTDIR) && IS_PORTABILITY_SET) {
gint saved_errno = errno;
gchar *located_filename = mono_portability_find_file (pathname, TRUE);

if (located_filename == NULL) {
mono_set_errno (saved_errno);
return -1;
}

MONO_ENTER_GC_SAFE;
ret = access (located_filename, mode);
MONO_EXIT_GC_SAFE;
g_free (located_filename);
}

return ret;
}
Expand All @@ -306,20 +262,6 @@ _wapi_unlink (const gchar *pathname)
MONO_ENTER_GC_SAFE;
ret = unlink (pathname);
MONO_EXIT_GC_SAFE;
if (ret == -1 && (errno == ENOENT || errno == ENOTDIR || errno == EISDIR) && IS_PORTABILITY_SET) {
gint saved_errno = errno;
gchar *located_filename = mono_portability_find_file (pathname, TRUE);

if (located_filename == NULL) {
mono_set_errno (saved_errno);
return -1;
}

MONO_ENTER_GC_SAFE;
ret = unlink (located_filename);
MONO_EXIT_GC_SAFE;
g_free (located_filename);
}

return ret;
}
Expand All @@ -329,16 +271,6 @@ _wapi_dirname (const gchar *filename)
{
gchar *new_filename = g_strdup (filename), *ret;

if (IS_PORTABILITY_SET)
g_strdelimit (new_filename, '\\', '/');

if (IS_PORTABILITY_DRIVE && g_ascii_isalpha (new_filename[0]) && (new_filename[1] == ':')) {
gint len = strlen (new_filename);

g_memmove (new_filename, new_filename + 2, len - 2);
new_filename[len - 2] = '\0';
}

ret = g_path_get_dirname (new_filename);
g_free (new_filename);

Expand Down
2 changes: 0 additions & 2 deletions src/mono/mono/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ set(utils_common_sources
mono-state.c
mono-internal-hash.c
mono-internal-hash.h
mono-io-portability.c
mono-io-portability.h
monobitset.c
mono-filemap.c
mono-math-c.c
Expand Down
Loading

0 comments on commit 6789379

Please sign in to comment.