[PATCH] pread/pwrite fix for s390-64.
Martin Schwidefsky
schwidefsky@de.ibm.com
Thu Feb 27 18:28:00 GMT 2003
Hi,
the current cvs head does not compile on s390-64. I had to
add files for pread, pread64, pwrite and pwrite64 in the
s390-64 sysdeps folder to get the alias/hidden definitions
right. I don't know if there is a better solution, this at least
works.
blue skies,
Martin.
2003-02-27 Martin Schwidefsky <schwidefsky@de.ibm.com>
* sysdeps/unix/sysv/linux/s390/s390-64/pread.c: New file.
* sysdeps/unix/sysv/linux/s390/s390-64/pwrite.c: New file.
* sysdeps/unix/sysv/linux/s390/s390-64/pread64.c: Replace empty file
with real implementation.
* sysdeps/unix/sysv/linux/s390/s390-64/pwrite64.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list: Remove pread
and pwrite entries.
diff -urN libc/sysdeps/unix/sysv/linux/s390/s390-64/pread.c libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/pread.c
--- libc/sysdeps/unix/sysv/linux/s390/s390-64/pread.c Thu Jan 1 01:00:00 1970
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/pread.c Wed Feb 26 12:54:23 2003
@@ -0,0 +1,57 @@
+/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <unistd.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include "kernel-features.h"
+
+ssize_t
+__libc_pread (fd, buf, count, offset)
+ int fd;
+ void *buf;
+ size_t count;
+ off_t offset;
+{
+ ssize_t result;
+
+ if (SINGLE_THREAD_P)
+ {
+ result = INLINE_SYSCALL (pread64, 4, fd, CHECK_N (buf, count), count,
+ offset);
+ return result;
+ }
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ result = INLINE_SYSCALL (pread64, 4, fd, CHECK_N (buf, count), count,
+ offset);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+
+strong_alias (__libc_pread, __pread)
+weak_alias (__libc_pread, pread)
diff -urN libc/sysdeps/unix/sysv/linux/s390/s390-64/pread64.c libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/pread64.c
--- libc/sysdeps/unix/sysv/linux/s390/s390-64/pread64.c Fri Mar 16 10:48:35 2001
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/pread64.c Wed Feb 26 13:03:20 2003
@@ -1 +1,57 @@
-/* Empty since the pread syscall is equivalent. */
+/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <unistd.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include "kernel-features.h"
+
+ssize_t
+__libc_pread64 (fd, buf, count, offset)
+ int fd;
+ void *buf;
+ size_t count;
+ off64_t offset;
+{
+ ssize_t result;
+
+ if (SINGLE_THREAD_P)
+ {
+ result = INLINE_SYSCALL (pread64, 4, fd, CHECK_N (buf, count), count,
+ offset);
+ return result;
+ }
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ result = INLINE_SYSCALL (pread64, 4, fd, CHECK_N (buf, count), count,
+ offset);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+
+weak_alias (__libc_pread64, __pread64)
+weak_alias (__libc_pread64, pread64)
diff -urN libc/sysdeps/unix/sysv/linux/s390/s390-64/pwrite.c libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/pwrite.c
--- libc/sysdeps/unix/sysv/linux/s390/s390-64/pwrite.c Thu Jan 1 01:00:00 1970
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/pwrite.c Wed Feb 26 12:54:23 2003
@@ -0,0 +1,58 @@
+/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <unistd.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include "kernel-features.h"
+
+ssize_t
+__libc_pwrite (fd, buf, count, offset)
+ int fd;
+ const void *buf;
+ size_t count;
+ off_t offset;
+{
+ ssize_t result;
+
+ if (SINGLE_THREAD_P)
+ {
+ result = INLINE_SYSCALL (pwrite64, 4, fd, CHECK_N (buf, count), count,
+ offset);
+ return result;
+ }
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ result = INLINE_SYSCALL (pwrite64, 4, fd, CHECK_N (buf, count), count,
+ offset);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+
+strong_alias (__libc_pwrite, __pwrite)
+weak_alias (__libc_pwrite, pwrite)
+
diff -urN libc/sysdeps/unix/sysv/linux/s390/s390-64/pwrite64.c libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/pwrite64.c
--- libc/sysdeps/unix/sysv/linux/s390/s390-64/pwrite64.c Fri Mar 16 10:48:47 2001
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/pwrite64.c Wed Feb 26 13:03:35 2003
@@ -1 +1,58 @@
-/* Empty since the pwrite syscall is equivalent. */
+/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <unistd.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include "kernel-features.h"
+
+ssize_t
+__libc_pwrite64 (fd, buf, count, offset)
+ int fd;
+ const void *buf;
+ size_t count;
+ off64_t offset;
+{
+ ssize_t result;
+
+ if (SINGLE_THREAD_P)
+ {
+ result = INLINE_SYSCALL (pwrite64, 4, fd, CHECK_N (buf, count), count,
+ offset);
+ return result;
+ }
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ result = INLINE_SYSCALL (pwrite64, 4, fd, CHECK_N (buf, count), count,
+ offset);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+
+weak_alias (__libc_pwrite64, __pwrite64)
+weak_alias (__libc_pwrite64, pwrite64)
+
diff -urN libc/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
--- libc/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list Fri Feb 7 09:09:14 2003
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list Wed Feb 26 12:54:46 2003
@@ -2,8 +2,6 @@
llseek EXTRA lseek C:3 __libc_lseek __lseek lseek __libc_lseek64 __llseek llseek __lseek64 lseek64
lseek llseek -
-pread - pread C:4 __libc_pread __libc_pread64 __pread pread __pread64 pread64
-pwrite - pwrite C:4 __libc_pwrite __libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
fstatfs - fstatfs i:ip __fstatfs fstatfs fstatfs64 __fstatfs64
statfs - statfs i:sp __statfs statfs statfs64
getpeername - getpeername i:ipp __getpeername getpeername
More information about the Libc-hacker
mailing list