Skip to content

Add missing <sys/types.h> include for pid_t in port_posix.h - #39

Open
groeneai wants to merge 1 commit into
ClickHouse:ClickHouse/v11.8.1from
groeneai:fix-pid-t-include-v11.8.1
Open

groeneai wants to merge 1 commit into
ClickHouse:ClickHouse/v11.8.1from
groeneai:fix-pid-t-include-v11.8.1

Conversation

@groeneai

@groeneai groeneai commented Dec 5, 2026 •

Copy link
Copy Markdown

port/port_posix.h declares using ThreadId = pid_t; on every POSIX platform, but includes <sys/types.h> only in its AIX and BSD/Android branches. On macOS, pid_t came only through the std::format machinery that libc++'s <thread> includes in C++23 mode. ClickHouse's libc++ drops that include with _LIBCPP_NO_TRANSITIVE_FORMAT_INCLUDE (ClickHouse/llvm-project#165), and then 18 files fail on both macOS builds:

port/port_posix.h:247:18: error: unknown type name 'pid_t'

Fix: include <sys/types.h> unconditionally, next to the other C headers.

Validation (-fsyntax-only with ClickHouse's flags): with this change the 18 files pass for arm64 and x86_64 macOS with and without that macro, and every RocksDB file passes with it for s390x, ppc64le, riscv64 and loongarch64 Linux and for FreeBSD; a full x86_64 Linux build compiles. Upstream meta/rocksdb main has the same gap.

ClickHouse PR: ClickHouse/ClickHouse#137988

port_posix.h declares `using ThreadId = pid_t;` on every POSIX
platform, but includes <sys/types.h> only in its AIX and BSD/Android
branches. On macOS pid_t was declared only transitively, through the
std::format machinery that libc++'s <thread> includes in C++23 mode.
With _LIBCPP_NO_TRANSITIVE_FORMAT_INCLUDE that include is gone and
18 files fail to compile with "unknown type name 'pid_t'".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant