summaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.h
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-30 13:44:40 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-30 13:44:40 +0000
commit5f93bcbf1c469dc16d5392c8a330cef9b41b5bd2 (patch)
tree0346c1c344442f3994e788215edf3d88a6b9224d /gcc/ada/adaint.h
parent3a0397df51186c36495bd8585b6277b4cb511f2b (diff)
downloadgcc-5f93bcbf1c469dc16d5392c8a330cef9b41b5bd2.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153747 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/adaint.h')
-rw-r--r--gcc/ada/adaint.h51
1 files changed, 44 insertions, 7 deletions
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 79a1e4eb4bd..fbdb4ff6132 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);