1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/glibc/ports-2.12.1/490-alpha_alpha-add-fdatasync-support.patch Mon Feb 13 22:18:02 2012 +0100
1.3 @@ -0,0 +1,126 @@
1.4 +2009-07-25 Aurelien Jarno <aurelien@aurel32.net>
1.5 +
1.6 + * sysdeps/unix/sysv/linux/kernel-features.h: define
1.7 + __ASSUME_FDATASYNC.
1.8 + * sysdeps/unix/sysv/linux/fdatasync.c: New file.
1.9 + * sysdeps/unix/sysv/linux/Makefile: compile fdatasync.c with
1.10 + -fexceptions.
1.11 + * sysdeps/unix/sysv/linux/syscalls.list: Remove fdatasync.
1.12 +
1.13 + sysdeps/unix/sysv/linux/Makefile | 1
1.14 + sysdeps/unix/sysv/linux/fdatasync.c | 69 ++++++++++++++++++++++++++++++
1.15 + sysdeps/unix/sysv/linux/kernel-features.h | 6 ++
1.16 + sysdeps/unix/sysv/linux/syscalls.list | 1
1.17 + 4 files changed, 76 insertions(+), 1 deletion(-)
1.18 +
1.19 +diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/Makefile glibc-2.12.1/sysdeps/unix/sysv/linux/Makefile
1.20 +--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/Makefile 2009-03-02 17:15:13.000000000 +0100
1.21 ++++ glibc-2.12.1/sysdeps/unix/sysv/linux/Makefile 2009-11-13 00:51:04.000000000 +0100
1.22 +@@ -20,6 +20,7 @@
1.23 + setfsuid setfsgid makedev epoll_pwait signalfd \
1.24 + eventfd eventfd_read eventfd_write
1.25 +
1.26 ++CFLAGS-fdatasync.c = -fexceptions
1.27 + CFLAGS-gethostid.c = -fexceptions
1.28 +
1.29 + sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
1.30 +diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/fdatasync.c glibc-2.12.1/sysdeps/unix/sysv/linux/fdatasync.c
1.31 +--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/fdatasync.c 1970-01-01 01:00:00.000000000 +0100
1.32 ++++ glibc-2.12.1/sysdeps/unix/sysv/linux/fdatasync.c 2009-11-13 00:51:04.000000000 +0100
1.33 +@@ -0,0 +1,69 @@
1.34 ++/* fdatasync -- synchronize at least the data part of a file with
1.35 ++ the underlying media. Linux version.
1.36 ++
1.37 ++ Copyright (C) 2007 Free Software Foundation, Inc.
1.38 ++ This file is part of the GNU C Library.
1.39 ++
1.40 ++ The GNU C Library is free software; you can redistribute it and/or
1.41 ++ modify it under the terms of the GNU Lesser General Public
1.42 ++ License as published by the Free Software Foundation; either
1.43 ++ version 2.1 of the License, or (at your option) any later version.
1.44 ++
1.45 ++ The GNU C Library is distributed in the hope that it will be useful,
1.46 ++ but WITHOUT ANY WARRANTY; without even the implied warranty of
1.47 ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.48 ++ Lesser General Public License for more details.
1.49 ++
1.50 ++ You should have received a copy of the GNU Lesser General Public
1.51 ++ License along with the GNU C Library; if not, write to the Free
1.52 ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1.53 ++ 02111-1307 USA. */
1.54 ++
1.55 ++#include <errno.h>
1.56 ++#include <unistd.h>
1.57 ++
1.58 ++#include <sysdep-cancel.h>
1.59 ++#include <sys/syscall.h>
1.60 ++#include <bp-checks.h>
1.61 ++
1.62 ++#include <kernel-features.h>
1.63 ++
1.64 ++#if defined __NR_fdatasync && !defined __ASSUME_FDATASYNC
1.65 ++static int __have_no_fdatasync;
1.66 ++#endif
1.67 ++
1.68 ++static int
1.69 ++do_fdatasync (int fd)
1.70 ++{
1.71 ++#ifdef __ASSUME_FDATASYNC
1.72 ++ return INLINE_SYSCALL (fdatasync, 1, fd);
1.73 ++#elif defined __NR_fdatasync
1.74 ++ if (!__builtin_expect (__have_no_fdatasync, 0))
1.75 ++ {
1.76 ++ int result = INLINE_SYSCALL (fdatasync, 1, fd);
1.77 ++ if (__builtin_expect (result, 0) != -1 || errno != ENOSYS)
1.78 ++ return result;
1.79 ++
1.80 ++ __have_no_fdatasync = 1;
1.81 ++ }
1.82 ++#endif
1.83 ++ return INLINE_SYSCALL (fsync, 1, fd);
1.84 ++}
1.85 ++
1.86 ++int
1.87 ++__fdatasync (int fd)
1.88 ++{
1.89 ++ if (SINGLE_THREAD_P)
1.90 ++ return do_fdatasync (fd);
1.91 ++
1.92 ++ int oldtype = LIBC_CANCEL_ASYNC ();
1.93 ++
1.94 ++ int result = do_fdatasync (fd);
1.95 ++
1.96 ++ LIBC_CANCEL_RESET (oldtype);
1.97 ++
1.98 ++ return result;
1.99 ++}
1.100 ++
1.101 ++weak_alias (__fdatasync, fdatasync)
1.102 ++
1.103 +diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.12.1/sysdeps/unix/sysv/linux/kernel-features.h
1.104 +--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
1.105 ++++ glibc-2.12.1/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:51:04.000000000 +0100
1.106 +@@ -459,6 +459,12 @@
1.107 + # define __ASSUME_FUTEX_LOCK_PI 1
1.108 + #endif
1.109 +
1.110 ++/* Support for fsyncdata syscall was added in 2.6.22 on alpha, but it
1.111 ++ was already present in 2.0 kernels on other architectures. */
1.112 ++#if (!defined __alpha || __LINUX_KERNEL_VERSION >= 0x020616)
1.113 ++# define __ASSUME_FDATASYNC 1
1.114 ++#endif
1.115 ++
1.116 + /* Support for utimensat syscall was added in 2.6.22, on SH
1.117 + only after 2.6.22-rc1. */
1.118 + #if __LINUX_KERNEL_VERSION >= 0x020616 \
1.119 +diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/syscalls.list glibc-2.12.1/sysdeps/unix/sysv/linux/syscalls.list
1.120 +--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/syscalls.list 2008-08-02 01:29:08.000000000 +0200
1.121 ++++ glibc-2.12.1/sysdeps/unix/sysv/linux/syscalls.list 2009-11-13 00:51:04.000000000 +0100
1.122 +@@ -11,7 +11,6 @@
1.123 + epoll_create1 EXTRA epoll_create1 i:i epoll_create1
1.124 + epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl
1.125 + epoll_wait EXTRA epoll_wait Ci:ipii epoll_wait
1.126 +-fdatasync - fdatasync Ci:i fdatasync
1.127 + flock - flock i:ii __flock flock
1.128 + fork - fork i: __libc_fork __fork fork
1.129 + get_kernel_syms EXTRA get_kernel_syms i:p get_kernel_syms