3487 int os::compare_file_modified_times(const char* file1, const char* file2) {
3488 struct timespec filetime1 = get_mtime(file1);
3489 struct timespec filetime2 = get_mtime(file2);
3490 int diff = filetime1.tv_sec - filetime2.tv_sec;
3491 if (diff == 0) {
3492 return filetime1.tv_nsec - filetime2.tv_nsec;
3493 }
3494 return diff;
3495 }
3496
3497 // Is a (classpath) directory empty?
3498 bool os::dir_is_empty(const char* path) {
3499 DIR *dir = NULL;
3500 struct dirent *ptr;
3501
3502 dir = opendir(path);
3503 if (dir == NULL) return true;
3504
3505 // Scan the directory
3506 bool result = true;
3507 char buf[sizeof(struct dirent) + MAX_PATH];
3508 while (result && (ptr = ::readdir(dir)) != NULL) {
3509 if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
3510 result = false;
3511 }
3512 }
3513 closedir(dir);
3514 return result;
3515 }
3516
3517 // This code originates from JDK's sysOpen and open64_w
3518 // from src/solaris/hpi/src/system_md.c
3519
3520 int os::open(const char *path, int oflag, int mode) {
3521 if (strlen(path) > MAX_PATH - 1) {
3522 errno = ENAMETOOLONG;
3523 return -1;
3524 }
3525 int fd;
3526
3527 fd = ::open(path, oflag, mode);
3528 if (fd == -1) return -1;
|
3487 int os::compare_file_modified_times(const char* file1, const char* file2) {
3488 struct timespec filetime1 = get_mtime(file1);
3489 struct timespec filetime2 = get_mtime(file2);
3490 int diff = filetime1.tv_sec - filetime2.tv_sec;
3491 if (diff == 0) {
3492 return filetime1.tv_nsec - filetime2.tv_nsec;
3493 }
3494 return diff;
3495 }
3496
3497 // Is a (classpath) directory empty?
3498 bool os::dir_is_empty(const char* path) {
3499 DIR *dir = NULL;
3500 struct dirent *ptr;
3501
3502 dir = opendir(path);
3503 if (dir == NULL) return true;
3504
3505 // Scan the directory
3506 bool result = true;
3507 while (result && (ptr = readdir(dir)) != NULL) {
3508 if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
3509 result = false;
3510 }
3511 }
3512 closedir(dir);
3513 return result;
3514 }
3515
3516 // This code originates from JDK's sysOpen and open64_w
3517 // from src/solaris/hpi/src/system_md.c
3518
3519 int os::open(const char *path, int oflag, int mode) {
3520 if (strlen(path) > MAX_PATH - 1) {
3521 errno = ENAMETOOLONG;
3522 return -1;
3523 }
3524 int fd;
3525
3526 fd = ::open(path, oflag, mode);
3527 if (fd == -1) return -1;
|