This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

Add support for nanoseconds


I'd like to add support for nanoseconds to stat in the simulator:

Index: sim/common/configure.ac
===================================================================
--- sim/common/configure.ac	(revision 1988)
+++ sim/common/configure.ac	(working copy)
@@ -42,7 +42,9 @@ AC_CHECK_MEMBERS([[struct stat.st_dev],
 [struct stat.st_mode], [struct stat.st_nlink], [struct stat.st_uid],
 [struct stat.st_gid], [struct stat.st_rdev], [struct stat.st_size],
 [struct stat.st_blksize], [struct stat.st_blocks], [struct stat.st_atime],
-[struct stat.st_mtime], [struct stat.st_ctime]], [], [],
+[struct stat.st_mtime], [struct stat.st_ctime], [struct stat.st_atimensec],
+[struct stat.st_mtimensec], [struct stat.st_ctimensec], [struct stat.st_atim.tv_nsec],
+[struct stat.st_mtim.tv_nsec], [struct stat.st_ctim.tv_nsec]], [], [],
 [[#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
Index: sim/common/config.in
===================================================================
--- sim/common/config.in	(revision 1988)
+++ sim/common/config.in	(working copy)
@@ -64,6 +64,12 @@
 /* Define to 1 if `struct stat' is a member of `st_atime'. */
 #undef HAVE_STRUCT_STAT_ST_ATIME
 
+/* Define to 1 if `struct stat' is a member of `st_atimensec'. */
+#undef HAVE_STRUCT_STAT_ST_ATIMENSEC
+
+/* Define to 1 if `struct stat' is a member of `st_atim.tv_nsec'. */
+#undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
+
 /* Define to 1 if `struct stat' is a member of `st_blksize'. */
 #undef HAVE_STRUCT_STAT_ST_BLKSIZE
 
@@ -73,6 +79,12 @@
 /* Define to 1 if `struct stat' is a member of `st_ctime'. */
 #undef HAVE_STRUCT_STAT_ST_CTIME
 
+/* Define to 1 if `struct stat' is a member of `st_ctimensec'. */
+#undef HAVE_STRUCT_STAT_ST_CTIMENSEC
+
+/* Define to 1 if `struct stat' is a member of `st_ctim.tv_nsec'. */
+#undef HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC
+
 /* Define to 1 if `struct stat' is a member of `st_dev'. */
 #undef HAVE_STRUCT_STAT_ST_DEV
 
@@ -88,6 +100,12 @@
 /* Define to 1 if `struct stat' is a member of `st_mtime'. */
 #undef HAVE_STRUCT_STAT_ST_MTIME
 
+/* Define to 1 if `struct stat' is a member of `st_mtimensec'. */
+#undef HAVE_STRUCT_STAT_ST_MTIMENSEC
+
+/* Define to 1 if `struct stat' is a member of `st_mtim.tv_nsec'. */
+#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
+
 /* Define to 1 if `struct stat' is a member of `st_nlink'. */
 #undef HAVE_STRUCT_STAT_ST_NLINK
 
Index: sim/common/callback.c
===================================================================
--- sim/common/callback.c	(revision 1988)
+++ sim/common/callback.c	(working copy)
@@ -1166,12 +1166,30 @@ cb_host_to_target_stat (cb, hs, ts)
 #ifdef HAVE_STRUCT_STAT_ST_ATIME
 	  ST_x (st_atime);
 #endif
+#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
+	  ST_x (st_atim.tv_nsec);
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_ATIMENSEC
+	  ST_x (st_atimensec);
+#endif
 #ifdef HAVE_STRUCT_STAT_ST_MTIME
 	  ST_x (st_mtime);
 #endif
+#ifdef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
+	  ST_x (st_mtim.tv_nsec);
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_MTIMENSEC
+	  ST_x (st_mtimensec);
+#endif
 #ifdef HAVE_STRUCT_STAT_ST_CTIME
 	  ST_x (st_ctime);
 #endif
+#ifdef HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC
+	  ST_x (st_ctim.tv_nsec);
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_CTIMENSEC
+	  ST_x (st_ctimensec);
+#endif
 #undef ST_x
 	  /* FIXME:wip */
 	  else


This patch might be dependent upon a nanosecond patch to newlib, though, I think it is safe without it.  I didn't include the sim/common/configure patch, as it just needs to be regenerated.  The names used come from linux.  With this patch, I have working nanosecond support in my port.


Attachment: b1.patch.txt
Description: Text document


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