summaryrefslogtreecommitdiffstats
path: root/private/posix/filereqs.psx
blob: 1f827c7f7eb58cb886c0249f6edad739f0822696 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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