Skip to content

Commit

Permalink
2007-04-26 Dick Porter <dick@ximian.com>
Browse files Browse the repository at this point in the history
	* shared.c (_wapi_shm_semaphores_init): Need to check
	MONO_DISABLE_SHM in this entry point, as it's called before
	_wapi_shm_attach().  Fixes bug 81436.



svn path=/branches/mono-1-2-4/mono/; revision=76325
  • Loading branch information
dickp committed Apr 26, 2007
1 parent afc9932 commit 54d3c2c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
7 changes: 7 additions & 0 deletions mono/io-layer/ChangeLog
@@ -1,3 +1,10 @@
2007-04-26 Dick Porter <dick@ximian.com>

* shared.c (_wapi_shm_semaphores_init): Need to check
MONO_DISABLE_SHM in this entry point, as it's called before
_wapi_shm_attach(). Fixes bug 81436.


2007-04-13 Dick Porter <dick@ximian.com>

* shared.h:
Expand Down
22 changes: 15 additions & 7 deletions mono/io-layer/shared.c
Expand Up @@ -220,6 +220,18 @@ static int _wapi_shm_file_open (const gchar *filename, guint32 wanted_size)
return(fd);
}

static gboolean check_disabled (void)
{
if (_wapi_shm_disabled || g_getenv ("MONO_DISABLE_SHM")) {
const char* val = g_getenv ("MONO_DISABLE_SHM");
if (val == NULL || *val == '1' || *val == 'y' || *val == 'Y') {
_wapi_shm_disabled = TRUE;
}
}

return(_wapi_shm_disabled);
}

/*
* _wapi_shm_attach:
* @success: Was it a success
Expand Down Expand Up @@ -248,12 +260,8 @@ gpointer _wapi_shm_attach (_wapi_shm_t type)
return NULL;
}

if (_wapi_shm_disabled || g_getenv ("MONO_DISABLE_SHM")) {
const char* val = g_getenv ("MONO_DISABLE_SHM");
if (val == NULL || *val == '1' || *val == 'y' || *val == 'Y') {
_wapi_shm_disabled = TRUE;
return g_malloc0 (size);
}
if (check_disabled ()) {
return g_malloc0 (size);
}

fd = _wapi_shm_file_open (filename, size);
Expand Down Expand Up @@ -676,7 +684,7 @@ static int noshm_sem_unlock (int sem)

void _wapi_shm_semaphores_init (void)
{
if (_wapi_shm_disabled) {
if (check_disabled ()) {
noshm_semaphores_init ();
} else {
shm_semaphores_init ();
Expand Down

0 comments on commit 54d3c2c

Please sign in to comment.