Skip to content

Commit e1bd1fb

Browse files
committed
Detect whether pthread_t is a pointer or not.
1 parent 5d65ee4 commit e1bd1fb

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

configure.ac

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ AC_TYPE_UINT32_T
7474
AC_TYPE_UINT64_T
7575
AC_TYPE_UINT8_T
7676

77+
AC_MSG_CHECKING([whether pthread_t is a pointer])
78+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
79+
#include <pthread.h>
80+
void TakesPointer(void*);
81+
], [TakesPointer(pthread_self())])], [PTHREAD_T_IS_POINTER=yes],
82+
[PTHREAD_T_IS_POINTER=no])
83+
AC_MSG_RESULT([$PTHREAD_T_IS_POINTER])
84+
AS_IF([test "x$PTHREAD_T_IS_POINTER" = xyes],
85+
[AC_DEFINE([PTHREAD_T_IS_POINTER], [],
86+
[Whether pthread_t is a pointer.])])
87+
7788
# Checks for library functions.
7889
AC_FUNC_FORK
7990
AC_CHECK_FUNCS([alarm gettimeofday memset mkdir select socket strdup strerror strtol])

cpp/server/ct-server.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include <string>
1717
#include <unistd.h>
1818

19+
20+
#include "config.h"
1921
#include "log/cert_checker.h"
2022
#include "log/cert_submission_handler.h"
2123
#include "log/cluster_state_controller.h"
@@ -30,9 +32,9 @@
3032
#include "log/sqlite_db.h"
3133
#include "log/strict_consistent_store.h"
3234
#include "log/tree_signer.h"
35+
#include "monitoring/latency.h"
3336
#include "monitoring/monitoring.h"
3437
#include "monitoring/registry.h"
35-
#include "monitoring/latency.h"
3638
#include "server/handler.h"
3739
#include "server/json_output.h"
3840
#include "server/metrics.h"
@@ -383,9 +385,7 @@ void locking_function(int mode, int n, const char* file, int line) {
383385

384386

385387
void threadid_function(CRYPTO_THREADID* id) {
386-
// FIXME(benl): platform differences should all live together somewhere,
387-
// and ideally done by feature detection.
388-
#ifdef __FreeBSD__
388+
#ifdef PTHREAD_T_IS_POINTER
389389
CRYPTO_THREADID_set_pointer(id, pthread_self());
390390
#else
391391
CRYPTO_THREADID_set_numeric(id, pthread_self());

0 commit comments

Comments
 (0)