[PATCH 1/1] Look for ModuleData only in appropriate library

Adam Jackson ajax at redhat.com
Wed Jun 27 09:52:38 PDT 2012

On Wed, 2012-06-27 at 18:04 +0200, Michal Srb wrote:
> Calling dlsym with handle of the module library
> instead of RTLD_DEFAULT prevents increasing reference
> counter of the library and so allows it to be
> really unloaded if UnloadModule is called on it
> later.

That's not how I would have expected libdl to behave.  I wouldn't have
thought dlsym success would increase the refcount of the providing
object, given that there's no way in the API to release that reference;
if dlsym _does_ bump the refcount I'd have thought the resolution scope
would not be a factor.

I'd be interested to know when and why this behaviour was added.  A
quick read of freebsd's dlsym doesn't appear to have that behaviour to
me, but then neither does a quick read of glibc's dlsym.

But I'm always a fan of turning O(n) into O(1).

Reviewed-by: Adam Jackson <ajax at redhat.com>

- ajax
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20120627/25e46603/attachment.pgp>

More information about the xorg-devel mailing list