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
This commit is contained in:
Ed Maste 2019-03-18 19:23:19 +00:00
parent db7591a848
commit 1a01705458
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345280

View File

@ -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. */