mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-24 05:14:52 +02:00
8146879: Add option for handling existing log files in UL
Reviewed-by: dsamersoff, gziemski, rehn
This commit is contained in:
parent
1afb9e9427
commit
8b2f63bd2b
15 changed files with 368 additions and 26 deletions
|
@ -6008,7 +6008,22 @@ bool os::start_debugging(char *buf, int buflen) {
|
|||
return yes;
|
||||
}
|
||||
|
||||
static inline struct timespec get_mtime(const char* filename) {
|
||||
struct stat st;
|
||||
int ret = os::stat(filename, &st);
|
||||
assert(ret == 0, "failed to stat() file '%s': %s", filename, strerror(errno));
|
||||
return st.st_mtim;
|
||||
}
|
||||
|
||||
int os::compare_file_modified_times(const char* file1, const char* file2) {
|
||||
struct timespec filetime1 = get_mtime(file1);
|
||||
struct timespec filetime2 = get_mtime(file2);
|
||||
int diff = filetime1.tv_sec - filetime2.tv_sec;
|
||||
if (diff == 0) {
|
||||
return filetime1.tv_nsec - filetime2.tv_nsec;
|
||||
}
|
||||
return diff;
|
||||
}
|
||||
|
||||
/////////////// Unit tests ///////////////
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue