This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports 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]

Declare MIPS stat nanoseconds fields similarly to other architectures


I noticed that the MIPS bits/stat.h was different from other architectures 
in how it handled nanoseconds fields: in the case where struct timespec 
fields were not being declared, the nanoseconds were __reserved* instead 
of having st_atimensec etc. names.  I've applied this patch to make MIPS 
consistent in the API provided with other architectures.  (There are no 
layout issues since "unsigned long", the type used elsewhere for 
nanoseconds, is consistent with the type in struct timespec, and on n64 
where the fields were "int" (32-bit) and now are "unsigned long" (64-bit) 
that "int" was always followed by 32 bits of padding since both __time_t 
and __blksize_t were 64-bit in that case.)

diff --git a/ChangeLog.mips b/ChangeLog.mips
index db20a78..db16b4b 100644
--- a/ChangeLog.mips
+++ b/ChangeLog.mips
@@ -1,3 +1,11 @@
+2012-05-16  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/mips/bits/stat.h (struct stat)
+	[!__USE_MISC && !__USE_XOPEN2K8]: Declare nanoseconds fields with
+	type unsigned long and names st_atimensec, st_mtimensec and
+	st_ctimensec.
+	(struct stat64) [!__USE_MISC && !__USE_XOPEN2K8]: Likewise.
+
 2012-05-14  Joseph Myers  <joseph@codesourcery.com>
 
 	* sysdeps/unix/sysv/linux/mips/pread.c [!__ASSUME_PREAD_SYSCALL]:
diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h
index 7c30b4d..f65bae4 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/stat.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004,
-	2007, 2009, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2012 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
@@ -77,12 +76,12 @@ struct stat
 # define st_mtime st_mtim.tv_sec
 # define st_ctime st_ctim.tv_sec
 #else
-    __time_t st_atime;		/* Time of last access.  */
-    long int __reserved0;
-    __time_t st_mtime;		/* Time of last modification.  */
-    long int __reserved1;
-    __time_t st_ctime;		/* Time of last status change.  */
-    long int __reserved2;
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
 #endif
     __blksize_t st_blksize;	/* Optimal block size for I/O.  */
 #ifndef __USE_FILE_OFFSET64
@@ -118,12 +117,12 @@ struct stat64
     struct timespec st_mtim;            /* Time of last modification.  */
     struct timespec st_ctim;            /* Time of last status change.  */
 # else
-    __time_t st_atime;		/* Time of last access.  */
-    long int __reserved0;
-    __time_t st_mtime;		/* Time of last modification.  */
-    long int __reserved1;
-    __time_t st_ctime;		/* Time of last status change.  */
-    long int __reserved2;
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
 # endif
     __blksize_t st_blksize;	/* Optimal block size for I/O.  */
     long int st_pad3;
@@ -168,12 +167,12 @@ struct stat
 # define st_mtime st_mtim.tv_sec
 # define st_ctime st_ctim.tv_sec
 #else
-    __time_t st_atime;
-    int __reserved0;
-    __time_t st_mtime;
-    int __reserved1;
-    __time_t st_ctime;
-    int __reserved2;
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
 #endif
     __blksize_t st_blksize;
     unsigned int st_pad4;
@@ -209,12 +208,12 @@ struct stat64
     struct timespec st_mtim;            /* Time of last modification.  */
     struct timespec st_ctim;            /* Time of last status change.  */
 # else
-    __time_t st_atime;
-    int __reserved0;
-    __time_t st_mtime;
-    int __reserved1;
-    __time_t st_ctime;
-    int __reserved2;
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
 # endif
     __blksize_t st_blksize;
     unsigned int st_pad3;

-- 
Joseph S. Myers
joseph@codesourcery.com


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