[PATCH] support 32bit kernels which have no __NR_fcntl

Mark Salter msalter at redhat.com
Tue Aug 7 13:43:54 UTC 2012


Newer 32-bit Linux kernel ports do not have a fcntl syscall. These
kernels will have fcntl64 instead. The fcntl64 syscall on 32-bit
kernels is identical to the deprecated fcntl syscall except that it
also supports the 64-bit locking commands:

  F_GETLK64
  F_SETLK64
  F_SETLKW64

This patch tweaks thc libc fcntl function so that it will build for
the newer kernels lacking the old fcntl syscall. It has no effect
when built against older kernel headers with the fcntl syscall.

Signed-off-by: Mark Salter <msalter at redhat.com>
---
 libc/sysdeps/linux/common/__syscall_fcntl.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c
index d56f4a2..16c52c8 100644
--- a/libc/sysdeps/linux/common/__syscall_fcntl.c
+++ b/libc/sysdeps/linux/common/__syscall_fcntl.c
@@ -26,7 +26,11 @@ int __NC(fcntl)(int fd, int cmd, long arg)
 # endif
 	}
 #endif
+#if __WORDSIZE == 32 && !defined __NR_fcntl
+	return INLINE_SYSCALL(fcntl64, 3, fd, cmd, arg);
+#else
 	return INLINE_SYSCALL(fcntl, 3, fd, cmd, arg);
+#endif
 }
 
 int fcntl(int fd, int cmd, ...)
-- 
1.7.9.1



More information about the uClibc mailing list