diff options
author | Emmanuel Briot <briot@adacore.com> | 2009-10-30 13:44:40 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-10-30 14:44:40 +0100 |
commit | 48263c9aa078ffcec15682edc05724f21d87bfc3 (patch) | |
tree | 0346c1c344442f3994e788215edf3d88a6b9224d /gcc/ada/adaint.h | |
parent | b11cb5fd9eb07c4989081f533feca1bf262f0e81 (diff) | |
download | gcc-48263c9aa078ffcec15682edc05724f21d87bfc3.zip gcc-48263c9aa078ffcec15682edc05724f21d87bfc3.tar.gz gcc-48263c9aa078ffcec15682edc05724f21d87bfc3.tar.bz2 |
2009-10-30 Emmanuel Briot <briot@adacore.com>
* make.adb, adaint.c, adaint.h, osint.adb, osint.ads, bcheck.adb
(*_attr): new subprograms.
(File_Length, File_Time_Stamp, Is_Writable_File): new subprograms
(Read_Library_Info_From_Full, Full_Library_Info_Name,
Full_Source_Name): Now benefit from a previous cache of the file
attributes, to further save on system calls.
(Smart_Find_File): now also cache the file attributes. This makes the
package File_Stamp_Hash_Table useless, and it was removed.
(Compile_Sources): create subprograms for the various steps of the main
loop, for readibility and to avoid sharing variables between the
various steps.
From-SVN: r153747
Diffstat (limited to 'gcc/ada/adaint.h')
-rw-r--r-- | gcc/ada/adaint.h | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h index 79a1e4e..fbdb4ff 100644 --- a/gcc/ada/adaint.h +++ b/gcc/ada/adaint.h @@ -68,6 +68,30 @@ typedef long long OS_Time; typedef long OS_Time; #endif +/* A lazy cache for the attributes of a file. On some systems, a single call to + stat() will give all this information, so it is better than doing a system + call every time. On other systems this require several system calls. +*/ + +struct file_attributes { + short exists; + + short writable; + short readable; + short executable; + + short symbolic_link; + short regular; + short directory; + + OS_Time timestamp; + long file_length; +}; +/* WARNING: changing the size here might require changing the constant + * File_Attributes_Size in osint.ads (which should be big enough to + * fit the above struct on any system) + */ + extern int __gnat_max_path_len; extern OS_Time __gnat_current_time (void); extern void __gnat_current_time_string (char *); @@ -121,15 +145,28 @@ extern OS_Time __gnat_file_time_fd (int); extern void __gnat_set_file_time_name (char *, time_t); -extern int __gnat_dup (int); -extern int __gnat_dup2 (int, int); -extern int __gnat_file_exists (char *); -extern int __gnat_is_regular_file (char *); -extern int __gnat_is_absolute_path (char *,int); -extern int __gnat_is_directory (char *); +extern int __gnat_dup (int); +extern int __gnat_dup2 (int, int); +extern int __gnat_file_exists (char *); +extern int __gnat_is_regular_file (char *); +extern int __gnat_is_absolute_path (char *,int); +extern int __gnat_is_directory (char *); extern int __gnat_is_writable_file (char *); extern int __gnat_is_readable_file (char *name); -extern int __gnat_is_executable_file (char *name); +extern int __gnat_is_executable_file (char *name); + +extern void reset_attributes (struct file_attributes* attr); +extern long __gnat_file_length_attr (int, char *, struct file_attributes *); +extern OS_Time __gnat_file_time_name_attr (char *, struct file_attributes *); +extern OS_Time __gnat_file_time_fd_attr (int, struct file_attributes *); +extern int __gnat_file_exists_attr (char *, struct file_attributes *); +extern int __gnat_is_regular_file_attr (char *, struct file_attributes *); +extern int __gnat_is_directory_attr (char *, struct file_attributes *); +extern int __gnat_is_readable_file_attr (char *, struct file_attributes *); +extern int __gnat_is_writable_file_attr (char *, struct file_attributes *); +extern int __gnat_is_executable_file_attr (char *, struct file_attributes *); +extern int __gnat_is_symbolic_link_attr (char *, struct file_attributes *); + extern void __gnat_set_non_writable (char *name); extern void __gnat_set_writable (char *name); extern void __gnat_set_executable (char *name); |