]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fsmonitor: rename fsm-ipc-darwin.c to fsm-ipc-unix.c
authorPaul Tarjan <github@paulisageek.com>
Thu, 9 Apr 2026 04:59:28 +0000 (04:59 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 9 Apr 2026 17:59:28 +0000 (10:59 -0700)
The fsmonitor IPC path logic in fsm-ipc-darwin.c is not
Darwin-specific and will be reused by the upcoming Linux
implementation.  Rename it to fsm-ipc-unix.c to reflect that it
is shared by all Unix platforms.

Introduce FSMONITOR_OS_SETTINGS (set to "unix" for non-Windows, "win32"
for Windows) as a separate variable from FSMONITOR_DAEMON_BACKEND so
that the build files can distinguish between platform-specific files
(listen, health, path-utils) and shared Unix files (ipc, settings).

Move fsm-ipc to the FSMONITOR_OS_SETTINGS section in the Makefile, and
switch fsm-path-utils to use FSMONITOR_DAEMON_BACKEND since path-utils
is platform-specific (there will be separate darwin and linux versions).

Based-on-patch-by: Eric DeCosta <edecosta@mathworks.com>
Based-on-patch-by: Marziyeh Esipreh <marziyeh.esipreh@gmail.com>
Signed-off-by: Paul Tarjan <github@paulisageek.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
compat/fsmonitor/fsm-ipc-unix.c [moved from compat/fsmonitor/fsm-ipc-darwin.c with 100% similarity]
config.mak.uname
contrib/buildsystems/CMakeLists.txt
meson.build

index 89d8d73ec0a21be02ae8d23122598c7497fde085..c04e747af8d463b109c10d51eef5c64e19fd1c4e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -408,7 +408,7 @@ include shared.mak
 # If your platform has OS-specific ways to tell if a repo is incompatible with
 # fsmonitor (whether the hook or IPC daemon version), set FSMONITOR_OS_SETTINGS
 # to the "<name>" of the corresponding `compat/fsmonitor/fsm-settings-<name>.c`
-# that implements the `fsm_os_settings__*()` routines.
+# and `compat/fsmonitor/fsm-ipc-<name>.c` files.
 #
 # Define LINK_FUZZ_PROGRAMS if you want `make all` to also build the fuzz test
 # programs in oss-fuzz/.
@@ -2323,13 +2323,13 @@ ifdef FSMONITOR_DAEMON_BACKEND
        COMPAT_CFLAGS += -DHAVE_FSMONITOR_DAEMON_BACKEND
        COMPAT_OBJS += compat/fsmonitor/fsm-listen-$(FSMONITOR_DAEMON_BACKEND).o
        COMPAT_OBJS += compat/fsmonitor/fsm-health-$(FSMONITOR_DAEMON_BACKEND).o
-       COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_DAEMON_BACKEND).o
 endif
 
 ifdef FSMONITOR_OS_SETTINGS
        COMPAT_CFLAGS += -DHAVE_FSMONITOR_OS_SETTINGS
+       COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_OS_SETTINGS).o
        COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_OS_SETTINGS).o
-       COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
+       COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_DAEMON_BACKEND).o
 endif
 
 ifdef WITH_BREAKING_CHANGES
index 1691c6ae6e01e355123e82be072b515429109dd3..00bcb84cee15c304326aea92c6df323da3f91d67 100644 (file)
@@ -178,7 +178,7 @@ ifeq ($(uname_S),Darwin)
         ifndef NO_PTHREADS
         ifndef NO_UNIX_SOCKETS
        FSMONITOR_DAEMON_BACKEND = darwin
-       FSMONITOR_OS_SETTINGS = darwin
+       FSMONITOR_OS_SETTINGS = unix
         endif
         endif
 
index 28877feb9d17074736cffad5f9e82d32f3a256c1..6197d5729cbfe4a22488b096c0710f9060603bbd 100644 (file)
@@ -291,23 +291,22 @@ endif()
 
 if(SUPPORTS_SIMPLE_IPC)
        if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
-               add_compile_definitions(HAVE_FSMONITOR_DAEMON_BACKEND)
-               list(APPEND compat_SOURCES compat/fsmonitor/fsm-listen-win32.c)
-               list(APPEND compat_SOURCES compat/fsmonitor/fsm-health-win32.c)
-               list(APPEND compat_SOURCES compat/fsmonitor/fsm-ipc-win32.c)
-               list(APPEND compat_SOURCES compat/fsmonitor/fsm-path-utils-win32.c)
-
-               add_compile_definitions(HAVE_FSMONITOR_OS_SETTINGS)
-               list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-win32.c)
+               set(FSMONITOR_DAEMON_BACKEND "win32")
+               set(FSMONITOR_OS_SETTINGS "win32")
        elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+               set(FSMONITOR_DAEMON_BACKEND "darwin")
+               set(FSMONITOR_OS_SETTINGS "unix")
+       endif()
+
+       if(FSMONITOR_DAEMON_BACKEND)
                add_compile_definitions(HAVE_FSMONITOR_DAEMON_BACKEND)
-               list(APPEND compat_SOURCES compat/fsmonitor/fsm-listen-darwin.c)
-               list(APPEND compat_SOURCES compat/fsmonitor/fsm-health-darwin.c)
-               list(APPEND compat_SOURCES compat/fsmonitor/fsm-ipc-darwin.c)
-               list(APPEND compat_SOURCES compat/fsmonitor/fsm-path-utils-darwin.c)
+               list(APPEND compat_SOURCES compat/fsmonitor/fsm-listen-${FSMONITOR_DAEMON_BACKEND}.c)
+               list(APPEND compat_SOURCES compat/fsmonitor/fsm-health-${FSMONITOR_DAEMON_BACKEND}.c)
+               list(APPEND compat_SOURCES compat/fsmonitor/fsm-ipc-${FSMONITOR_OS_SETTINGS}.c)
+               list(APPEND compat_SOURCES compat/fsmonitor/fsm-path-utils-${FSMONITOR_DAEMON_BACKEND}.c)
 
                add_compile_definitions(HAVE_FSMONITOR_OS_SETTINGS)
-               list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-darwin.c)
+               list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-${FSMONITOR_DAEMON_BACKEND}.c)
        endif()
 endif()
 
index dd52efd1c875746304c717d8fc4a572d1f26a0cc..86a68365a99099e92b35d1a6b04382733c57f9b0 100644 (file)
@@ -1320,10 +1320,13 @@ else
 endif
 
 fsmonitor_backend = ''
+fsmonitor_os = ''
 if host_machine.system() == 'windows'
   fsmonitor_backend = 'win32'
+  fsmonitor_os = 'win32'
 elif host_machine.system() == 'darwin'
   fsmonitor_backend = 'darwin'
+  fsmonitor_os = 'unix'
   libgit_dependencies += dependency('CoreServices')
 endif
 if fsmonitor_backend != ''
@@ -1332,14 +1335,14 @@ if fsmonitor_backend != ''
 
   libgit_sources += [
     'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
-    'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+    'compat/fsmonitor/fsm-ipc-' + fsmonitor_os + '.c',
     'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
     'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
     'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
   ]
 endif
 build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
-build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_os)
 
 if not get_option('b_sanitize').contains('address') and get_option('regex').allowed() and compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
   build_options_config.set('NO_REGEX', '')