This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: make existing mips files multi-ABI
On Apr 4, 2003, Alexandre Oliva <aoliva at redhat dot com> wrote:
> Given the constraints above, I suppose I should give up on the idea of
> avoiding the conversion functions. Oh, well, that's too bad.
Here's a patch that implements this change. It depends on a patch for
the mips64 kernel that Ralf agreed to not install before I had time to
adjust glibc, so I guess it's time to put it in now :-) Ok?
? sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c
? sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c
Index: ChangeLog
from Alexandre Oliva <aoliva at redhat dot com>
* sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c: New.
* sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c: New.
* sysdeps/unix/sysv/linux/kernel-features.h: fcntl64 is available
on mips n32.
* sysdeps/unix/sysv/linux/mips/kernel_stat.h: Explain why
XSTAT_IS_XSTAT64 must not be used for mips n64. Use 64-bit data
structure on n32 as well.
* sysdeps/unix/sysv/linux/mips/bits/stat.h: Use POSIX-compliant
data types on n32 and n64.
Index: sysdeps/unix/sysv/linux/kernel-features.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/kernel-features.h,v
retrieving revision 1.48
diff -u -p -r1.48 kernel-features.h
--- sysdeps/unix/sysv/linux/kernel-features.h 29 Mar 2003 07:24:55 -0000 1.48
+++ sysdeps/unix/sysv/linux/kernel-features.h 5 Apr 2003 01:09:03 -0000
@@ -248,6 +248,10 @@
# define __ASSUME_GETDENTS64_SYSCALL 1
#endif
+#if defined __mips__ && defined _ABIN32 && _MIPS_SIM == _ABIN32
+# define __ASSUME_FCNTL64 1
+#endif
+
/* The late 2.5 kernels saw a lot of new CLONE_* flags. Summarize
their availability with one define. The changes were made first
for i386 and the have to be done separately for the other archs.
Index: sysdeps/unix/sysv/linux/mips/kernel_stat.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/kernel_stat.h,v
retrieving revision 1.3
diff -u -p -r1.3 kernel_stat.h
--- sysdeps/unix/sysv/linux/mips/kernel_stat.h 17 Mar 2003 15:47:13 -0000 1.3
+++ sysdeps/unix/sysv/linux/mips/kernel_stat.h 5 Apr 2003 01:09:04 -0000
@@ -1,17 +1,23 @@
-/* Definition of `struct stat' used in the kernel.. */
#if defined _ABI64 && _MIPS_SIM == _ABI64
+/* As tempting as it is to define this, the userland data structures
+ are not identical, because of different padding. Perhaps they
+ should be? */
+/* # define XSTAT_IS_XSTAT64 1 */
+#endif
+/* Definition of `struct stat' used in the kernel. */
+#if _MIPS_SIM != _MIPS_SIM_ABI32
struct kernel_stat
{
unsigned int st_dev;
unsigned int __pad1[3];
- unsigned long st_ino;
+ __extension__ unsigned long long st_ino;
unsigned int st_mode;
unsigned int st_nlink;
int st_uid;
int st_gid;
unsigned int st_rdev;
unsigned int __pad2[3];
- long st_size;
+ __extension__ long long st_size;
unsigned int st_atime;
unsigned int __unused1;
unsigned int st_mtime;
@@ -20,7 +26,7 @@ struct kernel_stat
unsigned int __unused3;
unsigned int st_blksize;
unsigned int __pad3;
- unsigned long st_blocks;
+ __extension__ unsigned long long st_blocks;
};
#else
struct kernel_stat
Index: sysdeps/unix/sysv/linux/mips/bits/stat.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/bits/stat.h,v
retrieving revision 1.12
diff -u -p -r1.12 stat.h
--- sysdeps/unix/sysv/linux/mips/bits/stat.h 6 Jul 2001 04:56:18 -0000 1.12
+++ sysdeps/unix/sysv/linux/mips/bits/stat.h 5 Apr 2003 01:09:04 -0000
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 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
@@ -33,6 +34,7 @@
#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
+#if _MIPS_SIM == _MIPS_SIM_ABI32
/* Structure describing file characteristics. */
struct stat
{
@@ -105,6 +107,71 @@ struct stat64
__blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
long int st_pad4[14];
};
+#endif
+#else
+struct stat
+ {
+ __dev_t st_dev;
+ int st_pad1[3]; /* Reserved for st_dev expansion */
+#ifndef __USE_FILE_OFFSET64
+ __ino_t st_ino;
+#else
+ __ino64_t st_ino;
+#endif
+ __mode_t st_mode;
+ __nlink_t st_nlink;
+ __uid_t st_uid;
+ __gid_t st_gid;
+ __dev_t st_rdev;
+#if !defined __USE_FILE_OFFSET64
+ unsigned int st_pad2[2]; /* Reserved for st_rdev expansion */
+ __off_t st_size;
+ int st_pad3;
+#else
+ unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */
+ __off64_t st_size;
+#endif
+ __time_t st_atime;
+ int __reserved0;
+ __time_t st_mtime;
+ int __reserved1;
+ __time_t st_ctime;
+ int __reserved2;
+ __blksize_t st_blksize;
+ unsigned int st_pad4;
+#ifndef __USE_FILE_OFFSET64
+ __blkcnt_t st_blocks;
+#else
+ __blkcnt64_t st_blocks;
+#endif
+ int st_pad5[14];
+ };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+ {
+ __dev_t st_dev;
+ unsigned int st_pad1[3]; /* Reserved for st_dev expansion */
+ __ino64_t st_ino;
+ __mode_t st_mode;
+ __nlink_t st_nlink;
+ __uid_t st_uid;
+ __gid_t st_gid;
+ __dev_t st_rdev;
+ unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */
+ __off64_t st_size;
+ __time_t st_atime;
+ int __reserved0;
+ __time_t st_mtime;
+ int __reserved1;
+ __time_t st_ctime;
+ int __reserved2;
+ __blksize_t st_blksize;
+ unsigned int st_pad3;
+ __blkcnt64_t st_blocks;
+ int st_pad4[14];
+};
+#endif
#endif
/* Tell code we have these members. */
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist Professional serial bug killer