mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Add "harmful" library
This commit is contained in:
parent
948ac657dc
commit
91e80598cd
@ -258,11 +258,3 @@ double lgamma_r(double x, int *signgamp)
|
||||
r = nadj - r;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
int signgam;
|
||||
|
||||
double lgamma(double x)
|
||||
{
|
||||
return lgamma_r(x, &signgam);
|
||||
}
|
||||
|
@ -328,12 +328,3 @@ long double lgammal_r(long double x, int *sg)
|
||||
return lgamma_r(x, sg);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int signgam_lgammal;
|
||||
|
||||
long double lgammal(long double x)
|
||||
{
|
||||
return lgammal_r(x, &signgam_lgammal);
|
||||
}
|
||||
|
||||
|
3
base/harmful/CMakeLists.txt
Normal file
3
base/harmful/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
add_library(harmful harmful.c)
|
||||
target_link_libraries(global-libs INTERFACE harmful)
|
||||
install(TARGETS harmful EXPORT global ARCHIVE DESTINATION lib)
|
1
base/harmful/README.md
Normal file
1
base/harmful/README.md
Normal file
@ -0,0 +1 @@
|
||||
A library that traps whenever harmful functions from libc are called.
|
89
base/harmful/harmful.c
Normal file
89
base/harmful/harmful.c
Normal file
@ -0,0 +1,89 @@
|
||||
#pragma GCC diagnostic ignored "-Wincompatible-library-redeclaration"
|
||||
|
||||
#define TRAP(func) void func() { __builtin_trap(); }
|
||||
|
||||
/// Trap all non thread-safe functions:
|
||||
/// nm -D /lib/x86_64-linux-gnu/{libc.so.6,libdl.so.2,libm.so.6,libpthread.so.0,librt.so.1,libnss_dns.so.2,libresolv.so.2} | grep -P '_r@?$' | awk '{ print $3 }' | sed -r -e 's/_r//' | grep -vP '^_'
|
||||
|
||||
TRAP(asctime)
|
||||
TRAP(ctime)
|
||||
TRAP(drand48)
|
||||
TRAP(ecvt)
|
||||
TRAP(erand48)
|
||||
TRAP(ether_aton)
|
||||
TRAP(ether_ntoa)
|
||||
TRAP(fcvt)
|
||||
TRAP(fgetgrent)
|
||||
TRAP(fgetpwent)
|
||||
TRAP(fgetsgent)
|
||||
TRAP(fgetspent)
|
||||
TRAP(getaliasbyname)
|
||||
TRAP(getaliasent)
|
||||
TRAP(getdate)
|
||||
TRAP(getgrent)
|
||||
TRAP(getgrgid)
|
||||
TRAP(getgrnam)
|
||||
TRAP(gethostbyaddr)
|
||||
TRAP(gethostbyname2)
|
||||
TRAP(gethostbyname)
|
||||
TRAP(gethostent)
|
||||
TRAP(getlogin)
|
||||
TRAP(getmntent)
|
||||
TRAP(getnetbyaddr)
|
||||
TRAP(getnetbyname)
|
||||
TRAP(getnetent)
|
||||
TRAP(getnetgrent)
|
||||
TRAP(getprotobyname)
|
||||
TRAP(getprotobynumber)
|
||||
TRAP(getprotoent)
|
||||
TRAP(getpwent)
|
||||
TRAP(getpwnam)
|
||||
TRAP(getpwuid)
|
||||
TRAP(getrpcbyname)
|
||||
TRAP(getrpcbynumber)
|
||||
TRAP(getrpcent)
|
||||
TRAP(getservbyname)
|
||||
TRAP(getservbyport)
|
||||
TRAP(getservent)
|
||||
TRAP(getsgent)
|
||||
TRAP(getsgnam)
|
||||
TRAP(getspent)
|
||||
TRAP(getspnam)
|
||||
TRAP(getutent)
|
||||
TRAP(getutid)
|
||||
TRAP(getutline)
|
||||
TRAP(gmtime)
|
||||
TRAP(hcreate)
|
||||
TRAP(hdestroy)
|
||||
TRAP(hsearch)
|
||||
TRAP(initstate)
|
||||
TRAP(jrand48)
|
||||
TRAP(lcong48)
|
||||
TRAP(localtime)
|
||||
TRAP(lrand48)
|
||||
TRAP(mrand48)
|
||||
TRAP(nrand48)
|
||||
TRAP(ptsname)
|
||||
TRAP(qecvt)
|
||||
TRAP(qfcvt)
|
||||
TRAP(random)
|
||||
TRAP(rand)
|
||||
TRAP(seed48)
|
||||
TRAP(setstate)
|
||||
TRAP(sgetsgent)
|
||||
TRAP(sgetspent)
|
||||
TRAP(srand48)
|
||||
TRAP(srandom)
|
||||
TRAP(strerror)
|
||||
TRAP(strtok)
|
||||
TRAP(tmpnam)
|
||||
TRAP(ttyname)
|
||||
TRAP(twalk)
|
||||
TRAP(lgammaf128)
|
||||
TRAP(lgammaf32)
|
||||
TRAP(lgammaf32x)
|
||||
TRAP(lgammaf64)
|
||||
TRAP(lgammaf64x)
|
||||
TRAP(lgammaf)
|
||||
TRAP(lgammal)
|
||||
TRAP(lgamma)
|
@ -43,6 +43,7 @@ find_package(Threads REQUIRED)
|
||||
if (NOT OS_ANDROID)
|
||||
# Our compatibility layer doesn't build under Android, many errors in musl.
|
||||
add_subdirectory(base/glibc-compatibility)
|
||||
add_subdirectory(base/harmful)
|
||||
endif ()
|
||||
|
||||
include (cmake/find/unwind.cmake)
|
||||
|
Loading…
Reference in New Issue
Block a user