diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt --- a/libc/src/__support/CMakeLists.txt +++ b/libc/src/__support/CMakeLists.txt @@ -85,15 +85,6 @@ libc.src.errno.errno ) -add_object_library( - fork_callbacks - SRCS - fork_callbacks.cpp - HDRS - fork_callbacks.h - DEPENDS - .threads.mutex -) add_header_library( integer_operations diff --git a/libc/src/__support/threads/CMakeLists.txt b/libc/src/__support/threads/CMakeLists.txt --- a/libc/src/__support/threads/CMakeLists.txt +++ b/libc/src/__support/threads/CMakeLists.txt @@ -16,6 +16,16 @@ DEPENDS .${LIBC_TARGET_OS}.mutex ) + + add_object_library( + fork_callbacks + SRCS + fork_callbacks.cpp + HDRS + fork_callbacks.h + DEPENDS + .mutex + ) endif() add_header_library( diff --git a/libc/src/__support/fork_callbacks.h b/libc/src/__support/threads/fork_callbacks.h rename from libc/src/__support/fork_callbacks.h rename to libc/src/__support/threads/fork_callbacks.h --- a/libc/src/__support/fork_callbacks.h +++ b/libc/src/__support/threads/fork_callbacks.h @@ -6,6 +6,9 @@ // //===----------------------------------------------------------------------===// +#ifndef LLVM_LIBC_SRC_SUPPORT_THREAD_FORK_CALLBACKS_H +#define LLVM_LIBC_SRC_SUPPORT_THREAD_FORK_CALLBACKS_H + namespace __llvm_libc { using ForkCallback = void(void); @@ -17,3 +20,5 @@ void invoke_child_callbacks(); } // namespace __llvm_libc + +#endif // LLVM_LIBC_SRC_SUPPORT_THREAD_FORK_CALLBACKS_H diff --git a/libc/src/__support/fork_callbacks.cpp b/libc/src/__support/threads/fork_callbacks.cpp rename from libc/src/__support/fork_callbacks.cpp rename to libc/src/__support/threads/fork_callbacks.cpp diff --git a/libc/src/pthread/CMakeLists.txt b/libc/src/pthread/CMakeLists.txt --- a/libc/src/pthread/CMakeLists.txt +++ b/libc/src/pthread/CMakeLists.txt @@ -407,5 +407,5 @@ DEPENDS libc.include.errno libc.include.pthread - libc.src.__support.fork_callbacks + libc.src.__support.threads.fork_callbacks ) diff --git a/libc/src/pthread/pthread_atfork.cpp b/libc/src/pthread/pthread_atfork.cpp --- a/libc/src/pthread/pthread_atfork.cpp +++ b/libc/src/pthread/pthread_atfork.cpp @@ -9,7 +9,7 @@ #include "pthread_atfork.h" #include "src/__support/common.h" -#include "src/__support/fork_callbacks.h" +#include "src/__support/threads/fork_callbacks.h" #include #include // For pthread_* type definitions. diff --git a/libc/src/unistd/linux/CMakeLists.txt b/libc/src/unistd/linux/CMakeLists.txt --- a/libc/src/unistd/linux/CMakeLists.txt +++ b/libc/src/unistd/linux/CMakeLists.txt @@ -100,7 +100,7 @@ libc.include.errno libc.include.unistd libc.include.sys_syscall - libc.src.__support.fork_callbacks + libc.src.__support.threads.fork_callbacks libc.src.__support.OSUtil.osutil libc.src.__support.threads.thread libc.src.errno.errno diff --git a/libc/src/unistd/linux/fork.cpp b/libc/src/unistd/linux/fork.cpp --- a/libc/src/unistd/linux/fork.cpp +++ b/libc/src/unistd/linux/fork.cpp @@ -10,7 +10,7 @@ #include "src/__support/OSUtil/syscall.h" // For internal syscall function. #include "src/__support/common.h" -#include "src/__support/fork_callbacks.h" +#include "src/__support/threads/fork_callbacks.h" #include "src/__support/threads/thread.h" // For thread self object #include