mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
clickhouse-client: proper support of vfork() w/o dlsym() in musl
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
aaa36e2b25
commit
d0f14e1255
@ -66,7 +66,17 @@ std::string getFuzzyFinder()
|
||||
/// (for the vfork via dlsym())
|
||||
int executeCommand(char * const argv[])
|
||||
{
|
||||
#if !defined(USE_MUSL)
|
||||
/** Here it is written that with a normal call `vfork`, there is a chance of deadlock in multithreaded programs,
|
||||
* because of the resolving of symbols in the shared library
|
||||
* http://www.oracle.com/technetwork/server-storage/solaris10/subprocess-136439.html
|
||||
* Therefore, separate the resolving of the symbol from the call.
|
||||
*/
|
||||
static void * real_vfork = dlsym(RTLD_DEFAULT, "vfork");
|
||||
#else
|
||||
/// If we use Musl with static linking, there is no dlsym and no issue with vfork.
|
||||
static void * real_vfork = reinterpret_cast<void *>(&vfork);
|
||||
#endif
|
||||
if (!real_vfork)
|
||||
throw std::runtime_error("Cannot find vfork symbol");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user