PDA

View Full Version : VERY URGENT : problem with mmap()


ShivSainik
October 27th, 2003, 06:20 AM
All Unix gurus,

I know what I am asking is not probably possible by standards, but I am ok with any kind of hacks. There was a bug in previous release of our product and in production environment it has been re-produced and we need to give an utility which will temporarly fix the problem ASAP. Please help me.

Basically I have implemented my own file locking mecahnism using shared memory where I maintain hash-table of locked files in shared-memory. for that I use OSSP MM library which has its own malloc() implementation on shared memory. Which in turn used anonymous mmaped files as shared memory implementations.

Now problem : Because of one bug, in particular condition we do not unlock the file and that file become inaccessible. :mad:

Now we need to provide an utility which will externally attach to that mmaped region which maintains file-locking table and use existing APIs to release the stale lock without restarting the server.

HOW DO YOU ATTACH / SHARE ANONYMOYS AREA WHICH WAS CREATED USING mmap(NULL,.....) with MAP_ANON_FLAG by some other process ?

TIA

ShivSainik
October 28th, 2003, 07:49 AM
No unix guru on ec ? :(

BTW it is not possible to do unless you do exotic things such as attaching to process using ptrace() and all those ugly things debuggers do.