svn commit: r345280 - head/sys/sys

Ed Maste emaste at FreeBSD.org
Mon Mar 18 19:23:20 UTC 2019


Author: emaste
Date: Mon Mar 18 19:23:19 2019
New Revision: 345280
URL: https://svnweb.freebsd.org/changeset/base/345280

Log:
  sys/stat.h: Improve timespec compatibility with other BSDs
  
  OpenBSD and NetBSD provide macros to directly reference the underlying
  struct timespec's tv_nsec member.  While FreeBSD has such macros for
  tv_sec, the others are missing.  Add the following macros:
  
  st->st_atimensec
  st->st_mtimensec
  st->st_ctimensec
  st->st_birthtimensec
  
  Adding these fields will provide programs which reference them better
  portability to FreeBSD.  An example of such a program is makefs(8),
  which has unused support for subseconds that it has inherited from
  NetBSD.
  
  Submitted by:	Mitchell Horne <mhorne063 at gmail.com>
  Reviewed by:	kib
  Differential Revision:	https://reviews.freebsd.org/D19626

Modified:
  head/sys/sys/stat.h

Modified: head/sys/sys/stat.h
==============================================================================
--- head/sys/sys/stat.h	Mon Mar 18 19:21:53 2019	(r345279)
+++ head/sys/sys/stat.h	Mon Mar 18 19:23:19 2019	(r345280)
@@ -224,6 +224,10 @@ struct nstat {
 #define	st_ctime		st_ctim.tv_sec
 #if __BSD_VISIBLE
 #define	st_birthtime		st_birthtim.tv_sec
+#define	st_atimensec		st_atim.tv_nsec
+#define	st_mtimensec		st_mtim.tv_nsec
+#define	st_ctimensec		st_ctim.tv_nsec
+#define	st_birthtimensec	st_birthtim.tv_nsec
 #endif
 
 /* For compatibility. */


More information about the svn-src-head mailing list