This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
MIPS N64 kernel_stat fix
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: libc-alpha at sourceware dot org
- Date: Thu, 25 May 2006 12:44:51 +0000 (UTC)
- Subject: MIPS N64 kernel_stat fix
The Linux kernel stat structure for MIPS always uses 32-bit fields for
seconds and nanoseconds, even on N64 where the userspace timespec
structure uses 64-bit fields, so you can't use struct timespec in struct
kernel_stat. This patch makes kernel_stat use individual 32-bit fields
again. Tested mips64el-linux (O32, N32, N64).
2006-05-25 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/mips/kernel_stat.h (struct kernel_stat):
Don't use struct timespec.
* sysdeps/unix/sysv/linux/mips/xstatconv.c (__xstat_conv,
__xstat64_conv): Copy individual timespec fields.
Index: sysdeps/unix/sysv/linux/mips/kernel_stat.h
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/mips/kernel_stat.h,v
retrieving revision 1.7
diff -u -p -r1.7 kernel_stat.h
--- sysdeps/unix/sysv/linux/mips/kernel_stat.h 8 May 2006 19:23:37 -0000 1.7
+++ sysdeps/unix/sysv/linux/mips/kernel_stat.h 24 May 2006 21:32:57 -0000
@@ -16,9 +16,12 @@ struct kernel_stat
unsigned int st_rdev;
unsigned int __pad2[3];
long long st_size;
- struct timespec st_atim;
- struct timespec st_mtim;
- struct timespec st_ctim;
+ unsigned int st_atime_sec;
+ unsigned int st_atime_nsec;
+ unsigned int st_mtime_sec;
+ unsigned int st_mtime_nsec;
+ unsigned int st_ctime_sec;
+ unsigned int st_ctime_nsec;
unsigned int st_blksize;
unsigned int __pad3;
unsigned long long st_blocks;
@@ -37,9 +40,12 @@ struct kernel_stat
long int __pad2[2];
long int st_size;
long int __pad3;
- struct timespec st_atim;
- struct timespec st_mtim;
- struct timespec st_ctim;
+ unsigned int st_atime_sec;
+ unsigned int st_atime_nsec;
+ unsigned int st_mtime_sec;
+ unsigned int st_mtime_nsec;
+ unsigned int st_ctime_sec;
+ unsigned int st_ctime_nsec;
long int st_blksize;
long int st_blocks;
char st_fstype[16]; /* Filesystem type name, unsupported */
Index: sysdeps/unix/sysv/linux/mips/xstatconv.c
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/mips/xstatconv.c,v
retrieving revision 1.5
diff -u -p -r1.5 xstatconv.c
--- sysdeps/unix/sysv/linux/mips/xstatconv.c 8 May 2006 19:23:37 -0000 1.5
+++ sysdeps/unix/sysv/linux/mips/xstatconv.c 24 May 2006 21:32:57 -0000
@@ -62,9 +62,12 @@ __xstat_conv (int vers, struct kernel_st
buf->st_blksize = kbuf->st_blksize;
buf->st_blocks = kbuf->st_blocks;
- buf->st_atim = kbuf->st_atim;
- buf->st_mtim = kbuf->st_mtim;
- buf->st_ctim = kbuf->st_ctim;
+ buf->st_atim.tv_sec = kbuf->st_atime_sec;
+ buf->st_atim.tv_nsec = kbuf->st_atime_nsec;
+ buf->st_mtim.tv_sec = kbuf->st_mtime_sec;
+ buf->st_mtim.tv_nsec = kbuf->st_mtime_nsec;
+ buf->st_ctim.tv_sec = kbuf->st_ctime_sec;
+ buf->st_ctim.tv_nsec = kbuf->st_ctime_nsec;
buf->st_pad5[0] = 0; buf->st_pad5[1] = 0;
buf->st_pad5[2] = 0; buf->st_pad5[3] = 0;
@@ -107,9 +110,12 @@ __xstat64_conv (int vers, struct kernel_
buf->st_blksize = kbuf->st_blksize;
buf->st_blocks = kbuf->st_blocks;
- buf->st_atim = kbuf->st_atim;
- buf->st_mtim = kbuf->st_mtim;
- buf->st_ctim = kbuf->st_ctim;
+ buf->st_atim.tv_sec = kbuf->st_atime_sec;
+ buf->st_atim.tv_nsec = kbuf->st_atime_nsec;
+ buf->st_mtim.tv_sec = kbuf->st_mtime_sec;
+ buf->st_mtim.tv_nsec = kbuf->st_mtime_nsec;
+ buf->st_ctim.tv_sec = kbuf->st_ctime_sec;
+ buf->st_ctim.tv_nsec = kbuf->st_ctime_nsec;
buf->st_pad4[0] = 0; buf->st_pad4[1] = 0;
buf->st_pad4[2] = 0; buf->st_pad4[3] = 0;
--
Joseph S. Myers
joseph@codesourcery.com