~ chicken-core (master) c4c968fc886fea7d26286dadcbda9925ff6ee3a6
commit c4c968fc886fea7d26286dadcbda9925ff6ee3a6
Author: Mario Domenech Goulart <mario@parenteses.org>
AuthorDate: Thu May 14 12:47:03 2026 +0200
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Thu May 14 14:57:22 2026 +0200
posixunix.scm: Support flock on GNU Hurd
e7aec6fcda introduced support for flock, which requires sys/file.h on
some platforms. The inclusion of sys/file.h was conditioned to the
definition of __linux__ only, which causes flock-related code to be
undefined on GNU Hurd.
Fix this by including sys/file.h on systems where __GLIBC__ is
defined. The check for __linux__ has been kept for compatibility with
Linux systems that do not use the GNU libc (e.g., musl is used).
Tested on:
* GNU debian 0.9 GNU-Mach 1.8+git20260224-up-amd64/Hurd-0.9 x86_64 GNU
* OpenBSD 7.6
* Alpine Linux 3.23.4 (musl)
* Haiku R1/beta5
* Termux on LineageOS 23.2 (Android 16)
Signed-off-by: felix <felix@call-with-current-continuation.org>
diff --git a/posixunix.scm b/posixunix.scm
index 4ffdf531..0f624648 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -49,7 +49,7 @@ static int C_wait_status;
# include <termios.h>
#endif
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
# include <sys/file.h>
#endif
Trap