This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: make existing mips files multi-ABI


On Apr  5, 2003, Andreas Jaeger <aj at suse dot de> wrote:

> Alexandre Oliva <aoliva at redhat dot com> writes:
>> +/* 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 */

> Please remove that comment and the last sentence of the define.

You mean, remove all of what you quoted above, along with the
enclosing #if/#endif (that would then be empty)?  I thought it would
be good to document why we can't use xstat for xstat64, since I myself
must have thought of it a number of times, and actually tried it at
least twice before believing it couldn't be used :-)

> We don't need extension here, this file is internal to glibc.

Thanks, I wasn't sure.

Fixed below.  I've also cvs added the truncate64 files mentioned in
the ChangeLog but that hadn't made it to my earlier cvs diff, so I'll
ask for approval again.  No other files were modified.  Ok?

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 16:36:46 -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 16:36:46 -0000
@@ -1,17 +1,17 @@
-/* Definition of `struct stat' used in the kernel..  */
-#if defined _ABI64 && _MIPS_SIM == _ABI64
+/* 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;
+    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;
+    long long st_size;
     unsigned int st_atime;
     unsigned int __unused1;
     unsigned int st_mtime;
@@ -20,7 +20,7 @@ struct kernel_stat
     unsigned int __unused3;
     unsigned int st_blksize;
     unsigned int __pad3;
-    unsigned long st_blocks;
+    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 16:36:46 -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.  */
Index: sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c
===================================================================
RCS file: sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c
diff -N sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c 5 Apr 2003 16:36:46 -0000
@@ -0,0 +1,28 @@
+/* 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 <sys/types.h>
+
+#include <sysdep.h>
+
+extern int ftruncate (int fd, off64_t length);
+
+int __ftruncate64 (int fd, off64_t length) {
+  return ftruncate (fd, length);
+}
+weak_alias (__ftruncate64, ftruncate64)
Index: sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c
===================================================================
RCS file: sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c
diff -N sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c 5 Apr 2003 16:36:46 -0000
@@ -0,0 +1,30 @@
+/* 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 <sys/types.h>
+
+#include <sysdep.h>
+#include <bp-checks.h>
+
+extern int truncate (const char *__unbounded path, int dummy,
+		     off64_t length);
+
+int truncate64 (const char *__unbounded path, int dummy,
+		off64_t length) {
+  return truncate (path, dummy, length);
+}
-- 
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]