diff options
author | Ian Lance Taylor <ian@airs.com> | 2009-07-06 23:11:21 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2009-07-06 23:11:21 +0000 |
commit | 98fa85cb4244619f2ecc3cdfd7578a2602addf45 (patch) | |
tree | 04f0bdd28145db3e83edf52eefb7081bbcf21754 /gold/fileread.cc | |
parent | 922d8de8c1bd5cbaa9eadd77437daea021864c1d (diff) | |
download | gdb-98fa85cb4244619f2ecc3cdfd7578a2602addf45.zip gdb-98fa85cb4244619f2ecc3cdfd7578a2602addf45.tar.gz gdb-98fa85cb4244619f2ecc3cdfd7578a2602addf45.tar.bz2 |
* fileread.cc (File_read::get_mtime): New method.
* fileread.h (Timespec): New structure.
(File_read::get_mtime): New method.
* incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
Renamed from timestamp_nsec.
(Incremental_inputs_entry_write::timestamp_sec): Fix argument to
Elf_Xword.
(Incremental_inputs_entry_write::timestamp_usec): Renamed from
timestamp_nsec.
(Incremental_inputs::report_archive): Save mtime; style fix.
(Incremental_inputs::report_obejct): Save mtime; style fix.
(Incremental_inputs::report_script): Save mtime; style fix.
(Incremental_inputs::finalize_inputs): Style fix.
(Incremental_inputs::finalize): Style fix.
(Incremental_inputs::create_input_section_data): Store inputs
mtime.
* incremental.h (Incremental_inputs::report_script): Add mtime
argument.
(Incremental_inputs::Input_info::Input_info): Intialize only one
union member.
(Incremental_inputs::Input_info::archive): Move to nameless
union.
(Incremental_inputs::Input_info::obejct): Move to nameless union.
(Incremental_inputs::Input_info::script): Move to nameless union.
(Incremental_inputs::mtime): New field.
* script.cc (read_input_script): Pass file mtime to
Incremental_input.
* script.h (Script_info::inputs): Style fix.
Diffstat (limited to 'gold/fileread.cc')
-rw-r--r-- | gold/fileread.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gold/fileread.cc b/gold/fileread.cc index 5cc0c34..bb10aa9 100644 --- a/gold/fileread.cc +++ b/gold/fileread.cc @@ -768,6 +768,23 @@ Input_file::will_search_for() const || this->input_argument_->extra_search_path() != NULL)); } +// Return the file last modification time. Calls gold_fatal if the stat +// system call failed. + +Timespec +File_read::get_mtime() +{ + struct stat file_stat; + this->reopen_descriptor(); + + if (fstat(this->descriptor_, &file_stat) < 0) + gold_fatal(_("%s: stat failed: %s"), this->name_.c_str(), + strerror(errno)); + // TODO: do a configure check if st_mtim is present and get the + // nanoseconds part if it is. + return Timespec(file_stat.st_mtime, 0); +} + // Open the file. // If the filename is not absolute, we assume it is in the current |