0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 23:14:13 +01:00

ircd::ctx::posix: Improve pthread version resolution for dlopen.

This commit is contained in:
Jason Volk 2021-12-22 11:12:00 -08:00
parent 65322352b0
commit 5a6cd51530

View file

@ -75,6 +75,14 @@ ircd::ctx::posix::ctxs;
// pthread supplement
//
static const char *const
ircd_pthread_paths[]
{
"libpthread.so.0",
"libpthread.so",
nullptr
};
IRCD_WRAP(pthread_create, "__wrap_pthread_create",
(
pthread_t *const thread,
@ -97,10 +105,11 @@ IRCD_WRAP(pthread_create, "__wrap_pthread_create",
mutex
};
if(!ircd::ctx::posix::real_pthread)
auto p(ircd_pthread_paths[0]);
while(p && !ircd::ctx::posix::real_pthread)
ircd::ctx::posix::real_pthread = //.reset
(
dlopen("libpthread.so", RTLD_LOCAL | RTLD_LAZY)
dlopen(p++, RTLD_LOCAL | RTLD_LAZY)
);
}