~ chicken-core (master) 064763e1c4d5f7bfffc54dcfde704067bb8d8503
commit 064763e1c4d5f7bfffc54dcfde704067bb8d8503
Author: Mario Domenech Goulart <mario@parenteses.org>
AuthorDate: Thu May 14 10:10:32 2026 +0200
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Thu May 14 10:56:34 2026 +0200
posixunix.scm: Support flock on Haiku
Without this fix, chicken-install fails on Haiku with:
Error: (file-lock) locking file failed - No such file or directory: 3
c0fc517bd6 disabled support for flock on Haiku because the build of
CHICKEN would fail on that system due to references to undeclared
constants LOCK_SH, LOCK_EX, LOCK_NB and LOCK_UN. Those actually
exist, but are declared in posix/sys/file.h, which was not being
included.
Tested on Haiku R1/beta5.
Signed-off-by: felix <felix@call-with-current-continuation.org>
diff --git a/posixunix.scm b/posixunix.scm
index bb598c89..4ffdf531 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -53,6 +53,10 @@ static int C_wait_status;
# include <sys/file.h>
#endif
+#ifdef __HAIKU__
+# include <posix/sys/file.h>
+#endif
+
#include <sys/mman.h>
#include <poll.h>
@@ -161,15 +165,7 @@ static int C_uw;
static C_word C_flock(C_word n, C_word f)
{
-#ifdef __HAIKU__
-# define LOCK_SH 0
-# define LOCK_EX 0
-# define LOCK_NB 0
-# define LOCK_UN 0
- return C_fix(-1);
-#else
return C_fix(flock(C_unfix(n), C_unfix(f)));
-#endif
}
static sigset_t C_sigset;
Trap