Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Dec 1996 20:57:23 -0500 (EST)
From:      "John S. Dyson" <toor@dyson.iquest.net>
To:        james@wgold.demon.co.uk (James Mansion)
Cc:        hackers@FreeBSD.ORG
Subject:   Re: mmap pain
Message-ID:  <199612190157.UAA03663@dyson.iquest.net>
In-Reply-To: <32B7E11E.22@wgold.demon.co.uk> from "James Mansion" at Dec 18, 96 12:18:38 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> 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?
> 
Anytime a program has a file mapped, it is kind-of equiv to the
file being open.  If you unlink a file that is mapped or open, you
will immediately remove the directory entry, but the file will remain
until the last process closes or unmaps the file.  You unmap or close
a file either by an explicit action or by the program exiting.  It is
also possible that a new reference can be gained by a process forking
even after a file directory entry has been unlinked.

John



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