patches/glibc/2.3.3/glibc-2.3.3-s390-fadvise64.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2.3.3/glibc-2.3.3-s390-fadvise64.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,128 @@
     1.4 +See http://sources.redhat.com/ml/libc-hacker/2003-12/msg00023.html
     1.5 +or http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c?cvsroot=glibc
     1.6 +
     1.7 +Should fix error 
     1.8 +
     1.9 +../sysdeps/unix/sysv/linux/posix_fadvise64.c: In function `__posix_fadvise64_l64':
    1.10 +../sysdeps/unix/sysv/linux/posix_fadvise64.c:35: warning: implicit declaration of function `DECLARGS_6'
    1.11 +../sysdeps/unix/sysv/linux/posix_fadvise64.c:35: error: parse error before "register"
    1.12 +...
    1.13 +../sysdeps/unix/sysv/linux/posix_fadvise64.c:35: error: parse error before "ASMFMT_6"
    1.14 +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
    1.15 +
    1.16 +
    1.17 +From: Martin Schwidefsky <schwidefsky at de dot ibm dot com>
    1.18 +Organization: IBM Deutschland GmbH
    1.19 +To: libc-hacker at sources dot redhat dot com
    1.20 +Subject: fadvise64_64 for s390-32.
    1.21 +Date: Fri, 5 Dec 2003 18:46:33 +0100
    1.22 +
    1.23 +Hi,
    1.24 +on s390* system calls can have up to 5 paramters. The generic linux
    1.25 +implemenation of fadvise64_64 for 32 bit systems needs 6 parameters,
    1.26 +so we need to have a s390-32 special version of posix_fadvise64.c.
    1.27 +For s390-64 we do not have the problem because there fadvise64_64
    1.28 +has only 4 parameters.
    1.29 +
    1.30 +blue skies,
    1.31 +  Martin.
    1.32 +
    1.33 +2003-12-05  Martin Schwidefsky  <schwidefsky@de.ibm.com>
    1.34 +
    1.35 +	* sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c: New file.
    1.36 +
    1.37 +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
    1.38 +--- libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c	1970-01-01 01:00:00.000000000 +0100
    1.39 ++++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c	2003-11-13 15:31:40.000000000 +0100
    1.40 +@@ -0,0 +1,90 @@
    1.41 ++/* Copyright (C) 2003 Free Software Foundation, Inc.
    1.42 ++   This file is part of the GNU C Library.
    1.43 ++
    1.44 ++   The GNU C Library is free software; you can redistribute it and/or
    1.45 ++   modify it under the terms of the GNU Lesser General Public
    1.46 ++   License as published by the Free Software Foundation; either
    1.47 ++   version 2.1 of the License, or (at your option) any later version.
    1.48 ++
    1.49 ++   The GNU C Library is distributed in the hope that it will be useful,
    1.50 ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.51 ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.52 ++   Lesser General Public License for more details.
    1.53 ++
    1.54 ++   You should have received a copy of the GNU Lesser General Public
    1.55 ++   License along with the GNU C Library; if not, write to the Free
    1.56 ++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    1.57 ++   02111-1307 USA.  */
    1.58 ++
    1.59 ++#include <errno.h>
    1.60 ++#include <fcntl.h>
    1.61 ++#include <sysdep.h>
    1.62 ++#include <kernel-features.h>
    1.63 ++
    1.64 ++int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise);
    1.65 ++int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise);
    1.66 ++
    1.67 ++/* Advice the system about the expected behaviour of the application with
    1.68 ++   respect to the file associated with FD.  */
    1.69 ++
    1.70 ++struct fadvise64_64_layout
    1.71 ++{
    1.72 ++  int fd;
    1.73 ++  off64_t offset;
    1.74 ++  off64_t len;
    1.75 ++  int advise;
    1.76 ++};
    1.77 ++
    1.78 ++int
    1.79 ++__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
    1.80 ++{
    1.81 ++#ifdef __NR_fadvise64_64
    1.82 ++  struct fadvise64_64_layout parameters;
    1.83 ++  INTERNAL_SYSCALL_DECL (err);
    1.84 ++  
    1.85 ++  parameters.fd = fd;
    1.86 ++  parameters.offset = offset;
    1.87 ++  parameters.len = len;
    1.88 ++  parameters.advise = advise;
    1.89 ++  int ret = INTERNAL_SYSCALL (fadvise64_64, err, 1, &parameters);
    1.90 ++  if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
    1.91 ++    return 0;
    1.92 ++# ifndef __ASSUME_FADVISE64_64_SYSCALL
    1.93 ++  if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS)
    1.94 ++# endif
    1.95 ++   return INTERNAL_SYSCALL_ERRNO (ret, err);
    1.96 ++#endif
    1.97 ++#ifndef __ASSUME_FADVISE64_64_SYSCALL
    1.98 ++# ifdef __NR_fadvise64
    1.99 ++  if (len != (off_t) len)
   1.100 ++    return EOVERFLOW;
   1.101 ++
   1.102 ++  INTERNAL_SYSCALL_DECL (err2);
   1.103 ++  int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 5, fd,
   1.104 ++			       __LONG_LONG_PAIR ((long) (offset >> 32),
   1.105 ++						 (long) offset),
   1.106 ++			       (off_t) len, advise);
   1.107 ++  if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2))
   1.108 ++    return 0;
   1.109 ++  return INTERNAL_SYSCALL_ERRNO (ret2, err2);
   1.110 ++# else
   1.111 ++  return ENOSYS;
   1.112 ++# endif
   1.113 ++#endif
   1.114 ++}
   1.115 ++
   1.116 ++#include <shlib-compat.h>
   1.117 ++
   1.118 ++#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)
   1.119 ++
   1.120 ++int
   1.121 ++__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise)
   1.122 ++{
   1.123 ++  return __posix_fadvise64_l64 (fd, offset, len, advise);
   1.124 ++}
   1.125 ++
   1.126 ++versioned_symbol (libc, __posix_fadvise64_l64, posix_fadvise64, GLIBC_2_3_3);
   1.127 ++compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2);
   1.128 ++#else
   1.129 ++strong_alias (__posix_fadvise64_l64, posix_fadvise64);
   1.130 ++#endif
   1.131 +