Browse Source

Patch from Miles Bader to allow Large File support on the v850.

Eric Andersen 22 years ago
parent
commit
eea9e45879

+ 3 - 3
extra/Configs/Config.v850e

@@ -113,7 +113,7 @@ UNIFIED_SYSCALL = false
 
 # If you want large file support (greater then 2 GiB) turn this on.
 # Do not enable this unless your kernel provides large file support.
-DOLFS = false
+DOLFS = true
 
 # Posix regular expression code is really big -- 27k all by itself.
 # If you don't use regular expressions, turn this off and save space.
@@ -181,14 +181,14 @@ SHARED_LIB_LOADER_PATH=$(DEVEL_PREFIX)/lib
 # This value is used by the 'make install' Makefile target.  Since this
 # directory is compiled into the uclibc cross compiler spoofer, you
 # have to recompile if you change this value...
-DEVEL_PREFIX = /usr/$(TARGET_ARCH)-linux-uclibc
+DEVEL_PREFIX = $(DESTDIR)/$(TARGET_ARCH)-uclibc
 
 # SYSTEM_DEVEL_PREFIX is the directory prefix used when installing
 # bin/arch-uclibc-gcc, bin/arch-uclibc-ld, etc.   This is only used by
 # the 'make install' target, and is not compiled into anything.  This
 # defaults to $DEVEL_PREFIX/usr, but makers of .rpms and .debs will
 # want to set this to "/usr" instead.
-SYSTEM_DEVEL_PREFIX = $(DEVEL_PREFIX)/usr
+SYSTEM_DEVEL_PREFIX = $(DESTDIR)
 
 # If you want 'make install' to install everything under a temporary
 # directory, the define PREFIX during the install step,

+ 3 - 3
libc/sysdeps/linux/v850/Makefile

@@ -1,7 +1,7 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2001  NEC Corporation
-# Copyright (C) 2001  Miles Bader <miles@gnu.org>
+# Copyright (C) 2001,2002  NEC Corporation
+# Copyright (C) 2001,2002  Miles Bader <miles@gnu.org>
 # Copyright (C) 2000  Lineo, inc.
 #
 # This program is free software; you can redistribute it and/or modify it under
@@ -36,7 +36,7 @@ CRT0_OBJ = $(patsubst %.S,%.o, $(CRT0))
 SSRC = setjmp.S longjmp.S vfork.S
 SOBJS = $(patsubst %.S,%.o, $(SSRC))
 
-CSRC = _mmap.c
+CSRC = _mmap.c truncate64.c ftruncate64.c
 COBJS = $(patsubst %.c,%.o, $(CSRC))
 
 OBJS = $(SOBJS) $(COBJS)

+ 33 - 0
libc/sysdeps/linux/v850/ftruncate64.c

@@ -0,0 +1,33 @@
+/*
+ * libc/sysdeps/linux/v850/ftruncate64.c -- `ftruncate64' syscall for linux/v850
+ *
+ *  Copyright (C) 2002  NEC Corporation
+ *  Copyright (C) 2002  Miles Bader <miles@gnu.org>
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License.  See the file COPYING.LIB in the main
+ * directory of this archive for more details.
+ * 
+ * Written by Miles Bader <miles@gnu.org>
+ */
+
+#include <features.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+
+#ifdef __UCLIBC_HAVE_LFS__
+
+/* A version of ftruncate64 that passes in the 64-bit length argument as two
+   32-bit arguments, as required by system call interface on the v850.  */
+#define __NR__ftruncate64 __NR_ftruncate64
+extern inline _syscall3 (int, _ftruncate64,
+			 int, fd, unsigned long, len_lo, long, len_hi);
+
+/* The exported ftruncate64.  */
+int ftruncate64 (int fd, __off64_t length)
+{
+  return _ftruncate64 (fd, (unsigned long)length, (long)(length >> 32));
+}
+
+#endif /* __UCLIBC_HAVE_LFS__ */

+ 34 - 0
libc/sysdeps/linux/v850/truncate64.c

@@ -0,0 +1,34 @@
+/*
+ * libc/sysdeps/linux/v850/truncate64.c -- `truncate64' syscall for linux/v850
+ *
+ *  Copyright (C) 2002  NEC Corporation
+ *  Copyright (C) 2002  Miles Bader <miles@gnu.org>
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License.  See the file COPYING.LIB in the main
+ * directory of this archive for more details.
+ * 
+ * Written by Miles Bader <miles@gnu.org>
+ */
+
+#include <features.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+
+#ifdef __UCLIBC_HAVE_LFS__
+
+/* A version of truncate64 that passes in the 64-bit length argument as two
+   32-bit arguments, as required by system call interface on the v850.  */
+#define __NR__truncate64 __NR_truncate64
+extern inline _syscall3 (int, _truncate64,
+			 const char *, file,
+			 unsigned long, len_lo, long, len_hi);
+
+/* The exported truncate64.  */
+int truncate64 (const char *file, __off64_t length)
+{
+  return _truncate64 (file, (unsigned long)length, (long)(length >> 32));
+}
+
+#endif /* __UCLIBC_HAVE_LFS__ */