From fae5bf811e75e94d6ee89f1957cd4e224ed384e2 Mon Sep 17 00:00:00 2001 From: Mark Winkel Date: Wed, 23 Aug 2023 17:13:01 -0400 Subject: [PATCH] MacOS now has working OFD locks --- treeshr/RemoteAccess.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/treeshr/RemoteAccess.c b/treeshr/RemoteAccess.c index ea3f156a2f..1e4786ef04 100644 --- a/treeshr/RemoteAccess.c +++ b/treeshr/RemoteAccess.c @@ -24,6 +24,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include +#include #ifdef _WIN32 #include #include @@ -39,11 +40,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // # define flock lx_flock // # include // # undef flock + #ifndef F_OFD_SETLK +#ifdef _MACOSX +// Open File Descriptor (OFD) locks have existed as a private / undocumented +// feature in MacOS releases since 2015. For more details, refer to the +// comments at the end of Issue #2599 and the earlier PRs #2163 and #2198. +#define F_OFD_GETLK 92 +#define F_OFD_SETLK 90 +#define F_OFD_SETLKW 91 +#else +// The usual defines for Linux #define F_OFD_GETLK 36 #define F_OFD_SETLK 37 #define F_OFD_SETLKW 38 #endif +#endif + #endif #include #include