src/os/aix/vm/os_aix.cpp

Print this page




4953   } else {
4954     pthread_mutex_unlock(_mutex);
4955     assert (status == 0, "invariant");
4956   }
4957 }
4958 
4959 
4960 extern char** environ;
4961 
4962 // Run the specified command in a separate process. Return its exit value,
4963 // or -1 on failure (e.g. can't fork a new process).
4964 // Unlike system(), this function can be called from signal handler. It
4965 // doesn't block SIGINT et al.
4966 int os::fork_and_exec(char* cmd) {
4967   Unimplemented();
4968   return 0;
4969 }
4970 
4971 // is_headless_jre()
4972 //
4973 // Test for the existence of libmawt in motif21 or xawt directories
4974 // in order to report if we are running in a headless jre




4975 bool os::is_headless_jre() {
4976   struct stat statbuf;
4977   char buf[MAXPATHLEN];
4978   char libmawtpath[MAXPATHLEN];
4979   const char *xawtstr  = "/xawt/libmawt.so";
4980   const char *motifstr = "/motif21/libmawt.so";
4981   char *p;
4982 
4983   // Get path to libjvm.so
4984   os::jvm_path(buf, sizeof(buf));
4985 
4986   // Get rid of libjvm.so
4987   p = strrchr(buf, '/');
4988   if (p == NULL) return false;
4989   else *p = '\0';
4990 
4991   // Get rid of client or server
4992   p = strrchr(buf, '/');
4993   if (p == NULL) return false;
4994   else *p = '\0';
4995 
4996   // check xawt/libmawt.so
4997   strcpy(libmawtpath, buf);
4998   strcat(libmawtpath, xawtstr);
4999   if (::stat(libmawtpath, &statbuf) == 0) return false;
5000 
5001   // check motif21/libmawt.so
5002   strcpy(libmawtpath, buf);
5003   strcat(libmawtpath, motifstr);
5004   if (::stat(libmawtpath, &statbuf) == 0) return false;
5005 
5006   return true;
5007 }
5008 
5009 // Get the default path to the core file
5010 // Returns the length of the string
5011 int os::get_core_path(char* buffer, size_t bufferSize) {
5012   const char* p = get_current_directory(buffer, bufferSize);
5013 
5014   if (p == NULL) {
5015     assert(p != NULL, "failed to get current directory");
5016     return 0;
5017   }
5018 
5019   return strlen(buffer);
5020 }


4953   } else {
4954     pthread_mutex_unlock(_mutex);
4955     assert (status == 0, "invariant");
4956   }
4957 }
4958 
4959 
4960 extern char** environ;
4961 
4962 // Run the specified command in a separate process. Return its exit value,
4963 // or -1 on failure (e.g. can't fork a new process).
4964 // Unlike system(), this function can be called from signal handler. It
4965 // doesn't block SIGINT et al.
4966 int os::fork_and_exec(char* cmd) {
4967   Unimplemented();
4968   return 0;
4969 }
4970 
4971 // is_headless_jre()
4972 //
4973 // Test for the existence of xawt/libmawt.so or libawt_xawt.so
4974 // in order to report if we are running in a headless jre
4975 //
4976 // Since JDK8 xawt/libmawt.so was moved into the same directory
4977 // as libawt.so, and renamed libawt_xawt.so
4978 //
4979 bool os::is_headless_jre() {
4980   struct stat statbuf;
4981   char buf[MAXPATHLEN];
4982   char libmawtpath[MAXPATHLEN];
4983   const char *xawtstr  = "/xawt/libmawt.so";
4984   const char *new_xawtstr = "/libawt_xawt.so";
4985   char *p;
4986 
4987   // Get path to libjvm.so
4988   os::jvm_path(buf, sizeof(buf));
4989 
4990   // Get rid of libjvm.so
4991   p = strrchr(buf, '/');
4992   if (p == NULL) return false;
4993   else *p = '\0';
4994 
4995   // Get rid of client or server
4996   p = strrchr(buf, '/');
4997   if (p == NULL) return false;
4998   else *p = '\0';
4999 
5000   // check xawt/libmawt.so
5001   strcpy(libmawtpath, buf);
5002   strcat(libmawtpath, xawtstr);
5003   if (::stat(libmawtpath, &statbuf) == 0) return false;
5004 
5005   // check libawt_xawt.so
5006   strcpy(libmawtpath, buf);
5007   strcat(libmawtpath, new_xawtstr);
5008   if (::stat(libmawtpath, &statbuf) == 0) return false;
5009 
5010   return true;
5011 }
5012 
5013 // Get the default path to the core file
5014 // Returns the length of the string
5015 int os::get_core_path(char* buffer, size_t bufferSize) {
5016   const char* p = get_current_directory(buffer, bufferSize);
5017 
5018   if (p == NULL) {
5019     assert(p != NULL, "failed to get current directory");
5020     return 0;
5021   }
5022 
5023   return strlen(buffer);
5024 }