summaryrefslogtreecommitdiff
path: root/patches/glibc/2.3.3/glibc-2.3.3-s390-fadvise64.patch
blob: 9f217445501ce42ba69bcd17cc93e3011b04f715 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
See http://sources.redhat.com/ml/libc-hacker/2003-12/msg00023.html
or http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c?cvsroot=glibc

Should fix error 

../sysdeps/unix/sysv/linux/posix_fadvise64.c: In function `__posix_fadvise64_l64':
../sysdeps/unix/sysv/linux/posix_fadvise64.c:35: warning: implicit declaration of function `DECLARGS_6'
../sysdeps/unix/sysv/linux/posix_fadvise64.c:35: error: parse error before "register"
...
../sysdeps/unix/sysv/linux/posix_fadvise64.c:35: error: parse error before "ASMFMT_6"
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


From: Martin Schwidefsky <schwidefsky at de dot ibm dot com>
Organization: IBM Deutschland GmbH
To: libc-hacker at sources dot redhat dot com
Subject: fadvise64_64 for s390-32.
Date: Fri, 5 Dec 2003 18:46:33 +0100

Hi,
on s390* system calls can have up to 5 paramters. The generic linux
implemenation of fadvise64_64 for 32 bit systems needs 6 parameters,
so we need to have a s390-32 special version of posix_fadvise64.c.
For s390-64 we do not have the problem because there fadvise64_64
has only 4 parameters.

blue skies,
  Martin.

2003-12-05  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c: New file.

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
--- libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c	1970-01-01 01:00:00.000000000 +0100
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c	2003-11-13 15:31:40.000000000 +0100
@@ -0,0 +1,90 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sysdep.h>
+#include <kernel-features.h>
+
+int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise);
+int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise);
+
+/* Advice the system about the expected behaviour of the application with
+   respect to the file associated with FD.  */
+
+struct fadvise64_64_layout
+{
+  int fd;
+  off64_t offset;
+  off64_t len;
+  int advise;
+};
+
+int
+__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
+{
+#ifdef __NR_fadvise64_64
+  struct fadvise64_64_layout parameters;
+  INTERNAL_SYSCALL_DECL (err);
+  
+  parameters.fd = fd;
+  parameters.offset = offset;
+  parameters.len = len;
+  parameters.advise = advise;
+  int ret = INTERNAL_SYSCALL (fadvise64_64, err, 1, &parameters);
+  if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
+    return 0;
+# ifndef __ASSUME_FADVISE64_64_SYSCALL
+  if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS)
+# endif
+   return INTERNAL_SYSCALL_ERRNO (ret, err);
+#endif
+#ifndef __ASSUME_FADVISE64_64_SYSCALL
+# ifdef __NR_fadvise64
+  if (len != (off_t) len)
+    return EOVERFLOW;
+
+  INTERNAL_SYSCALL_DECL (err2);
+  int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 5, fd,
+			       __LONG_LONG_PAIR ((long) (offset >> 32),
+						 (long) offset),
+			       (off_t) len, advise);
+  if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2))
+    return 0;
+  return INTERNAL_SYSCALL_ERRNO (ret2, err2);
+# else
+  return ENOSYS;
+# endif
+#endif
+}
+
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)
+
+int
+__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise)
+{
+  return __posix_fadvise64_l64 (fd, offset, len, advise);
+}
+
+versioned_symbol (libc, __posix_fadvise64_l64, posix_fadvise64, GLIBC_2_3_3);
+compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2);
+#else
+strong_alias (__posix_fadvise64_l64, posix_fadvise64);
+#endif