diff mbox series

[v2,07/12] fsmonitor: prepare to share code between Mac OS and Linux

Message ID 295beb89ab10f001724fb64fa55944d05ee29fc7.1665783945.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series fsmonitor: Implement fsmonitor for Linux | expand

Commit Message

Eric DeCosta Oct. 14, 2022, 9:45 p.m. UTC
From: Eric DeCosta <edecosta@mathworks.com>

Linux and Mac OS can share some of the code originally developed for Mac OS.

Minor update to compat/fsmonitor/fsm-ipc-unix.c to make it cross-platform.
Mac OS and Linux can share fsm-ipc-unix.c

Both platforms can also share compat/fsmonitor/fsm-settings-unix.c but we
will leave room for future, platform-specific checks by having the platform-
specific implementations call into fsm-settings-unix.

Signed-off-by: Eric DeCosta <edecosta@mathworks.com>
---
 Makefile                                      |  9 ++-
 compat/fsmonitor/fsm-health-linux.c           | 24 +++++++
 .../{fsm-ipc-darwin.c => fsm-ipc-unix.c}      |  8 +--
 compat/fsmonitor/fsm-settings-darwin.c        | 57 +----------------
 compat/fsmonitor/fsm-settings-linux.c         | 11 ++++
 compat/fsmonitor/fsm-settings-unix.c          | 62 +++++++++++++++++++
 compat/fsmonitor/fsm-settings-unix.h          | 11 ++++
 config.mak.uname                              |  1 +
 contrib/buildsystems/CMakeLists.txt           | 17 ++++-
 9 files changed, 138 insertions(+), 62 deletions(-)
 create mode 100644 compat/fsmonitor/fsm-health-linux.c
 rename compat/fsmonitor/{fsm-ipc-darwin.c => fsm-ipc-unix.c} (89%)
 create mode 100644 compat/fsmonitor/fsm-settings-linux.c
 create mode 100644 compat/fsmonitor/fsm-settings-unix.c
 create mode 100644 compat/fsmonitor/fsm-settings-unix.h

Comments

Junio C Hamano Oct. 14, 2022, 11:46 p.m. UTC | #1
"Eric DeCosta via GitGitGadget" <gitgitgadget@gmail.com> writes:

>  ifdef FSMONITOR_DAEMON_BACKEND
>  	COMPAT_CFLAGS += -DHAVE_FSMONITOR_DAEMON_BACKEND
> +	ifdef FSMONITOR_DAEMON_COMMON
> +		COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_DAEMON_COMMON).o
> +	else
> +		COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_DAEMON_BACKEND).o
> +	endif
>  	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
> +	ifdef FSMONITOR_DAEMON_COMMON
> +		COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_DAEMON_COMMON).o
> +	endif
>  	COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_OS_SETTINGS).o
>  	COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
>  endif

Ugly.  

One overrides backend with common, while the other one doesn't.
That asymmetry alone should stop us and wonder if there is something
fishy in the approach that can be improved.  It makes it look like
the word "common" means something quite different between the -ipc
and the -settings world.

I suspect that in both, you should not expose "unix" to this part of
the Makefile.  Linux and macOS occasionally being similar in some
places does not have to be exposed here.  INstead you can use
backend "linux" and "macos", whose C sources may include from a
separate C source file whose name may contain "unix".  That would
allow you to get rid of FSMONITOR_DAEMON_COMMON in a cleaner way.
Eric DeCosta Oct. 17, 2022, 9:30 p.m. UTC | #2
> -----Original Message-----
> From: Junio C Hamano <gitster@pobox.com>
> Sent: Friday, October 14, 2022 7:46 PM
> To: Eric DeCosta via GitGitGadget <gitgitgadget@gmail.com>
> Cc: git@vger.kernel.org; Eric Sunshine <sunshine@sunshineco.com>; Ævar
> Arnfjörð Bjarmason <avarab@gmail.com>; Eric DeCosta
> <edecosta@mathworks.com>
> Subject: Re: [PATCH v2 07/12] fsmonitor: prepare to share code between
> Mac OS and Linux
> 
> "Eric DeCosta via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
> >  ifdef FSMONITOR_DAEMON_BACKEND
> >  	COMPAT_CFLAGS += -DHAVE_FSMONITOR_DAEMON_BACKEND
> > +	ifdef FSMONITOR_DAEMON_COMMON
> > +		COMPAT_OBJS += compat/fsmonitor/fsm-ipc-
> $(FSMONITOR_DAEMON_COMMON).o
> > +	else
> > +		COMPAT_OBJS += compat/fsmonitor/fsm-ipc-
> $(FSMONITOR_DAEMON_BACKEND).o
> > +	endif
> >  	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
> > +	ifdef FSMONITOR_DAEMON_COMMON
> > +		COMPAT_OBJS += compat/fsmonitor/fsm-settings-
> $(FSMONITOR_DAEMON_COMMON).o
> > +	endif
> >  	COMPAT_OBJS += compat/fsmonitor/fsm-settings-
> $(FSMONITOR_OS_SETTINGS).o
> >  	COMPAT_OBJS +=
> > compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
> >  endif
> 
> Ugly.
> 
> One overrides backend with common, while the other one doesn't.
> That asymmetry alone should stop us and wonder if there is something fishy
> in the approach that can be improved.  It makes it look like the word
> "common" means something quite different between the -ipc and the -
> settings world.
> 
> I suspect that in both, you should not expose "unix" to this part of the
> Makefile.  Linux and macOS occasionally being similar in some places does
> not have to be exposed here.  INstead you can use backend "linux" and
> "macos", whose C sources may include from a separate C source file whose
> name may contain "unix".  That would allow you to get rid of
> FSMONITOR_DAEMON_COMMON in a cleaner way.

Let me see if I am understanding you correctly. Are you suggesting something like:

ifdef FSMONITOR_DAEMON_BACKEND_LINUX
	COMPAT_CFLAGS += -DHAVE_FSMONITOR_DAEMON_BACKEND
	COMPAT_OBJS += compat/fsmonitor/fsm-ipc-unix.o
	COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_DAEMON_BACKEND_LINUX).o
	COMPAT_OBJS += compat/fsmonitor/fsm-listen-$(FSMONITOR_DAEMON_BACKEND_LINUX).o
	COMPAT_OBJS += compat/fsmonitor/fsm-health-$(FSMONITOR_DAEMON_BACKEND_LINUX).o
endif

ifdef FSMONITOR_DAEMON_BACKEND_DARWIN
	COMPAT_CFLAGS += -DHAVE_FSMONITOR_DAEMON_BACKEND
	COMPAT_OBJS += compat/fsmonitor/fsm-ipc-unix.o
	COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_DAEMON_BACKEND_DARWIN).o
	COMPAT_OBJS += compat/fsmonitor/fsm-listen-$(FSMONITOR_DAEMON_BACKEND_DARWIN).o
	COMPAT_OBJS += compat/fsmonitor/fsm-health-$(FSMONITOR_DAEMON_BACKEND_DARWIN).o
endif

And similarly for settings:

ifdef FSMONITOR_DAEMON_SETTINGS_LINUX
	COMPAT_CFLAGS += -DHAVE_FSMONITOR_OS_SETTINGS
	COMPAT_OBJS += compat/fsmonitor/fsm-settings-unix.o
	COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_DAEMON_SETTINGS_LINUX).o
	COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_DAEMON_SETTINGS_LINUX).o
endif

ifdef FSMONITOR_DAEMON_SETTINGS_DARWIN
	COMPAT_CFLAGS += -DHAVE_FSMONITOR_OS_SETTINGS
	COMPAT_OBJS += compat/fsmonitor/fsm-settings-unix.o
	COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_DAEMON_SETTINGS_DARWIN).o
	COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_DAEMON_SETTINGS_DARWIN).o
endif

And the rest of the platforms remain as was, with FSMONITOR_DAEMON_BACKEND and FSMONITOR_OS_SETTINGS

-Eric
Junio C Hamano Oct. 18, 2022, 6:31 a.m. UTC | #3
Eric DeCosta <edecosta@mathworks.com> writes:

>> Ugly.
>> 
>> One overrides backend with common, while the other one doesn't.
>> That asymmetry alone should stop us and wonder if there is something fishy
>> in the approach that can be improved.  It makes it look like the word
>> "common" means something quite different between the -ipc and the -
>> settings world.
>> 
>> I suspect that in both, you should not expose "unix" to this part of the
>> Makefile.  Linux and macOS occasionally being similar in some places does
>> not have to be exposed here.  INstead you can use backend "linux" and
>> "macos", whose C sources may include from a separate C source file whose
>> name may contain "unix".  That would allow you to get rid of
>> FSMONITOR_DAEMON_COMMON in a cleaner way.
>
> Let me see if I am understanding you correctly. Are you suggesting something like:

Not really.

What I had in mind was an arrangement more like

    $ for variant in linux macos; do grep include fsm-ipc-$variant.c; done
    #include "fsm-ipc-common-unix.cinclude"
    #include "fsm-ipc-common-unix.cinclude"

and COMPAT_OBJS knowning only about fsm-ipc-linux.o or
fsm-ipc-macos.o, depending on which platform you are building.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 9553d590824..bbbde00ce49 100644
--- a/Makefile
+++ b/Makefile
@@ -2036,13 +2036,20 @@  endif
 
 ifdef FSMONITOR_DAEMON_BACKEND
 	COMPAT_CFLAGS += -DHAVE_FSMONITOR_DAEMON_BACKEND
+	ifdef FSMONITOR_DAEMON_COMMON
+		COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_DAEMON_COMMON).o
+	else
+		COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_DAEMON_BACKEND).o
+	endif
 	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
+	ifdef FSMONITOR_DAEMON_COMMON
+		COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_DAEMON_COMMON).o
+	endif
 	COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_OS_SETTINGS).o
 	COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
 endif
diff --git a/compat/fsmonitor/fsm-health-linux.c b/compat/fsmonitor/fsm-health-linux.c
new file mode 100644
index 00000000000..b9f709e8548
--- /dev/null
+++ b/compat/fsmonitor/fsm-health-linux.c
@@ -0,0 +1,24 @@ 
+#include "cache.h"
+#include "config.h"
+#include "fsmonitor.h"
+#include "fsm-health.h"
+#include "fsmonitor--daemon.h"
+
+int fsm_health__ctor(struct fsmonitor_daemon_state *state)
+{
+	return 0;
+}
+
+void fsm_health__dtor(struct fsmonitor_daemon_state *state)
+{
+	return;
+}
+
+void fsm_health__loop(struct fsmonitor_daemon_state *state)
+{
+	return;
+}
+
+void fsm_health__stop_async(struct fsmonitor_daemon_state *state)
+{
+}
diff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-unix.c
similarity index 89%
rename from compat/fsmonitor/fsm-ipc-darwin.c
rename to compat/fsmonitor/fsm-ipc-unix.c
index ce843d63348..3ba3b9e17ed 100644
--- a/compat/fsmonitor/fsm-ipc-darwin.c
+++ b/compat/fsmonitor/fsm-ipc-unix.c
@@ -10,7 +10,7 @@  static GIT_PATH_FUNC(fsmonitor_ipc__get_default_path, "fsmonitor--daemon.ipc")
 const char *fsmonitor_ipc__get_path(struct repository *r)
 {
 	static const char *ipc_path = NULL;
-	SHA_CTX sha1ctx;
+	git_SHA_CTX sha1ctx;
 	char *sock_dir = NULL;
 	struct strbuf ipc_file = STRBUF_INIT;
 	unsigned char hash[SHA_DIGEST_LENGTH];
@@ -28,9 +28,9 @@  const char *fsmonitor_ipc__get_path(struct repository *r)
 		return ipc_path;
 	}
 
-	SHA1_Init(&sha1ctx);
-	SHA1_Update(&sha1ctx, r->worktree, strlen(r->worktree));
-	SHA1_Final(hash, &sha1ctx);
+	git_SHA1_Init(&sha1ctx);
+	git_SHA1_Update(&sha1ctx, r->worktree, strlen(r->worktree));
+	git_SHA1_Final(hash, &sha1ctx);
 
 	repo_config_get_string(r, "fsmonitor.socketdir", &sock_dir);
 
diff --git a/compat/fsmonitor/fsm-settings-darwin.c b/compat/fsmonitor/fsm-settings-darwin.c
index 6abbc7af3ab..2f5c6a88bf0 100644
--- a/compat/fsmonitor/fsm-settings-darwin.c
+++ b/compat/fsmonitor/fsm-settings-darwin.c
@@ -1,62 +1,11 @@ 
 #include "config.h"
 #include "fsmonitor.h"
 #include "fsmonitor-ipc.h"
-#include "fsmonitor-settings.h"
 #include "fsmonitor-path-utils.h"
-
- /*
- * For the builtin FSMonitor, we create the Unix domain socket for the
- * IPC in the .git directory.  If the working directory is remote,
- * then the socket will be created on the remote file system.  This
- * can fail if the remote file system does not support UDS file types
- * (e.g. smbfs to a Windows server) or if the remote kernel does not
- * allow a non-local process to bind() the socket.  (These problems
- * could be fixed by moving the UDS out of the .git directory and to a
- * well-known local directory on the client machine, but care should
- * be taken to ensure that $HOME is actually local and not a managed
- * file share.)
- *
- * FAT32 and NTFS working directories are problematic too.
- *
- * The builtin FSMonitor uses a Unix domain socket in the .git
- * directory for IPC.  These Windows drive formats do not support
- * Unix domain sockets, so mark them as incompatible for the daemon.
- *
- */
-static enum fsmonitor_reason check_uds_volume(struct repository *r)
-{
-	struct fs_info fs;
-	const char *ipc_path = fsmonitor_ipc__get_path(r);
-	struct strbuf path = STRBUF_INIT;
-	strbuf_add(&path, ipc_path, strlen(ipc_path));
-
-	if (fsmonitor__get_fs_info(dirname(path.buf), &fs) == -1) {
-		strbuf_release(&path);
-		return FSMONITOR_REASON_ERROR;
-	}
-
-	strbuf_release(&path);
-
-	if (fs.is_remote ||
-		!strcmp(fs.typename, "msdos") ||
-		!strcmp(fs.typename, "ntfs")) {
-		free(fs.typename);
-		return FSMONITOR_REASON_NOSOCKETS;
-	}
-
-	free(fs.typename);
-	return FSMONITOR_REASON_OK;
-}
+#include "fsmonitor-settings.h"
+#include "fsm-settings-unix.h"
 
 enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc)
 {
-	enum fsmonitor_reason reason;
-
-	if (ipc) {
-		reason = check_uds_volume(r);
-		if (reason != FSMONITOR_REASON_OK)
-			return reason;
-	}
-
-	return FSMONITOR_REASON_OK;
+    return fsm_os__incompatible_unix(r, ipc);
 }
diff --git a/compat/fsmonitor/fsm-settings-linux.c b/compat/fsmonitor/fsm-settings-linux.c
new file mode 100644
index 00000000000..2f5c6a88bf0
--- /dev/null
+++ b/compat/fsmonitor/fsm-settings-linux.c
@@ -0,0 +1,11 @@ 
+#include "config.h"
+#include "fsmonitor.h"
+#include "fsmonitor-ipc.h"
+#include "fsmonitor-path-utils.h"
+#include "fsmonitor-settings.h"
+#include "fsm-settings-unix.h"
+
+enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc)
+{
+    return fsm_os__incompatible_unix(r, ipc);
+}
diff --git a/compat/fsmonitor/fsm-settings-unix.c b/compat/fsmonitor/fsm-settings-unix.c
new file mode 100644
index 00000000000..6b43e26720e
--- /dev/null
+++ b/compat/fsmonitor/fsm-settings-unix.c
@@ -0,0 +1,62 @@ 
+#include "config.h"
+#include "fsmonitor.h"
+#include "fsmonitor-ipc.h"
+#include "fsmonitor-path-utils.h"
+#include "fsm-settings-unix.h"
+
+ /*
+ * For the builtin FSMonitor, we create the Unix domain socket for the
+ * IPC in the .git directory.  If the working directory is remote,
+ * then the socket will be created on the remote file system.  This
+ * can fail if the remote file system does not support UDS file types
+ * (e.g. smbfs to a Windows server) or if the remote kernel does not
+ * allow a non-local process to bind() the socket.  (These problems
+ * could be fixed by moving the UDS out of the .git directory and to a
+ * well-known local directory on the client machine, but care should
+ * be taken to ensure that $HOME is actually local and not a managed
+ * file share.)
+ *
+ * FAT32 and NTFS working directories are problematic too.
+ *
+ * The builtin FSMonitor uses a Unix domain socket in the .git
+ * directory for IPC.  These Windows drive formats do not support
+ * Unix domain sockets, so mark them as incompatible for the daemon.
+ *
+ */
+static enum fsmonitor_reason check_uds_volume(struct repository *r)
+{
+	struct fs_info fs;
+	const char *ipc_path = fsmonitor_ipc__get_path(r);
+	struct strbuf path = STRBUF_INIT;
+	strbuf_add(&path, ipc_path, strlen(ipc_path));
+
+	if (fsmonitor__get_fs_info(dirname(path.buf), &fs) == -1) {
+		strbuf_release(&path);
+		return FSMONITOR_REASON_ERROR;
+	}
+
+	strbuf_release(&path);
+
+	if (fs.is_remote ||
+		!strcmp(fs.typename, "msdos") ||
+		!strcmp(fs.typename, "ntfs")) {
+		free(fs.typename);
+		return FSMONITOR_REASON_NOSOCKETS;
+	}
+
+	free(fs.typename);
+	return FSMONITOR_REASON_OK;
+}
+
+enum fsmonitor_reason fsm_os__incompatible_unix(struct repository *r, int ipc)
+{
+	enum fsmonitor_reason reason;
+
+	if (ipc) {
+		reason = check_uds_volume(r);
+		if (reason != FSMONITOR_REASON_OK)
+			return reason;
+	}
+
+	return FSMONITOR_REASON_OK;
+}
diff --git a/compat/fsmonitor/fsm-settings-unix.h b/compat/fsmonitor/fsm-settings-unix.h
new file mode 100644
index 00000000000..8a62971190b
--- /dev/null
+++ b/compat/fsmonitor/fsm-settings-unix.h
@@ -0,0 +1,11 @@ 
+#ifndef FSM_SETTINGS_UNIX_H
+#define FSM_SETTINGS_UNIX_H
+
+#ifdef HAVE_FSMONITOR_OS_SETTINGS
+/*
+ * Check for compatibility on unix-like systems (e.g. Darwin and Linux)
+ */
+enum fsmonitor_reason fsm_os__incompatible_unix(struct repository *r, int ipc);
+#endif /* HAVE_FSMONITOR_OS_SETTINGS */
+
+#endif /* FSM_SETTINGS_UNIX_H */
diff --git a/config.mak.uname b/config.mak.uname
index d63629fe807..9f716cfba81 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -165,6 +165,7 @@  ifeq ($(uname_S),Darwin)
 	ifndef NO_UNIX_SOCKETS
 	FSMONITOR_DAEMON_BACKEND = darwin
 	FSMONITOR_OS_SETTINGS = darwin
+	FSMONITOR_DAEMON_COMMON = unix
 	endif
 	endif
 
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 787738e6fa3..4c6e84da346 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -304,7 +304,17 @@  else()
 endif()
 
 if(SUPPORTS_SIMPLE_IPC)
-	if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+	if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+		add_compile_definitions(HAVE_FSMONITOR_DAEMON_BACKEND)
+		list(APPEND compat_SOURCES compat/fsmonitor/fsm-ipc-unix.c)
+		list(APPEND compat_SOURCES compat/fsmonitor/fsm-health-linux.c)
+		list(APPEND compat_SOURCES compat/fsmonitor/fsm-listen-linux.c)
+		list(APPEND compat_SOURCES compat/fsmonitor/fsm-path-utils-linux.c)
+
+		add_compile_definitions(HAVE_FSMONITOR_OS_SETTINGS)
+		list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-unix.c)
+		list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-linux.c)
+	elseif(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)
@@ -315,12 +325,13 @@  if(SUPPORTS_SIMPLE_IPC)
 		list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-win32.c)
 	elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
 		add_compile_definitions(HAVE_FSMONITOR_DAEMON_BACKEND)
-		list(APPEND compat_SOURCES compat/fsmonitor/fsm-listen-darwin.c)
+		list(APPEND compat_SOURCES compat/fsmonitor/fsm-ipc-unix.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-listen-darwin.c)
 		list(APPEND compat_SOURCES compat/fsmonitor/fsm-path-utils-darwin.c)
 
 		add_compile_definitions(HAVE_FSMONITOR_OS_SETTINGS)
+		list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-unix.c)
 		list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-darwin.c)
 	endif()
 endif()