filesystem timestamps and their usage
deeptech71 at gmail.com
deeptech71 at gmail.com
Sun Aug 19 08:36:49 PDT 2007
Let's talk about file system timestamps. What kind of timestamps are there
currently, and what are they used for? (or what new timestamps would be
needed/beneficial, or whatever.)
Currently I can think of only two:
1. data_time: The last time the file was written to.
2. file_time: The last time the file was moved or written to. If a directory is
moved, all files within are also time-updated.
It should be considered invalid, if data_time > file_time, but can happen if,
for example, a file is copied from somewhere, like an FTP server, and ?therefore
not be automatically corrected? (it does not imply filesystem corruption).
Some basic usage for compiling. Here's func.x86's dependency tree:
common.h } (func.c includes func.h, which includes common.h)
func.h }
func.c } -> func.o } (func.x86 is generated
} -> func.x86 from func.o and main.o)
common.h } -> main.o }
main.h }
main.c } (main.c includes main.h, which includes common.h)
We have compiled everything already. Now let's do something.
As a requirement, the data_time of a derived file must be later in time, for it
to be considered up to date. That is, if I edit func.h, it's timestamp will be
higher than func.c's timestamp, meaning that I have to recompile func.c, and
link the executable. Generally, a file's (like func.x86's) time must be higher
than every other file it depends on (func.o, main.o).
Next, if I replace common.h with a different file (because I want to recompile
with someone else's common.h), the data_time of common.h may be lower than
main.h. So all the data_time and file_time of main.o and func.o must be higher
than the ones of common.h. Generally both of the file's times should be higher
than any of its dependencies' times.
If a bad time (data_time > file_time) is detected, and its file depends on
something, it's remade. If it does not depend on anything, I don't know, maybe
the compiler should warning or use the file_time only.
If I want to replace the .o (wtf for?), then I'll have to build, replace, then
link only.
OK that would be the basic usage of these two timestamps in compiling. If I'm
wrong, or something would be more practical maybe, please tell. And, what about
other timestamps?
THX
More information about the freebsd-chat
mailing list