mirror of
https://github.com/gperftools/gperftools
synced 2024-12-26 01:02:04 +00:00
amputate HAVE_FORK checking
Pretty much everything has fork, except windows. Which is much simpler to test at compile time, then duplicating and complicating the test at configure time.
This commit is contained in:
parent
8cc2d93055
commit
79b6ad2ab5
@ -199,7 +199,6 @@ set(CMAKE_EXTRA_INCLUDE_FILES)
|
|||||||
check_function_exists("sbrk" HAVE_SBRK) # for tcmalloc to get memory
|
check_function_exists("sbrk" HAVE_SBRK) # for tcmalloc to get memory
|
||||||
check_function_exists("__sbrk" HAVE___SBRK) # for tcmalloc to get memory
|
check_function_exists("__sbrk" HAVE___SBRK) # for tcmalloc to get memory
|
||||||
check_function_exists("geteuid" HAVE_GETEUID) # for turning off services when run as root
|
check_function_exists("geteuid" HAVE_GETEUID) # for turning off services when run as root
|
||||||
check_function_exists("fork" HAVE_FORK) # for the pthread_atfork setup
|
|
||||||
check_include_file("features.h" HAVE_FEATURES_H) # for vdso_support.h, Where __GLIBC__ is defined
|
check_include_file("features.h" HAVE_FEATURES_H) # for vdso_support.h, Where __GLIBC__ is defined
|
||||||
check_include_file("malloc.h" HAVE_MALLOC_H) # some systems define stuff there, others not
|
check_include_file("malloc.h" HAVE_MALLOC_H) # some systems define stuff there, others not
|
||||||
check_include_file("glob.h" HAVE_GLOB_H) # for heap-profile-table (cleaning up profiles)
|
check_include_file("glob.h" HAVE_GLOB_H) # for heap-profile-table (cleaning up profiles)
|
||||||
|
@ -74,9 +74,6 @@
|
|||||||
/* Define to 1 if you have the <features.h> header file. */
|
/* Define to 1 if you have the <features.h> header file. */
|
||||||
#cmakedefine HAVE_FEATURES_H
|
#cmakedefine HAVE_FEATURES_H
|
||||||
|
|
||||||
/* Define to 1 if you have the `fork' function. */
|
|
||||||
#cmakedefine HAVE_FORK
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `geteuid' function. */
|
/* Define to 1 if you have the `geteuid' function. */
|
||||||
#cmakedefine HAVE_GETEUID
|
#cmakedefine HAVE_GETEUID
|
||||||
|
|
||||||
|
@ -46,26 +46,6 @@
|
|||||||
|
|
||||||
namespace tcmalloc {
|
namespace tcmalloc {
|
||||||
|
|
||||||
#if defined(HAVE_FORK) && defined(HAVE_PTHREAD)
|
|
||||||
// These following two functions are registered via pthread_atfork to make
|
|
||||||
// sure the central_cache locks remain in a consisten state in the forked
|
|
||||||
// version of the thread.
|
|
||||||
|
|
||||||
void CentralCacheLockAll() NO_THREAD_SAFETY_ANALYSIS
|
|
||||||
{
|
|
||||||
Static::pageheap_lock()->Lock();
|
|
||||||
for (int i = 0; i < Static::num_size_classes(); ++i)
|
|
||||||
Static::central_cache()[i].Lock();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CentralCacheUnlockAll() NO_THREAD_SAFETY_ANALYSIS
|
|
||||||
{
|
|
||||||
for (int i = 0; i < Static::num_size_classes(); ++i)
|
|
||||||
Static::central_cache()[i].Unlock();
|
|
||||||
Static::pageheap_lock()->Unlock();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool Static::inited_;
|
bool Static::inited_;
|
||||||
SizeMap Static::sizemap_;
|
SizeMap Static::sizemap_;
|
||||||
CentralFreeListPadded Static::central_cache_[kClassSizesMax];
|
CentralFreeListPadded Static::central_cache_[kClassSizesMax];
|
||||||
@ -108,9 +88,27 @@ void Static::InitStaticVars() {
|
|||||||
DLL_Init(&sampled_objects_);
|
DLL_Init(&sampled_objects_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These following two functions are registered via pthread_atfork to
|
||||||
|
// make sure the central_cache locks remain in a consisten state in
|
||||||
|
// the forked version of the thread. Also our OSX integration uses it
|
||||||
|
// for mi_force_lock.
|
||||||
|
|
||||||
|
void CentralCacheLockAll() NO_THREAD_SAFETY_ANALYSIS
|
||||||
|
{
|
||||||
|
Static::pageheap_lock()->Lock();
|
||||||
|
for (int i = 0; i < Static::num_size_classes(); ++i)
|
||||||
|
Static::central_cache()[i].Lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CentralCacheUnlockAll() NO_THREAD_SAFETY_ANALYSIS
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Static::num_size_classes(); ++i)
|
||||||
|
Static::central_cache()[i].Unlock();
|
||||||
|
Static::pageheap_lock()->Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
void Static::InitLateMaybeRecursive() {
|
void Static::InitLateMaybeRecursive() {
|
||||||
#if defined(HAVE_FORK) && defined(HAVE_PTHREAD) \
|
#if !defined(__APPLE__) && !defined(_WIN32) && !defined(TCMALLOC_NO_ATFORK) \
|
||||||
&& !defined(__APPLE__) && !defined(TCMALLOC_NO_ATFORK) \
|
|
||||||
&& !defined(PTHREADS_CRASHES_IF_RUN_TOO_EARLY)
|
&& !defined(PTHREADS_CRASHES_IF_RUN_TOO_EARLY)
|
||||||
// OSX has it's own way of handling atfork in malloc (see
|
// OSX has it's own way of handling atfork in malloc (see
|
||||||
// libc_override_osx.h).
|
// libc_override_osx.h).
|
||||||
|
@ -93,9 +93,6 @@
|
|||||||
/* Define to 1 if you have the <features.h> header file. */
|
/* Define to 1 if you have the <features.h> header file. */
|
||||||
/* #undef HAVE_FEATURES_H */
|
/* #undef HAVE_FEATURES_H */
|
||||||
|
|
||||||
/* Define to 1 if you have the `fork' function. */
|
|
||||||
/* #undef HAVE_FORK */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `geteuid' function. */
|
/* Define to 1 if you have the `geteuid' function. */
|
||||||
/* #undef HAVE_GETEUID */
|
/* #undef HAVE_GETEUID */
|
||||||
|
|
||||||
|
@ -54,8 +54,6 @@
|
|||||||
# define _WIN32_WINNT 0x0501
|
# define _WIN32_WINNT 0x0501
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef HAVE_FORK
|
|
||||||
|
|
||||||
#include "windows/port.h"
|
#include "windows/port.h"
|
||||||
|
|
||||||
#endif /* __MINGW32__ */
|
#endif /* __MINGW32__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user