crosstool-ng/patches/glibc/2.3.3/glibc-2.3.3-s390-fadvise64.patch
Yann E. MORIN" 1906cf93f8 Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
2007-02-24 11:00:05 +00:00

129 lines
4.5 KiB
Diff

See http://sources.redhat.com/ml/libc-hacker/2003-12/msg00023.html
or http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c?cvsroot=glibc
Should fix error
../sysdeps/unix/sysv/linux/posix_fadvise64.c: In function `__posix_fadvise64_l64':
../sysdeps/unix/sysv/linux/posix_fadvise64.c:35: warning: implicit declaration of function `DECLARGS_6'
../sysdeps/unix/sysv/linux/posix_fadvise64.c:35: error: parse error before "register"
...
../sysdeps/unix/sysv/linux/posix_fadvise64.c:35: error: parse error before "ASMFMT_6"
make[2]: *** [crosstool-0.28-rc34/build/s390-unknown-linux-gnu/gcc-3.4.1-glibc-2.3.3/build-glibc/io/posix_fadvise64.o] Error 1
From: Martin Schwidefsky <schwidefsky at de dot ibm dot com>
Organization: IBM Deutschland GmbH
To: libc-hacker at sources dot redhat dot com
Subject: fadvise64_64 for s390-32.
Date: Fri, 5 Dec 2003 18:46:33 +0100
Hi,
on s390* system calls can have up to 5 paramters. The generic linux
implemenation of fadvise64_64 for 32 bit systems needs 6 parameters,
so we need to have a s390-32 special version of posix_fadvise64.c.
For s390-64 we do not have the problem because there fadvise64_64
has only 4 parameters.
blue skies,
Martin.
2003-12-05 Martin Schwidefsky <schwidefsky@de.ibm.com>
* sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c: New file.
diff -urN libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c libc-s390/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c
--- libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c 1970-01-01 01:00:00.000000000 +0100
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c 2003-11-13 15:31:40.000000000 +0100
@@ -0,0 +1,90 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sysdep.h>
+#include <kernel-features.h>
+
+int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise);
+int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise);
+
+/* Advice the system about the expected behaviour of the application with
+ respect to the file associated with FD. */
+
+struct fadvise64_64_layout
+{
+ int fd;
+ off64_t offset;
+ off64_t len;
+ int advise;
+};
+
+int
+__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
+{
+#ifdef __NR_fadvise64_64
+ struct fadvise64_64_layout parameters;
+ INTERNAL_SYSCALL_DECL (err);
+
+ parameters.fd = fd;
+ parameters.offset = offset;
+ parameters.len = len;
+ parameters.advise = advise;
+ int ret = INTERNAL_SYSCALL (fadvise64_64, err, 1, &parameters);
+ if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return 0;
+# ifndef __ASSUME_FADVISE64_64_SYSCALL
+ if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS)
+# endif
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+#endif
+#ifndef __ASSUME_FADVISE64_64_SYSCALL
+# ifdef __NR_fadvise64
+ if (len != (off_t) len)
+ return EOVERFLOW;
+
+ INTERNAL_SYSCALL_DECL (err2);
+ int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 5, fd,
+ __LONG_LONG_PAIR ((long) (offset >> 32),
+ (long) offset),
+ (off_t) len, advise);
+ if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2))
+ return 0;
+ return INTERNAL_SYSCALL_ERRNO (ret2, err2);
+# else
+ return ENOSYS;
+# endif
+#endif
+}
+
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)
+
+int
+__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise)
+{
+ return __posix_fadvise64_l64 (fd, offset, len, advise);
+}
+
+versioned_symbol (libc, __posix_fadvise64_l64, posix_fadvise64, GLIBC_2_3_3);
+compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2);
+#else
+strong_alias (__posix_fadvise64_l64, posix_fadvise64);
+#endif