1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-16 10:14:35 +00:00

sys/tmpfs: use getnanotime() like FFS and MFS

Editing files on tmpfs uses nanotime() to update mtime, and touch uses
utimensat(UTIME_NOW) which uses getnanotime() which is cached and which
can be smaller.

So, sed ... A && touch B leads to mtime(A) > mtime(B) which isn't excted.

"Yep" deraadt@
This commit is contained in:
kirill
2026-03-29 09:37:33 +00:00
parent 6b1826a526
commit 2bea9c5040

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: tmpfs_subr.c,v 1.27 2024/09/12 09:04:51 claudio Exp $ */
/* $OpenBSD: tmpfs_subr.c,v 1.28 2026/03/29 09:37:33 kirill Exp $ */
/* $NetBSD: tmpfs_subr.c,v 1.79 2012/03/13 18:40:50 elad Exp $ */
/*
@@ -1140,7 +1140,7 @@ tmpfs_update(tmpfs_node_t *node, int flags)
{
struct timespec nowtm;
nanotime(&nowtm);
getnanotime(&nowtm);
if (flags & TMPFS_NODE_ACCESSED) {
node->tn_atime = nowtm;