patches/glibc/2.3.3/glibc-2.3.3-s390-fadvise64.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
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... :-(
yann@1
     1
See http://sources.redhat.com/ml/libc-hacker/2003-12/msg00023.html
yann@1
     2
or http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c?cvsroot=glibc
yann@1
     3
yann@1
     4
Should fix error 
yann@1
     5
yann@1
     6
../sysdeps/unix/sysv/linux/posix_fadvise64.c: In function `__posix_fadvise64_l64':
yann@1
     7
../sysdeps/unix/sysv/linux/posix_fadvise64.c:35: warning: implicit declaration of function `DECLARGS_6'
yann@1
     8
../sysdeps/unix/sysv/linux/posix_fadvise64.c:35: error: parse error before "register"
yann@1
     9
...
yann@1
    10
../sysdeps/unix/sysv/linux/posix_fadvise64.c:35: error: parse error before "ASMFMT_6"
yann@1
    11
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
yann@1
    12
yann@1
    13
yann@1
    14
From: Martin Schwidefsky <schwidefsky at de dot ibm dot com>
yann@1
    15
Organization: IBM Deutschland GmbH
yann@1
    16
To: libc-hacker at sources dot redhat dot com
yann@1
    17
Subject: fadvise64_64 for s390-32.
yann@1
    18
Date: Fri, 5 Dec 2003 18:46:33 +0100
yann@1
    19
yann@1
    20
Hi,
yann@1
    21
on s390* system calls can have up to 5 paramters. The generic linux
yann@1
    22
implemenation of fadvise64_64 for 32 bit systems needs 6 parameters,
yann@1
    23
so we need to have a s390-32 special version of posix_fadvise64.c.
yann@1
    24
For s390-64 we do not have the problem because there fadvise64_64
yann@1
    25
has only 4 parameters.
yann@1
    26
yann@1
    27
blue skies,
yann@1
    28
  Martin.
yann@1
    29
yann@1
    30
2003-12-05  Martin Schwidefsky  <schwidefsky@de.ibm.com>
yann@1
    31
yann@1
    32
	* sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c: New file.
yann@1
    33
yann@1
    34
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
yann@1
    35
--- libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c	1970-01-01 01:00:00.000000000 +0100
yann@1
    36
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c	2003-11-13 15:31:40.000000000 +0100
yann@1
    37
@@ -0,0 +1,90 @@
yann@1
    38
+/* Copyright (C) 2003 Free Software Foundation, Inc.
yann@1
    39
+   This file is part of the GNU C Library.
yann@1
    40
+
yann@1
    41
+   The GNU C Library is free software; you can redistribute it and/or
yann@1
    42
+   modify it under the terms of the GNU Lesser General Public
yann@1
    43
+   License as published by the Free Software Foundation; either
yann@1
    44
+   version 2.1 of the License, or (at your option) any later version.
yann@1
    45
+
yann@1
    46
+   The GNU C Library is distributed in the hope that it will be useful,
yann@1
    47
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
yann@1
    48
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
yann@1
    49
+   Lesser General Public License for more details.
yann@1
    50
+
yann@1
    51
+   You should have received a copy of the GNU Lesser General Public
yann@1
    52
+   License along with the GNU C Library; if not, write to the Free
yann@1
    53
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
yann@1
    54
+   02111-1307 USA.  */
yann@1
    55
+
yann@1
    56
+#include <errno.h>
yann@1
    57
+#include <fcntl.h>
yann@1
    58
+#include <sysdep.h>
yann@1
    59
+#include <kernel-features.h>
yann@1
    60
+
yann@1
    61
+int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise);
yann@1
    62
+int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise);
yann@1
    63
+
yann@1
    64
+/* Advice the system about the expected behaviour of the application with
yann@1
    65
+   respect to the file associated with FD.  */
yann@1
    66
+
yann@1
    67
+struct fadvise64_64_layout
yann@1
    68
+{
yann@1
    69
+  int fd;
yann@1
    70
+  off64_t offset;
yann@1
    71
+  off64_t len;
yann@1
    72
+  int advise;
yann@1
    73
+};
yann@1
    74
+
yann@1
    75
+int
yann@1
    76
+__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
yann@1
    77
+{
yann@1
    78
+#ifdef __NR_fadvise64_64
yann@1
    79
+  struct fadvise64_64_layout parameters;
yann@1
    80
+  INTERNAL_SYSCALL_DECL (err);
yann@1
    81
+  
yann@1
    82
+  parameters.fd = fd;
yann@1
    83
+  parameters.offset = offset;
yann@1
    84
+  parameters.len = len;
yann@1
    85
+  parameters.advise = advise;
yann@1
    86
+  int ret = INTERNAL_SYSCALL (fadvise64_64, err, 1, &parameters);
yann@1
    87
+  if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
yann@1
    88
+    return 0;
yann@1
    89
+# ifndef __ASSUME_FADVISE64_64_SYSCALL
yann@1
    90
+  if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS)
yann@1
    91
+# endif
yann@1
    92
+   return INTERNAL_SYSCALL_ERRNO (ret, err);
yann@1
    93
+#endif
yann@1
    94
+#ifndef __ASSUME_FADVISE64_64_SYSCALL
yann@1
    95
+# ifdef __NR_fadvise64
yann@1
    96
+  if (len != (off_t) len)
yann@1
    97
+    return EOVERFLOW;
yann@1
    98
+
yann@1
    99
+  INTERNAL_SYSCALL_DECL (err2);
yann@1
   100
+  int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 5, fd,
yann@1
   101
+			       __LONG_LONG_PAIR ((long) (offset >> 32),
yann@1
   102
+						 (long) offset),
yann@1
   103
+			       (off_t) len, advise);
yann@1
   104
+  if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2))
yann@1
   105
+    return 0;
yann@1
   106
+  return INTERNAL_SYSCALL_ERRNO (ret2, err2);
yann@1
   107
+# else
yann@1
   108
+  return ENOSYS;
yann@1
   109
+# endif
yann@1
   110
+#endif
yann@1
   111
+}
yann@1
   112
+
yann@1
   113
+#include <shlib-compat.h>
yann@1
   114
+
yann@1
   115
+#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)
yann@1
   116
+
yann@1
   117
+int
yann@1
   118
+__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise)
yann@1
   119
+{
yann@1
   120
+  return __posix_fadvise64_l64 (fd, offset, len, advise);
yann@1
   121
+}
yann@1
   122
+
yann@1
   123
+versioned_symbol (libc, __posix_fadvise64_l64, posix_fadvise64, GLIBC_2_3_3);
yann@1
   124
+compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2);
yann@1
   125
+#else
yann@1
   126
+strong_alias (__posix_fadvise64_l64, posix_fadvise64);
yann@1
   127
+#endif
yann@1
   128