[PATCH] SH: Fixup pread/pwrite
Kaz Kojima
kkojima@rr.iij4u.or.jp
Thu Aug 26 11:24:00 GMT 2004
Ulrich Drepper <drepper@redhat.com> wrote:
>> The pread/write* stuff of sh-linux just includes the mips one and now
>> the mips implementation uses more mips specific things like sgidefs.h
>> which doesn't exist on SH. The appended patch just copies them and
>> removes the mips specific lines from them.
>
> Yeah, but it's a copy. I would rather like to see you using the other
> files. Yet another copy means more maintenance problems. You can
> define a macro in the SH files which prevents the MIPS header from being
> included. Or maybe this is even one of the rare situations where it is
> OK to test for __mips__ or whatever the symbol gcc defines is since it
> is indeed only for mips you want these headers.
How about the patch below?
BTW, sysdeps/unix/sysv/linux/mips/pwrite64.c doesn't include sgidefs.h,
though it looks ChangeLog says pwrite64.c does.
Regards,
kaz
--
2004-08-26 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* sysdeps/unix/sysv/linux/mips/pread.c: Include sgidefs.h only if
_HAVE_NO_SGIDEFS_H isn't defined.
* sysdeps/unix/sysv/linux/mips/pwrite.c: Likewise.
* sysdeps/unix/sysv/linux/mips/pread64.c: Likewise.
* sysdeps/unix/sysv/linux/sh/pread.c: Define _HAVE_NO_SGIDEFS_H
and _MIPS_SIM.
* sysdeps/unix/sysv/linux/sh/pwrite.c: Likewise.
* sysdeps/unix/sysv/linux/sh/pread64.c: Likewise.
* sysdeps/unix/sysv/linux/sh/pwrite64.c: Likewise.
diff -u3prN ORIG/libc/sysdeps/unix/sysv/linux/mips/pread.c LOCAL/libc/sysdeps/unix/sysv/linux/mips/pread.c
--- ORIG/libc/sysdeps/unix/sysv/linux/mips/pread.c Wed Aug 25 14:41:49 2004
+++ LOCAL/libc/sysdeps/unix/sysv/linux/mips/pread.c Thu Aug 26 19:08:21 2004
@@ -28,7 +28,9 @@
#include <bp-checks.h>
#include <kernel-features.h>
+#ifndef _HAVE_NO_SGIDEFS_H
#include <sgidefs.h>
+#endif
#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
# ifdef __NR_pread
diff -u3prN ORIG/libc/sysdeps/unix/sysv/linux/mips/pread64.c LOCAL/libc/sysdeps/unix/sysv/linux/mips/pread64.c
--- ORIG/libc/sysdeps/unix/sysv/linux/mips/pread64.c Wed Aug 25 14:41:49 2004
+++ LOCAL/libc/sysdeps/unix/sysv/linux/mips/pread64.c Thu Aug 26 19:02:51 2004
@@ -27,7 +27,9 @@
#include <bp-checks.h>
#include <kernel-features.h>
+#ifndef _HAVE_NO_SGIDEFS_H
#include <sgidefs.h>
+#endif
#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
# ifdef __NR_pread
diff -u3prN ORIG/libc/sysdeps/unix/sysv/linux/mips/pwrite.c LOCAL/libc/sysdeps/unix/sysv/linux/mips/pwrite.c
--- ORIG/libc/sysdeps/unix/sysv/linux/mips/pwrite.c Wed Aug 25 14:41:49 2004
+++ LOCAL/libc/sysdeps/unix/sysv/linux/mips/pwrite.c Thu Aug 26 19:02:34 2004
@@ -28,7 +28,9 @@
#include <bp-checks.h>
#include <kernel-features.h>
+#ifndef _HAVE_NO_SGIDEFS_H
#include <sgidefs.h>
+#endif
#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
# ifdef __NR_pwrite
diff -u3prN ORIG/libc/sysdeps/unix/sysv/linux/sh/pread.c LOCAL/libc/sysdeps/unix/sysv/linux/sh/pread.c
--- ORIG/libc/sysdeps/unix/sysv/linux/sh/pread.c Thu Feb 20 14:22:52 2003
+++ LOCAL/libc/sysdeps/unix/sysv/linux/sh/pread.c Thu Aug 26 19:41:56 2004
@@ -1 +1,3 @@
+#define _HAVE_NO_SGIDEFS_H
+#define _MIPS_SIM -1
#include <sysdeps/unix/sysv/linux/mips/pread.c>
diff -u3prN ORIG/libc/sysdeps/unix/sysv/linux/sh/pread64.c LOCAL/libc/sysdeps/unix/sysv/linux/sh/pread64.c
--- ORIG/libc/sysdeps/unix/sysv/linux/sh/pread64.c Thu Feb 20 14:23:52 2003
+++ LOCAL/libc/sysdeps/unix/sysv/linux/sh/pread64.c Thu Aug 26 19:42:24 2004
@@ -1 +1,3 @@
+#define _HAVE_NO_SGIDEFS_H
+#define _MIPS_SIM -1
#include <sysdeps/unix/sysv/linux/mips/pread64.c>
diff -u3prN ORIG/libc/sysdeps/unix/sysv/linux/sh/pwrite.c LOCAL/libc/sysdeps/unix/sysv/linux/sh/pwrite.c
--- ORIG/libc/sysdeps/unix/sysv/linux/sh/pwrite.c Thu Feb 20 14:24:07 2003
+++ LOCAL/libc/sysdeps/unix/sysv/linux/sh/pwrite.c Thu Aug 26 19:41:22 2004
@@ -1 +1,3 @@
+#define _HAVE_NO_SGIDEFS_H
+#define _MIPS_SIM -1
#include <sysdeps/unix/sysv/linux/mips/pwrite.c>
diff -u3prN ORIG/libc/sysdeps/unix/sysv/linux/sh/pwrite64.c LOCAL/libc/sysdeps/unix/sysv/linux/sh/pwrite64.c
--- ORIG/libc/sysdeps/unix/sysv/linux/sh/pwrite64.c Thu Feb 20 14:24:23 2003
+++ LOCAL/libc/sysdeps/unix/sysv/linux/sh/pwrite64.c Thu Aug 26 19:41:38 2004
@@ -1 +1,3 @@
+#define _HAVE_NO_SGIDEFS_H
+#define _MIPS_SIM -1
#include <sysdeps/unix/sysv/linux/mips/pwrite64.c>
More information about the Libc-hacker
mailing list