#define _STAT_VER 0
#endif
-#if _LARGEFILE64_SOURCE
+#ifdef _LARGEFILE64_SOURCE
static void
convstat(struct stat64 *st64_buf, struct stat *st_buf)
{
struct file *fil;
int err;
struct intnl_stat *buf;
-#if _LARGEFILE64_SOURCE
+#ifdef _LARGEFILE64_SOURCE
struct stat64 st64;
#endif
SYSIO_INTERFACE_DISPLAY_BLOCK;
err = -EBADF;
goto out;
}
-#if _LARGEFILE64_SOURCE
+#ifdef _LARGEFILE64_SOURCE
buf = &st64;
#else
buf = __stat_buf;
#endif
+ /*
+ * Never use the attributes cached in the inode record. Give the
+ * driver a chance to refresh them.
+ */
err =
fil->f_ino->i_ops.inop_getattr(NULL, fil->f_ino, buf);
-#if _LARGEFILE64_SOURCE
+#ifdef _LARGEFILE64_SOURCE
if (!err)
convstat(buf, __stat_buf);
#endif
int err;
struct pnode *pno;
struct inode *ino;
- struct intnl_stat *buf;
-#if _LARGEFILE64_SOURCE
- struct stat64 st64;
-#endif
SYSIO_INTERFACE_DISPLAY_BLOCK;
SYSIO_INTERFACE_ENTER;
err = _sysio_namei(_sysio_cwd, __filename, 0, &intent, &pno);
if (err)
goto out;
+ /*
+ * Leverage the INT_GETATTR intent above. We are counting
+ * on the FS driver to either make sure the attributes cached in
+ * the inode are always correct or refresh them in the lookup, above.
+ */
ino = pno->p_base->pb_ino;
-#if _LARGEFILE64_SOURCE
- buf = &st64;
+#ifdef _LARGEFILE64_SOURCE
+ convstat(&ino->i_stbuf, __stat_buf);
#else
- buf = __stat_buf;
+ (void )memcpy(__stat_buf, &ino->i_stbuf, sizeof(struct intnl_stat));
#endif
- err =
- ino->i_ops.inop_getattr(pno,
- pno->p_base->pb_ino,
- buf);
-
P_RELE(pno);
-#if _LARGEFILE64_SOURCE
- if (!err)
- convstat(buf, __stat_buf);
-#endif
out:
SYSIO_INTERFACE_RETURN(err ? -1 : 0, err);
}
int err;
struct pnode *pno;
struct inode *ino;
- struct intnl_stat *buf;
-#if _LARGEFILE64_SOURCE
- struct stat64 st64;
-#endif
SYSIO_INTERFACE_DISPLAY_BLOCK;
SYSIO_INTERFACE_ENTER;
err = _sysio_namei(_sysio_cwd, __filename, ND_NOFOLLOW, &intent, &pno);
if (err)
goto out;
-#if _LARGEFILE64_SOURCE
- buf = &st64;
+ /*
+ * Leverage the INT_GETATTR intent above. We are counting
+ * on the FS driver to either make sure the attributes cached in
+ * the inode are always correct or refresh them in the lookup, above.
+ */
+ ino = pno->p_base->pb_ino;
+#ifdef _LARGEFILE64_SOURCE
+ convstat(&ino->i_stbuf, __stat_buf);
#else
- buf = __stat_buf;
+ (void )memcpy(__stat_buf, &ino->i_stbuf, sizeof(struct intnl_stat));
#endif
- ino = pno->p_base->pb_ino;
- err =
- ino->i_ops.inop_getattr(pno,
- pno->p_base->pb_ino,
- buf);
-
P_RELE(pno);
-#if _LARGEFILE64_SOURCE
- if (!err)
- convstat(buf, __stat_buf);
-#endif
out:
SYSIO_INTERFACE_RETURN(err ? -1 : 0, err);
}