This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Patch for powerpc syscall updates
- To: libc-alpha at sourceware dot cygnus dot com
- Subject: Patch for powerpc syscall updates
- From: Daniel Jacobowitz <drow at false dot org>
- Date: Thu, 27 Jan 2000 23:16:38 -0500
Well, this patch seems to fix my mmap64 and build problems.
One thing I can not understand - programs still botch mmap64 calls unless
recompiled with this patch applied (botch -> mis-pass the arguments, and it
returns MMAP_FAILED), and I can not see why. But recompiling against this
works.
Anything wrong with the patch?
Also, in linux/powerpc/syscalls.list, the setrlimit line looks a little
dubious; the rest I've got more or less accounted for now though.
Dan
/--------------------------------\ /--------------------------------\
| Daniel Jacobowitz |__| SCS Class of 2002 |
| Debian GNU/Linux Developer __ Carnegie Mellon University |
| dan@debian.org | | dmj+@andrew.cmu.edu |
\--------------------------------/ \--------------------------------/
diff -uNr glibc-2.1.2/sysdeps/unix/sysv/linux/powerpc/mmap64.c ../../glibc-2.1.2/glibc-2.1.2/sysdeps/unix/sysv/linux/powerpc/mmap64.c
--- glibc-2.1.2/sysdeps/unix/sysv/linux/powerpc/mmap64.c Wed Dec 31 19:00:00 1969
+++ ../../glibc-2.1.2/glibc-2.1.2/sysdeps/unix/sysv/linux/powerpc/mmap64.c Thu Jan 27 13:18:33 2000
@@ -0,0 +1,64 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 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>
+
+#ifdef __NR_mmap2
+extern int __syscall_mmap2(__ptr_t, size_t, int, int, int, off_t);
+static int have_no_mmap2;
+#endif
+
+__ptr_t
+__mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd, off64_t offset)
+{
+#ifdef __NR_mmap2
+ if (! have_no_mmap2 && ! (offset & 4095))
+ {
+ int saved_errno = errno;
+
+/* FIXME: when mmap2 is implemented, check how it actually expects arguments passed.
+ It may require a nonstandard call stub. */
+
+ /* This will be always 12, no matter what page size is. */
+ int result = INLINE_SYSCALL (mmap2, 6, addr, len, prot, flags,
+ fd, (off_t) (offset >> 12));
+
+ if (result != -1 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ have_no_mmap2 = 1;
+ }
+#endif
+ if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len))
+ {
+ __set_errno (EINVAL);
+ return MAP_FAILED;
+ }
+
+ return __mmap (addr, len, prot, flags, fd, (off_t) offset);
+}
+
+weak_alias (__mmap64, mmap64)
diff -uNr glibc-2.1.2/sysdeps/unix/sysv/linux/powerpc/syscalls.list ../../glibc-2.1.2/glibc-2.1.2/sysdeps/unix/sysv/linux/powerpc/syscalls.list
--- glibc-2.1.2/sysdeps/unix/sysv/linux/powerpc/syscalls.list Thu Jan 27 22:59:19 2000
+++ ../../glibc-2.1.2/glibc-2.1.2/sysdeps/unix/sysv/linux/powerpc/syscalls.list Thu Jan 27 13:04:49 2000
@@ -2,22 +2,27 @@
# System calls with wrappers.
s_ioctl ioctl ioctl 3 __syscall_ioctl
-s_ipc msgget ipc 5 __syscall_ipc
-s_llseek llseek _llseek 5 __syscall__llseek
s_chown chown chown 3 __syscall_chown
-s_execve execve execve 3 __syscall_execve
+
+s_llseek llseek _llseek 5 __syscall__llseek
+s_ipc msgget ipc 5 __syscall_ipc
rt_sigaction - rt_sigaction 4 __syscall_rt_sigaction
rt_sigpending - rt_sigpending 2 __syscall_rt_sigpending
rt_sigprocmask - rt_sigprocmask 4 __syscall_rt_sigprocmask
rt_sigqueueinfo - rt_sigqueueinfo 3 __syscall_rt_sigqueueinfo
rt_sigsuspend - rt_sigsuspend 2 __syscall_rt_sigsuspend
rt_sigtimedwait - rt_sigtimedwait 4 __syscall_rt_sigtimedwait
+s_execve execve execve 3 __syscall_execve
+s_fstat64 fxstat64 fstat64 2 __syscall_fstat64
+s_ftruncate64 ftruncate64 ftruncate64 3 __syscall_ftruncate64
s_getcwd getcwd getcwd 2 __syscall_getcwd
s_getdents getdents getdents 3 __syscall_getdents
s_getpriority getpriority getpriority 2 __syscall_getpriority
s_getresgid getresgid getresgid 3 __syscall_getresgid
s_getresuid getresuid getresuid 3 __syscall_getresuid
s_getrlimit getrlimit getrlimit 2 __syscall_getrlimit
+s_lstat64 lxstat64 lstat64 2 __syscall_lstat64
+s_mmap2 mmap64 mmap2 6 __syscall_mmap2
s_poll poll poll 3 __syscall_poll
s_pread64 pread64 pread 5 __syscall_pread
s_ptrace ptrace ptrace 4 __syscall_ptrace
@@ -28,7 +33,9 @@
s_sigpending sigpending sigpending 1 __syscall_sigpending
s_sigprocmask sigprocmask sigprocmask 3 __syscall_sigprocmask
s_sigsuspend sigsuspend sigsuspend 3 __syscall_sigsuspend
+s_stat64 xstat64 stat64 2 __syscall_stat64
s_sysctl sysctl _sysctl 1 __syscall__sysctl
+s_truncate64 truncate64 truncate64 3 __syscall_truncate64
s_ugetrlimit getrlimit ugetrlimit 2 __syscall_ugetrlimit
s_ustat ustat ustat 2 __syscall_ustat
s_vfork vfork vfork 0 __syscall_vfork