This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: LFS meets PowerPC - score 0,1


On Thu, Jun 17, 1999 at 12:43:14AM -0400, Daniel Jacobowitz wrote:
> I spent today merrily chasing down some of the problems with LFS
> support on powerpc-linux; it tends to break everything, totally.  I've
> found at least one of them.
> 
> mmap64 is simply defined as an alias to mmap, for all linux platforms -
> specifically defined so for the 64bit arches, as makes sense, and
> temporarily defined so for the others.  There's one big problem with
> the way it's done, though.  It is simply a syscall alias, so there are
> now two ways to make the mmap syscall - one has a prototype with a
> 32bit off_t, and the other has a prototype with a 64bit off64_t.  In
> all honesty, I can't believe this ever worked at all.  Perhaps a
> wierd combination of endiannesses and calling conventions enabled it to
> work on some other architectures, but on ppc we see this:

Here's a patch which fixes the problems I'd been seeing with mmap64(). 
Comments?

Dan

/--------------------------------\  /--------------------------------\
|       Daniel Jacobowitz        |__|        SCS Class of 2002       |
|   Debian GNU/Linux Developer    __    Carnegie Mellon University   |
|         dan@debian.org         |  |       dmj+@andrew.cmu.edu      |
\--------------------------------/  \--------------------------------/
diff -uNr build/glibc-2.1.1/sysdeps/unix/sysv/linux/powerpc/mmap64.c b/glibc-2.1.1/sysdeps/unix/sysv/linux/powerpc/mmap64.c
--- build/glibc-2.1.1/sysdeps/unix/sysv/linux/powerpc/mmap64.c	Wed Dec 31 19:00:00 1969
+++ b/glibc-2.1.1/sysdeps/unix/sysv/linux/powerpc/mmap64.c	Thu Jun 17 15:48:31 1999
@@ -0,0 +1,45 @@
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Daniel Jacobowitz <dan@debian.org>, 1999.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+#include <sys/mman.h>
+
+__ptr_t
+__mmap64 (__addr, __len, __prot, __flags, __fd, __offset)
+     __ptr_t __addr;
+     size_t __len;
+     int __prot;
+     int __flags;
+     int __fd;
+     __off64_t __offset;
+{
+  if(__offset >= (1ULL << 32)) {
+    errno = -EINVAL;
+    return(MAP_FAILED);
+  }
+  
+  return __mmap(__addr, __len, __prot, __flags, __fd, (off_t)__offset);
+}
+
+weak_alias (__mmap64, mmap64)
diff -uNr build/glibc-2.1.1/sysdeps/unix/sysv/linux/powerpc/syscalls.list b/glibc-2.1.1/sysdeps/unix/sysv/linux/powerpc/syscalls.list
--- build/glibc-2.1.1/sysdeps/unix/sysv/linux/powerpc/syscalls.list	Wed Jan 13 12:57:10 1999
+++ b/glibc-2.1.1/sysdeps/unix/sysv/linux/powerpc/syscalls.list	Thu Jun 17 14:39:32 1999
@@ -1,5 +1,8 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
+mmap64		-	mmap64		8	__mmap64	mmap64
+mmap            -       mmap            6       __mmap          mmap
+
 # System calls with wrappers.
 s_ioctl		ioctl	ioctl		3	__syscall_ioctl
 s_ipc		msgget	ipc		5	__syscall_ipc

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]