* Add support for nanoseconds
@ 2012-01-12 20:36 Mike Stump
2012-01-24 5:49 ` Mike Frysinger
0 siblings, 1 reply; 2+ messages in thread
From: Mike Stump @ 2012-01-12 20:36 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 3675 bytes --]
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 #2: b1.patch.txt --]
[-- Type: text/plain, Size: 3310 bytes --]
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Add support for nanoseconds
2012-01-12 20:36 Add support for nanoseconds Mike Stump
@ 2012-01-24 5:49 ` Mike Frysinger
0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2012-01-24 5:49 UTC (permalink / raw)
To: gdb-patches; +Cc: Mike Stump
[-- Attachment #1: Type: Text/Plain, Size: 1396 bytes --]
On Thursday 12 January 2012 14:54:39 Mike Stump wrote:
> I'd like to add support for nanoseconds to stat in the simulator:
idea is good by me
> --- sim/common/config.in (revision 1988)
> +++ sim/common/config.in (working copy)
this file is autogenerated too, so you don't need to include that in your diffs
> --- sim/common/callback.c (revision 1988)
> +++ sim/common/callback.c (working copy)
>
> +#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
i'm not sure about this part. if the host where the sim runs has
"st_atim.tv_nsec", but the target code uses "st_atimensec", the field won't get
translated. it'd only work if they both use the same name.
let's go with "st_atimensec" always being the translation name. so we'd keep
these ones:
#ifdef HAVE_STRUCT_STAT_ST_ATIMENSEC
ST_x (st_atimensec);
#endif
but we'll have to add a new helper for the others. maybe:
#undef ST_xx
#define ST_xx(HFLD, TFLD) \
else if (strncmp (m, #TFLD, q - m) == 0) \
cb_store_target_endian (cb, p, size, hs->HFLD)
#undef ST_x
#define ST_x(FLD) ST_xx(FLD, FLD)
and then you'd do:
#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
ST_xx (st_atim.tv_nsec, st_atimensec);
#endif
could you give that a spin ?
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-24 4:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-12 20:36 Add support for nanoseconds Mike Stump
2012-01-24 5:49 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).