Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The structure members st_mode, st_ino, st_dev, st_uid, st_gid, st_atime, st_ctime, and st_mtime should all have meaningful values for all file types on POSIX-compliant systems. The st_ino field contains the file serial number. The st_dev field identifies the device containing the file. The st_ino and st_dev, taken together, uniquely identify the file. The st_dev value is not necessarily consistent across reboots or system crashes, however, so you may not be able to use this field for file identification if there is a possibility of a system crash or reboot before you attempt to reopen a file.

Wiki MarkupIt is necessary to call the {{fstat()}} function on an already opened file, rather than calling {{stat()}} on a file name followed by {{open()}} to ensure the file for which the information is being collected is the same file that is opened. See \[[FIO01-A. Be careful using functions that use file names for identification]\] for more information on avoiding race conditions resulting from the use of file names for identification.

Wiki Markup
It may also be necessary to call {{open()}} with {{O_NONBLOCK}} as per \[[FIO32-C. Do not perform operations on devices that are only appropriate for files]\] to ensure that the program does not hang when trying to open special files.

...