windows-nt/Source/XPSP1/NT/base/subsys/posix/filereqs.psx
2020-09-26 16:20:57 +08:00

105 lines
3 KiB
Plaintext

Gary,
Here's some excerpts from the standard and the specifics for each relevant
POSIX function. I put astericks next to statements that are of importance
for the implementation. The situation is better than I had thought due to
the possibility of delaying file times updates.
-----------------------------------------------------
POSIX Requirements for File Times Updates
Each file has 3 time values that are updated when
1. atime - file data has been accessed (i.e. read)
2. mtime - file data has been modified (i.e. write)
3. ctime - file status has been changed (i.e. chmod)
For each of the functions listed below, the appropriate time-related
fields are noted as "marked for update".
**** An implementation may update fields that are marked for update
immediately, or may update such fields periodically.****
When the fields are updated, they are set to the current time and the
update marks are cleared. All files that are marked for update shall
be updated when the file is no longer open by any process,
or when a stat or fstat (NtQueryInformationFile) is done. Other times
at which updates are done are unspecified.
**** Updates are not done for files on read-only file systems. ****
By function:
DONE
readdir -
atime of DIRECTORY updated each time is actually read.
NtQueryDirectoryFile for FileNamesInformation
open -
If O_CREAT and file didn't previously exist, update atime, ctime,
and mtime of FILE and PARENT DIRECTORY.
NtCreateFile -
DesiredAccess=SYNCHRONIZE|READ_CONTROL|FILE_READ_ATTRIBUTES|FILE_READ_EA
or'ed with FILE_READ_DATA, FILE_WRITE_DATA, or both, or
FILE_APPEND_DATA.
ShareAccess = FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE
FileAttributes = FILE_ATTRIBUTE_NORMAL.
If O_TRUNC and file did exist, update ctime and mtime of FILE.
NtOpenFile with access same as above.
creat - Same as open with O_CREAT and O_TRUNC.
mkdir - Update atime, ctime, and mtime of DIRECTORY; update ctime and
mtime of PARENT DIRECTORY.
NtCreateFile -
DesiredAccess = 0L; ShareAccess = 0L.
FileAttributes = FILE_ATTRIBUTE_NORMAL.
mkfifo - Update atime, ctime, mtime of FILE. Update ctime, mtime of PARENT
DIRECTORY.
NtCreateFile -
DesiredAccess = FILE_READ_DATA; ShareAccess = 0L.
FileAttributes = FILE_ATTRIBUTE_SYSTEM.
pipe - atime, ctime, and mtime of pipe
Done in psx subsystem now - may take explicit setting of times.
-------------------------------------
TO BE DONE (should be complete before December 15 - I will update at that time)
link - Update ctime of FILE, ctime and mtime of PARENT DIRECTORY containing
new entry.
NtSetInformationFile
unlink - Update ctime of FILE unless link count goes to 0, ctime and mtime
of PARENT DIRECTORY.
NtSetInformationFile
rmdir - ctime and mtime of PARENT DIRECTORY.
NtSetInformationFile
rename - Update ctime and mtime of PARENT DIRECTORY of each file.
NtSetInformationFile
chmod - ctime of FILE.
NtSetInformationFile
chown - ctime of FILE.
NtSetInformationFile
utime - ctime of FILE
NtSetInformationFile
read - atime of FILE
NtReadFile
write - ctime and mtime of FILE.
NtWriteFile