MIAMEX 167: Verify File Information

xcall MIAMEX, MX_VERINODE, status, ch1 {,ch2...,chn}

(UNIX) MX_VERINODE is used for verifying at runtime that a set of open files matches the directory entries for those files.

Parameters

status

returns zero if all the specified channels are valid; else it returns less than zero for a system error or else the channel number of the first file in the list that doesn't match its directory entry.

Background

Under UNIX, it is possible to use the mv command to rename a file even if it is in use. This is because mv is thought of as merely a directory operation, whereas file operations all use the inode rather than the name entry in the directory. Since renaming a file doesn't change its inode, it doesn't affect files that are currently operating on the inode. Once the file is renamed, you can then create or copy a new file whose name matches the original name. That still doesn't affect processes with the file open, since the new file will have a different inode and thus isn't really in conflict with any existing processes using the old file. However, that could cause problems for the application if two sets of users are operating on different copies of the file, thinking that they are the same copy.

MX_VERINODE can be used to make sure that the open file(s) still match the directory entries for those files. Note that it only works under UNIX (Windows doesn't use inodes and this situation wouldn't arise there), and it only currently works for random and ISAM-A (DISAM) files.

History

2006 October, A-Shell 4.9.968:  Routine added to A-Shell