You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add comprehensive FreeBSD support to brpc, building on the existing
partial FreeBSD code already present in the codebase.
CMakeLists.txt:
- Add NO_PTHREAD_MUTEX_HOOK on FreeBSD to prevent static init deadlock
caused by bthread's pthread_mutex_lock interposition conflicting with
libc++ ios_base::Init during early process initialization
- Add -lexecinfo for backtrace support
- Add FreeBSD-specific source files (platform_thread_freebsd.cc,
sys_string_conversions_posix.cc)
Source changes (all guarded by OS_FREEBSD, no impact on Linux/macOS):
- butil/compat.h: Add FreeBSD kqueue path and pthread_getthreadid_np()
- butil/process_util.cc: FreeBSD ReadCommandLine via ps (like macOS)
- butil/fd_utility.cpp: kqueue fd handling
- butil/logging.cc: Rename FLAGS_v/vmodule/minloglevel to avoid gflags
duplicate registration with system glog on FreeBSD
- brpc/socket.cpp: FreeBSD TCP_INFO support
- bthread/: FreeBSD futex emulation, context switching, fd handling
- bvar/default_variables.cpp: FreeBSD /proc fallback
Most changes piggyback on existing macOS/Darwin code paths since both
use kqueue. The NO_PTHREAD_MUTEX_HOOK fix is critical — without it,
any FreeBSD application linking brpc will deadlock during startup.
0 commit comments