Browse Source

Enable fcntl64, and fix fcntl when large fils is enabled.

Eric Andersen 22 years ago
parent
commit
0e4cf8c300
2 changed files with 32 additions and 0 deletions
  1. 9 0
      include/fcntl.h
  2. 23 0
      libc/sysdeps/linux/common/syscalls.c

+ 9 - 0
include/fcntl.h

@@ -57,7 +57,16 @@ __BEGIN_DECLS
 
 /* Do the file control operation described by CMD on FD.
    The remaining arguments are interpreted depending on CMD.  */
+#ifndef __USE_FILE_OFFSET64
 extern int fcntl (int __fd, int __cmd, ...) __THROW;
+#else
+# ifdef __REDIRECT
+extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...) __THROW,
+		       fcntl64);
+# else
+#  define fcntl fcntl64
+# endif
+#endif
 
 /* Open FILE and return a new file descriptor for it, or -1 on error.
    OFLAG determines the type of access used.  If O_CREAT is on OFLAG,

+ 23 - 0
libc/sysdeps/linux/common/syscalls.c

@@ -1533,6 +1533,29 @@ _syscall3(int, getdents64, int, fd, char *, dirp, size_t, count);
 #endif /* __UCLIBC_HAVE_LFS__ */
 
 //#define __NR_fcntl64		221
+#ifdef __UCLIBC_HAVE_LFS__
+#define __NR__fcntl64 __NR_fcntl64
+#ifdef L__fcntl64
+#include <stdarg.h>
+#include <fcntl.h>
+extern int _fcntl64(int fd, int cmd, long arg);
+
+_syscall3(int, _fcntl64, int, fd, int, cmd, long, arg);
+
+int fcntl64(int fd, int command, ...)
+{
+	long arg;
+	va_list list;
+
+	va_start(list, command);
+	arg = va_arg(list, long);
+
+	va_end(list);
+	return _fcntl64(fd, command, arg);
+}
+#endif
+#endif
+
 //#define __NR_security		223	/* syscall for security modules */
 //#define __NR_gettid		224
 //#define __NR_readahead		225