Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Mar 2019 19:23:19 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345280 - head/sys/sys
Message-ID:  <201903181923.x2IJNJsm054604@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903181923.x2IJNJsm054604>