Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/stat.2
Show All 22 Lines | |||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" @(#)stat.2 8.4 (Berkeley) 5/1/95 | .\" @(#)stat.2 8.4 (Berkeley) 5/1/95 | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd November 11, 2018 | .Dd December 3, 2018 | ||||
.Dt STAT 2 | .Dt STAT 2 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm stat , | .Nm stat , | ||||
.Nm lstat , | .Nm lstat , | ||||
.Nm fstat , | .Nm fstat , | ||||
.Nm fstatat | .Nm fstatat | ||||
.Nd get file status | .Nd get file status | ||||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | |||||
fields together identify the file uniquely within the system. | fields together identify the file uniquely within the system. | ||||
.Pp | .Pp | ||||
The time-related fields of | The time-related fields of | ||||
.Vt "struct stat" | .Vt "struct stat" | ||||
are: | are: | ||||
.Bl -tag -width ".Va st_birthtim" | .Bl -tag -width ".Va st_birthtim" | ||||
.It Va st_atim | .It Va st_atim | ||||
Time when file data was last accessed. | Time when file data was last accessed. | ||||
Changed by the | Changed implicitly by syscalls such as | ||||
.Xr mknod 2 , | |||||
.Xr utimes 2 , | |||||
.Xr read 2 | .Xr read 2 | ||||
and | and | ||||
.Xr readv 2 | .Xr readv 2 , | ||||
system calls. | and explicitly by | ||||
.Xr utimes 2 . | |||||
.It Va st_mtim | .It Va st_mtim | ||||
Time when file data was last modified. | Time when file data was last modified. | ||||
Changed by the | Changed implicitly by syscalls such as | ||||
.Xr truncate 2 , | |||||
.Xr write 2 , | |||||
and | |||||
.Xr writev 2 , | |||||
and explicitly by | |||||
.Xr utimes 2 . | |||||
Also, any syscall which modifies directory content changes the | |||||
kib: This is too loose and really unusal formulation. You might say something like
```
Any syscall… | |||||
.Va st_mtim | |||||
for the affected directory. | |||||
For instance, | |||||
.Xr creat 2 , | |||||
.Xr mkdir 2 , | .Xr mkdir 2 , | ||||
.Xr mkfifo 2 , | .Xr rename 2 , | ||||
.Xr mknod 2 , | .Xr link 2 , | ||||
.Xr utimes 2 , | |||||
.Xr write 2 | |||||
and | and | ||||
.Xr writev 2 | .Xr unlink 2 . | ||||
system calls. | |||||
.It Va st_ctim | .It Va st_ctim | ||||
Not Done Inline ActionsNot 'parent'. kib: Not 'parent'. | |||||
Time when file status was last changed (inode data modification). | Time when file status was last changed (inode data modification). | ||||
Changed by the | Changed implicitly by any syscall that affects file data or metadata, such as | ||||
Not Done Inline Actionsctim is only updated when metadata is changed, not data. So for instance, write(2) does not cause update to ctime if file size and file mode are unchanged. kib: ctim is only updated when metadata is changed, not data. So for instance, write(2) does not… | |||||
Done Inline ActionsActually, it does. I verified that both write and pwrite do update ctime even if file size is unchanged, on both UFS and ZFS. asomers: Actually, it does. I verified that both write and pwrite do update ctime even if file size is… | |||||
Not Done Inline ActionsIn fact yes, I checked UFS and tmpfs. I can see a reasoning there, mtime needs to be updated, but this changes inode content, which implies ctime change. So might be mention this and then there is no need to say 'affects file data or metadata'. kib: In fact yes, I checked UFS and tmpfs. I can see a reasoning there, mtime needs to be updated… | |||||
.Xr chflags 2 , | .Xr chflags 2 , | ||||
.Xr chmod 2 , | .Xr chmod 2 , | ||||
.Xr chown 2 , | .Xr chown 2 , | ||||
.Xr creat 2 , | |||||
.Xr link 2 , | |||||
.Xr mkdir 2 , | |||||
.Xr mkfifo 2 , | |||||
.Xr mknod 2 , | |||||
.Xr rename 2 , | |||||
.Xr rmdir 2 , | |||||
.Xr symlink 2 , | |||||
.Xr truncate 2 , | .Xr truncate 2 , | ||||
.Xr unlink 2 , | |||||
.Xr utimes 2 , | .Xr utimes 2 , | ||||
and | |||||
.Xr write 2 | .Xr write 2 | ||||
Also, any syscall which modifies directory content changes the | |||||
.Va st_ctim | |||||
for the affected directory. | |||||
For instance, | |||||
.Xr creat 2 , | |||||
.Xr mkdir 2 , | |||||
.Xr rename 2 , | |||||
.Xr link 2 , | |||||
and | and | ||||
.Xr writev 2 | .Xr unlink 2 . | ||||
system calls. | |||||
.It Va st_birthtim | .It Va st_birthtim | ||||
Time when the inode was created. | Time when the inode was created. | ||||
.El | .El | ||||
.Pp | .Pp | ||||
These time-related macros are defined for compatibility: | These time-related macros are defined for compatibility: | ||||
.Bd -literal | .Bd -literal | ||||
#define st_atime st_atim.tv_sec | #define st_atime st_atim.tv_sec | ||||
#define st_mtime st_mtim.tv_sec | #define st_mtime st_mtim.tv_sec | ||||
▲ Show 20 Lines • Show All 254 Lines • Show Last 20 Lines |
This is too loose and really unusal formulation. You might say something like