From 835cd40733d63bce9a4bd843482766c246495044 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 16 Jul 2026 21:16:45 +0200 Subject: sharedstorage: fix darwin & freebsd build failure --- internal/syscallcompat/sys_freebsd.go | 5 +++++ tests/cluster/poc_test.go | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/syscallcompat/sys_freebsd.go b/internal/syscallcompat/sys_freebsd.go index d88b1cf..0d28f3e 100644 --- a/internal/syscallcompat/sys_freebsd.go +++ b/internal/syscallcompat/sys_freebsd.go @@ -32,6 +32,11 @@ const ( // For the utimensat syscall on FreeBSD AT_EMPTY_PATH = 0x4000 + + // F_OFD_SETLKW only exists on Linux. On Darwin, fall back to F_SETLKW as a + // flawed replacement. + F_OFD_SETLKW = unix.F_SETLKW + F_OFD_SETLK = unix.F_SETLK ) // EnospcPrealloc is supposed to preallocate ciphertext space without diff --git a/tests/cluster/poc_test.go b/tests/cluster/poc_test.go index e8b6da6..52b9ec9 100644 --- a/tests/cluster/poc_test.go +++ b/tests/cluster/poc_test.go @@ -44,11 +44,11 @@ func TestPoCFcntlFlock(t *testing.T) { Start: 0, Len: 0, } - err = unix.FcntlFlock(uintptr(fd1), unix.F_OFD_SETLK, &lk) + err = unix.FcntlFlock(uintptr(fd1), syscallcompat.F_OFD_SETLK, &lk) if err != nil { t.Fatal(err) } - err = unix.FcntlFlock(uintptr(fd2), unix.F_OFD_SETLK, &lk) + err = unix.FcntlFlock(uintptr(fd2), syscallcompat.F_OFD_SETLK, &lk) if err == nil { t.Fatal("double-lock succeeded but should have failed") } @@ -190,7 +190,7 @@ func doTestPoCTornWrite(t *testing.T, locking bool) { Start: 0, Len: int64(len(blockData)), } - if err := unix.FcntlFlock(uintptr(f.Fd()), unix.F_OFD_SETLKW, &lk); err != nil { + if err := unix.FcntlFlock(uintptr(f.Fd()), syscallcompat.F_OFD_SETLKW, &lk); err != nil { t.Error(err) return } -- cgit v1.2.3