Download raw body.
sys/tmpfs: use getnanotime() like FFS and MFS for
tech@,
I'd like to fix a wired race condition in tmpfs which I had discovered as as
failed lang/ruby build.
The port does:
FIX_RIPPER ?= sed -i 's/%%CFLAGS_OVERRIDE%%/${CFLAGS_OVERRIDE}/g' \
${WRKSRC}/ext/ripper/depend;
...
pre-configure:
${FIX_RIPPER}
/usr/bin/touch ${WRKSRC}/ext/ripper/ripper.c
and Makefile expects that mtime of ripper.c >= depend; and if it isn't true
it regenerates ripper.c via $(BASERUBY) ... tool/lrama/exe/lrama ... where
BASERUBY is ./tool/missing-baseruby.bat, so build fails.
Why ripper.c >= depend? Here the trick.
I run my bulk with pobj on tmpfs, and tmpfs uses nanotime() to update mtime,
and touch uses utimensat(UTIME_NOW) which uses getnanotime() which is
cached. And touch sets that cached time, which is smaller than current time.
So, it is quite possible that touch set time smaller, cached one.
I think the right fix is use getnanotime() instead nanotime() like FFS and
MFS.
Thougs? Ok?
Index: tmpfs_subr.c
===================================================================
RCS file: /home/cvs/src/sys/tmpfs/tmpfs_subr.c,v
diff -u -p -r1.27 tmpfs_subr.c
--- tmpfs_subr.c 12 Sep 2024 09:04:51 -0000 1.27
+++ tmpfs_subr.c 28 Mar 2026 22:03:32 -0000
@@ -1140,7 +1140,7 @@ tmpfs_update(tmpfs_node_t *node, int fla
{
struct timespec nowtm;
- nanotime(&nowtm);
+ getnanotime(&nowtm);
if (flags & TMPFS_NODE_ACCESSED) {
node->tn_atime = nowtm;
--
wbr, Kirill
sys/tmpfs: use getnanotime() like FFS and MFS for