Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Dec 1996 12:18:38 +0000
From:      James Mansion <james@wgold.demon.co.uk>
To:        hackers@freebsd.org
Subject:   mmap pain
Message-ID:  <32B7E11E.22@wgold.demon.co.uk>

next in thread | raw e-mail | index | archive | help
I have a 'well known' shared memory area that is in the file system
and mapped using mmap.  It is dynamically created if necessary.
I'd like to tidy it up, too.

I can quite easily detect if a process has opened it by placing
locks at hashed offsets in the file and checking to see if there
are any locks in place.  If not, then it should be safe to delete
since I'm the last user.

However, locks aren't inherited over a fork, so maybe the memory
is still mapped into some child process and might be used.

It is just about feasible to require a child to reapply new locks
after the fork and for the parent to wait for it to do so, but
really I'd like to bury this in a library.

Is there any (preferably generic) way to tell whether a file
has no (other) open descriptors attached to it and can be unlinked?

James



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?32B7E11E.22>