--- /n/sources/plan9/sys/src/cmd/unix/u9fs/plan9.h Mon Sep 17 21:23:57 2012 +++ /sys/src/cmd/unix/u9fs/plan9.h Tue Aug 4 00:00:00 2026 @@ -45,6 +45,19 @@ typedef unsigned long long int uint64_t; #include /* for memmove */ #include /* for write */ #include +#include /* for the mtime fields of struct stat */ + +/* + * st_mtime alone is too coarse to version a qid: a rewrite in place + * within the second would keep it, and clients cache contents by qid. + */ +#if defined(__APPLE__) +#define MTIMENSEC(st) ((st)->st_mtimespec.tv_nsec) +#elif defined(st_mtime) /* the POSIX 2008 timespec members */ +#define MTIMENSEC(st) ((st)->st_mtim.tv_nsec) +#else +#define MTIMENSEC(st) 0 +#endif #define ulong p9ulong /* because sys/types.h has some of these sometimes */ #define ushort p9ushort --- /n/sources/plan9/sys/src/cmd/unix/u9fs/u9fs.c Fri Jul 29 22:16:34 2011 +++ /sys/src/cmd/unix/u9fs/u9fs.c Tue Aug 4 00:00:00 2026 @@ -651,7 +651,7 @@ stat2qid(struct stat *st) *(dev_t*)q ^= st->st_dev; } - qid.vers = st->st_mtime ^ (st->st_size << 8); + qid.vers = MTIMENSEC(st) ^ st->st_mtime ^ (st->st_size << 8); qid.type = modebyte(st); return qid; }