patches/glibc/ports-2.10.1/490-alpha_alpha-add-fdatasync-support.patch
author Arnaud Lacombe <lacombar@gmail.com>
Thu Aug 05 17:59:51 2010 +0200 (2010-08-05)
changeset 2069 366bd2b22675
permissions -rw-r--r--
complibs/mpc: fix MPC 0.8.1 build with MPFR 3.0.0

This is the change introduced by revision 734 of MPC repository.

Author: Paul Zimmermann <Paul.Zimmermann@loria.fr>
Revision log: [acos.c] fixed problem with GMP_RNDA (should be MPFR_RNDA, and code was wrong)

Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
     1 2009-07-25  Aurelien Jarno  <aurelien@aurel32.net>
     2 
     3 	* sysdeps/unix/sysv/linux/kernel-features.h: define 
     4 	__ASSUME_FDATASYNC. 
     5 	* sysdeps/unix/sysv/linux/fdatasync.c: New file.
     6 	* sysdeps/unix/sysv/linux/Makefile: compile fdatasync.c with
     7 	-fexceptions.
     8 	* sysdeps/unix/sysv/linux/syscalls.list: Remove fdatasync.
     9 
    10  sysdeps/unix/sysv/linux/Makefile          |    1 
    11  sysdeps/unix/sysv/linux/fdatasync.c       |   69 ++++++++++++++++++++++++++++++
    12  sysdeps/unix/sysv/linux/kernel-features.h |    6 ++
    13  sysdeps/unix/sysv/linux/syscalls.list     |    1 
    14  4 files changed, 76 insertions(+), 1 deletion(-)
    15 
    16 diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/Makefile glibc-2.10.1/sysdeps/unix/sysv/linux/Makefile
    17 --- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/Makefile	2009-03-02 17:15:13.000000000 +0100
    18 +++ glibc-2.10.1/sysdeps/unix/sysv/linux/Makefile	2009-11-13 00:51:04.000000000 +0100
    19 @@ -16,6 +16,7 @@
    20  		   setfsuid setfsgid makedev epoll_pwait signalfd \
    21  		   eventfd eventfd_read eventfd_write
    22  
    23 +CFLAGS-fdatasync.c = -fexceptions
    24  CFLAGS-gethostid.c = -fexceptions
    25  
    26  sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
    27 diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/fdatasync.c glibc-2.10.1/sysdeps/unix/sysv/linux/fdatasync.c
    28 --- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/fdatasync.c	1970-01-01 01:00:00.000000000 +0100
    29 +++ glibc-2.10.1/sysdeps/unix/sysv/linux/fdatasync.c	2009-11-13 00:51:04.000000000 +0100
    30 @@ -0,0 +1,69 @@
    31 +/* fdatasync -- synchronize at least the data part of a file with 
    32 +   the underlying media. Linux version. 
    33 +
    34 +   Copyright (C) 2007 Free Software Foundation, Inc.
    35 +   This file is part of the GNU C Library.
    36 +
    37 +   The GNU C Library is free software; you can redistribute it and/or
    38 +   modify it under the terms of the GNU Lesser General Public
    39 +   License as published by the Free Software Foundation; either
    40 +   version 2.1 of the License, or (at your option) any later version.
    41 +
    42 +   The GNU C Library is distributed in the hope that it will be useful,
    43 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
    44 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    45 +   Lesser General Public License for more details.
    46 +
    47 +   You should have received a copy of the GNU Lesser General Public
    48 +   License along with the GNU C Library; if not, write to the Free
    49 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    50 +   02111-1307 USA.  */
    51 +
    52 +#include <errno.h>
    53 +#include <unistd.h>
    54 +
    55 +#include <sysdep-cancel.h>
    56 +#include <sys/syscall.h>
    57 +#include <bp-checks.h>
    58 +
    59 +#include <kernel-features.h>
    60 +
    61 +#if defined __NR_fdatasync && !defined __ASSUME_FDATASYNC
    62 +static int __have_no_fdatasync;
    63 +#endif
    64 +
    65 +static int
    66 +do_fdatasync (int fd)
    67 +{
    68 +#ifdef __ASSUME_FDATASYNC
    69 +  return INLINE_SYSCALL (fdatasync, 1, fd);
    70 +#elif defined __NR_fdatasync
    71 +  if (!__builtin_expect (__have_no_fdatasync, 0))
    72 +    {
    73 +      int result = INLINE_SYSCALL (fdatasync, 1, fd);
    74 +      if (__builtin_expect (result, 0) != -1 || errno != ENOSYS)
    75 +	return result;
    76 +
    77 +      __have_no_fdatasync = 1;
    78 +    }
    79 +#endif
    80 +  return INLINE_SYSCALL (fsync, 1, fd);
    81 +}
    82 +
    83 +int
    84 +__fdatasync (int fd)
    85 +{
    86 +  if (SINGLE_THREAD_P)
    87 +    return do_fdatasync (fd);
    88 +
    89 +  int oldtype = LIBC_CANCEL_ASYNC ();
    90 +
    91 +  int result = do_fdatasync (fd);
    92 +
    93 +  LIBC_CANCEL_RESET (oldtype);
    94 +
    95 +  return result;
    96 +}
    97 +
    98 +weak_alias (__fdatasync, fdatasync)
    99 +
   100 diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.10.1/sysdeps/unix/sysv/linux/kernel-features.h
   101 --- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/kernel-features.h	2009-11-13 00:50:45.000000000 +0100
   102 +++ glibc-2.10.1/sysdeps/unix/sysv/linux/kernel-features.h	2009-11-13 00:51:04.000000000 +0100
   103 @@ -479,6 +479,12 @@
   104  # define __ASSUME_FUTEX_LOCK_PI	1
   105  #endif
   106  
   107 +/* Support for fsyncdata syscall was added in 2.6.22 on alpha, but it
   108 +   was already present in 2.0 kernels on other architectures.  */
   109 +#if (!defined __alpha || __LINUX_KERNEL_VERSION >= 0x020616)
   110 +# define __ASSUME_FDATASYNC	1
   111 +#endif
   112 +
   113  /* Support for utimensat syscall was added in 2.6.22, on alpha and s390
   114     only after 2.6.22-rc1.  */
   115  #if __LINUX_KERNEL_VERSION >= 0x020616 \
   116 diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/syscalls.list glibc-2.10.1/sysdeps/unix/sysv/linux/syscalls.list
   117 --- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/syscalls.list	2008-08-02 01:29:08.000000000 +0200
   118 +++ glibc-2.10.1/sysdeps/unix/sysv/linux/syscalls.list	2009-11-13 00:51:04.000000000 +0100
   119 @@ -11,7 +11,6 @@
   120  epoll_create1	EXTRA	epoll_create1	i:i	epoll_create1
   121  epoll_ctl	EXTRA	epoll_ctl	i:iiip	epoll_ctl
   122  epoll_wait	EXTRA	epoll_wait	Ci:ipii	epoll_wait
   123 -fdatasync	-	fdatasync	Ci:i	fdatasync
   124  flock		-	flock		i:ii	__flock		flock
   125  fork		-	fork		i:	__libc_fork	__fork fork
   126  get_kernel_syms	EXTRA	get_kernel_syms	i:p	get_kernel_syms