3714 for (i = 0; i < 78; i++) err.print_raw("=");
3715 err.cr();
3716
3717 char buf[16];
3718 // Prevent process from exiting upon "read error" without consuming all CPU
3719 while (::read(0, buf, sizeof(buf)) <= 0) { ::sleep(100); }
3720
3721 return buf[0] == 'y' || buf[0] == 'Y';
3722 }
3723
3724 // Is a (classpath) directory empty?
3725 bool os::dir_is_empty(const char* path) {
3726 DIR *dir = NULL;
3727 struct dirent *ptr;
3728
3729 dir = opendir(path);
3730 if (dir == NULL) return true;
3731
3732 /* Scan the directory */
3733 bool result = true;
3734 char buf[sizeof(struct dirent) + MAX_PATH];
3735 while (result && (ptr = ::readdir(dir)) != NULL) {
3736 if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
3737 result = false;
3738 }
3739 }
3740 closedir(dir);
3741 return result;
3742 }
3743
3744 // This code originates from JDK's sysOpen and open64_w
3745 // from src/solaris/hpi/src/system_md.c
3746
3747 int os::open(const char *path, int oflag, int mode) {
3748
3749 if (strlen(path) > MAX_PATH - 1) {
3750 errno = ENAMETOOLONG;
3751 return -1;
3752 }
3753 int fd;
3754
3755 fd = ::open64(path, oflag, mode);
|
3714 for (i = 0; i < 78; i++) err.print_raw("=");
3715 err.cr();
3716
3717 char buf[16];
3718 // Prevent process from exiting upon "read error" without consuming all CPU
3719 while (::read(0, buf, sizeof(buf)) <= 0) { ::sleep(100); }
3720
3721 return buf[0] == 'y' || buf[0] == 'Y';
3722 }
3723
3724 // Is a (classpath) directory empty?
3725 bool os::dir_is_empty(const char* path) {
3726 DIR *dir = NULL;
3727 struct dirent *ptr;
3728
3729 dir = opendir(path);
3730 if (dir == NULL) return true;
3731
3732 /* Scan the directory */
3733 bool result = true;
3734 while (result && (ptr = readdir(dir)) != NULL) {
3735 if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
3736 result = false;
3737 }
3738 }
3739 closedir(dir);
3740 return result;
3741 }
3742
3743 // This code originates from JDK's sysOpen and open64_w
3744 // from src/solaris/hpi/src/system_md.c
3745
3746 int os::open(const char *path, int oflag, int mode) {
3747
3748 if (strlen(path) > MAX_PATH - 1) {
3749 errno = ENAMETOOLONG;
3750 return -1;
3751 }
3752 int fd;
3753
3754 fd = ::open64(path, oflag, mode);
|