This is an automated email from the ASF dual-hosted git repository.
GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 4ba1726fbc6 fs/vfs: update atime when reading a pseudo directory
4ba1726fbc6 is described below
commit 4ba1726fbc66b03ef7365ca7460d629be393f85e
Author: v-liuchenxu3 <[email protected]>
AuthorDate: Wed Nov 11 15:31:17 2026 +0800
fs/vfs: update atime when reading a pseudo directory
POSIX says readdir() marks the last data access time of the directory
for update. With CONFIG_PSEUDOFS_ATTRIBUTES the pseudo file system keeps
i_atime and reports it through stat(), but dir_read() never updated it
for pseudo directories. Update it after reading an entry.
Signed-off-by: v-liuchenxu3 <[email protected]>
Signed-off-by: jingfei <[email protected]>
---
fs/vfs/fs_dir.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/vfs/fs_dir.c b/fs/vfs/fs_dir.c
index c21eb72428f..795ba09e913 100644
--- a/fs/vfs/fs_dir.c
+++ b/fs/vfs/fs_dir.c
@@ -525,6 +525,9 @@ static ssize_t dir_read(FAR struct file *filep, FAR char
*buffer,
/* The node is part of the root pseudo file system */
ret = read_pseudodir(dir, entry);
+#ifdef CONFIG_PSEUDOFS_ATTRIBUTES
+ nxclock_gettime(CLOCK_REALTIME, &dir->fd_root->i_atime);
+#endif
}
/* ret < 0 is an error. Special case: ret = -ENOENT is end of file */