fdlopen(3)

Kostik Belousov kostikbel at gmail.com
Fri Dec 30 14:28:04 UTC 2011


On Fri, Dec 30, 2011 at 02:12:29PM +0100, Dag-Erling Sm??rgrav wrote:
> Xin LI <delphij at gmail.com> writes:
> > Kostik Belousov <kostikbel at gmail.com> writes:
> > > Xin LI <delphij at gmail.com> writes:
> > > > Will this prevent e.g. writes to the .so file after open, but
> > > > before fdlopen()?
> > > How can it ? Even in theory ?
> > e.g. process 1 open(), check for permissions, etc., then process 2
> > open() for write, write something, then process proceed with
> > fdlopen()?  (We do not have mandatory "lock" on file handles to
> > prevent writing I think?).
> 
> I think Kostik meant "how could you, even in theory, prevent this from
> happening", and the answer is that you can't.

Sorry if it was not clear enough. BSD is not SysV, we do not have
mandatory locking. Some people consider it a feature.

In principle, fdlopen() can take additional argument struct timespec mtim,
that would be compared with st_mtim from fstat(2) right before calling
constructors from the dso. The passed mtim shall be taken from fstat(2)
before the application code starts its checks.
But this is completely ridiculous and pointless.

Presented use case for fdlopen(3) is valid and useful IMO.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20111230/6455de75/attachment.pgp


More information about the freebsd-arch mailing list