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