< prev index next >

src/hotspot/os/aix/os_aix.cpp

Print this page




3720 
3721 bool os::message_box(const char* title, const char* message) {
3722   int i;
3723   fdStream err(defaultStream::error_fd());
3724   for (i = 0; i < 78; i++) err.print_raw("=");
3725   err.cr();
3726   err.print_raw_cr(title);
3727   for (i = 0; i < 78; i++) err.print_raw("-");
3728   err.cr();
3729   err.print_raw_cr(message);
3730   for (i = 0; i < 78; i++) err.print_raw("=");
3731   err.cr();
3732 
3733   char buf[16];
3734   // Prevent process from exiting upon "read error" without consuming all CPU
3735   while (::read(0, buf, sizeof(buf)) <= 0) { ::sleep(100); }
3736 
3737   return buf[0] == 'y' || buf[0] == 'Y';
3738 }
3739 
3740 int os::stat(const char *path, struct stat *sbuf) {
3741   char pathbuf[MAX_PATH];
3742   if (strlen(path) > MAX_PATH - 1) {
3743     errno = ENAMETOOLONG;
3744     return -1;
3745   }
3746   os::native_path(strcpy(pathbuf, path));
3747   return ::stat(pathbuf, sbuf);
3748 }
3749 
3750 // Is a (classpath) directory empty?
3751 bool os::dir_is_empty(const char* path) {
3752   DIR *dir = NULL;
3753   struct dirent *ptr;
3754 
3755   dir = opendir(path);
3756   if (dir == NULL) return true;
3757 
3758   /* Scan the directory */
3759   bool result = true;
3760   char buf[sizeof(struct dirent) + MAX_PATH];
3761   while (result && (ptr = ::readdir(dir)) != NULL) {
3762     if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
3763       result = false;
3764     }
3765   }
3766   closedir(dir);
3767   return result;
3768 }
3769 




3720 
3721 bool os::message_box(const char* title, const char* message) {
3722   int i;
3723   fdStream err(defaultStream::error_fd());
3724   for (i = 0; i < 78; i++) err.print_raw("=");
3725   err.cr();
3726   err.print_raw_cr(title);
3727   for (i = 0; i < 78; i++) err.print_raw("-");
3728   err.cr();
3729   err.print_raw_cr(message);
3730   for (i = 0; i < 78; i++) err.print_raw("=");
3731   err.cr();
3732 
3733   char buf[16];
3734   // Prevent process from exiting upon "read error" without consuming all CPU
3735   while (::read(0, buf, sizeof(buf)) <= 0) { ::sleep(100); }
3736 
3737   return buf[0] == 'y' || buf[0] == 'Y';
3738 }
3739 










3740 // Is a (classpath) directory empty?
3741 bool os::dir_is_empty(const char* path) {
3742   DIR *dir = NULL;
3743   struct dirent *ptr;
3744 
3745   dir = opendir(path);
3746   if (dir == NULL) return true;
3747 
3748   /* Scan the directory */
3749   bool result = true;
3750   char buf[sizeof(struct dirent) + MAX_PATH];
3751   while (result && (ptr = ::readdir(dir)) != NULL) {
3752     if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
3753       result = false;
3754     }
3755   }
3756   closedir(dir);
3757   return result;
3758 }
3759 


< prev index next >