Hi, Applied to to SVN HEAD/2.6/2.4 branches.
Zoltan On Fri, Mar 5, 2010 at 6:21 PM, cpMon <page....@gmail.com> wrote: > > > The shared memory files are created in /dev/shm/... on linux, but the code > tries to find them in your home account. Since the file doesn't exist, a 0 > is returned from ftok. This results in a pileup of shm's and semaphores. > Run > ipcs -a after every run to see the probmem. > > Cal Page > > Here's the patch: > Index: mono/io-layer/shared.c > =================================================================== > RCS file: /usr/local/teradyne/cvsroot/mono-2.6.1/mono/io-layer/shared.c,v > retrieving revision 1.1 > retrieving revision 1.2 > diff -u -u -8 -p -r1.1 -r1.2 > --- mono/io-layer/shared.c 25 Feb 2010 12:36:10 -0000 1.1 > +++ mono/io-layer/shared.c 26 Feb 2010 14:26:41 -0000 1.2 > @@ -476,16 +476,19 @@ _wapi_shm_attach (_wapi_shm_t type) > > static void > shm_semaphores_init (void) > { > key_t key; > key_t oldkey; > int thr_ret; > struct _WapiHandleSharedLayout *tmp_shared; > + > + gchar *ftmp; > + gchar *filename; > > /* > * Yet more barmy API - this union is a well-defined parameter > * in a syscall, yet I still have to define it here as it > * doesn't appear in a header > */ > union semun { > int val; > @@ -514,18 +517,26 @@ shm_semaphores_init (void) > * after getting the semaphores to avoid a race condition > * where a terminating process can delete the shared files > * between a new process attaching the file and getting access > * to the semaphores (which increments the process count, > * preventing destruction of the shared data...) > */ > tmp_shared = _wapi_shm_attach (WAPI_SHM_DATA); > g_assert (tmp_shared != NULL); > - > - key = ftok (_wapi_shm_file (WAPI_SHM_DATA), 'M'); > + > +#ifdef USE_SHM > + filename = > g_build_filename("/dev/shm",(ftmp=_wapi_shm_shm_name(WAPI_SHM_DATA)),NULL); > + g_assert(filename!=NULL); > + key = ftok ( filename, 'M'); > + g_free(ftmp); > + g_free(filename); > +#else > + key = ftok ( _wapi_shm_file (WAPI_SHM_DATA), 'M'); > +#endif > > again: > retries++; > oldkey = tmp_shared->sem_key; > > if (oldkey == 0) { > DEBUGLOG ("%s: Creating with new key (0x%x)", __func__, > key); > > -- > View this message in context: > http://n4.nabble.com/PATCH-mono-io-layer-shared-c-sends-non-existant-file-to-ftok-for-Linux-tp1579884p1579884.html > Sent from the Mono - Dev mailing list archive at Nabble.com. > _______________________________________________ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list >
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list