hotspot/src/os/aix/vm/os_aix.cpp
changeset 37113 5a33bf5089ac
parent 36379 0c596dc28ed7
child 37430 fd743dadef12
equal deleted inserted replaced
37111:98572401ab0a 37113:5a33bf5089ac
   908   char buf[64];
   908   char buf[64];
   909   if (ret == 0) {
   909   if (ret == 0) {
   910     log_info(os, thread)("Thread started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
   910     log_info(os, thread)("Thread started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
   911       (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
   911       (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
   912   } else {
   912   } else {
   913     log_warning(os, thread)("Failed to start thread - pthread_create failed (%s) for attributes: %s.",
   913     log_warning(os, thread)("Failed to start thread - pthread_create failed (%d=%s) for attributes: %s.",
   914       strerror(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
   914       ret, os::errno_name(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
   915   }
   915   }
   916 
   916 
   917   pthread_attr_destroy(&attr);
   917   pthread_attr_destroy(&attr);
   918 
   918 
   919   if (ret != 0) {
   919   if (ret != 0) {
  1176 // from src/solaris/hpi/src/system_md.c
  1176 // from src/solaris/hpi/src/system_md.c
  1177 
  1177 
  1178 size_t os::lasterror(char *buf, size_t len) {
  1178 size_t os::lasterror(char *buf, size_t len) {
  1179   if (errno == 0) return 0;
  1179   if (errno == 0) return 0;
  1180 
  1180 
  1181   const char *s = ::strerror(errno);
  1181   const char *s = os::strerror(errno);
  1182   size_t n = ::strlen(s);
  1182   size_t n = ::strlen(s);
  1183   if (n >= len) {
  1183   if (n >= len) {
  1184     n = len - 1;
  1184     n = len - 1;
  1185   }
  1185   }
  1186   ::strncpy(buf, s, n);
  1186   ::strncpy(buf, s, n);
  1712 static void local_sem_post() {
  1712 static void local_sem_post() {
  1713   static bool warn_only_once = false;
  1713   static bool warn_only_once = false;
  1714   if (os::Aix::on_aix()) {
  1714   if (os::Aix::on_aix()) {
  1715     int rc = ::sem_post(&sig_sem);
  1715     int rc = ::sem_post(&sig_sem);
  1716     if (rc == -1 && !warn_only_once) {
  1716     if (rc == -1 && !warn_only_once) {
  1717       trcVerbose("sem_post failed (errno = %d, %s)", errno, strerror(errno));
  1717       trcVerbose("sem_post failed (errno = %d, %s)", errno, os::errno_name(errno));
  1718       warn_only_once = true;
  1718       warn_only_once = true;
  1719     }
  1719     }
  1720   } else {
  1720   } else {
  1721     guarantee0(p_sig_msem != NULL);
  1721     guarantee0(p_sig_msem != NULL);
  1722     int rc = ::msem_unlock(p_sig_msem, 0);
  1722     int rc = ::msem_unlock(p_sig_msem, 0);
  1723     if (rc == -1 && !warn_only_once) {
  1723     if (rc == -1 && !warn_only_once) {
  1724       trcVerbose("msem_unlock failed (errno = %d, %s)", errno, strerror(errno));
  1724       trcVerbose("msem_unlock failed (errno = %d, %s)", errno, os::errno_name(errno));
  1725       warn_only_once = true;
  1725       warn_only_once = true;
  1726     }
  1726     }
  1727   }
  1727   }
  1728 }
  1728 }
  1729 
  1729 
  1730 static void local_sem_wait() {
  1730 static void local_sem_wait() {
  1731   static bool warn_only_once = false;
  1731   static bool warn_only_once = false;
  1732   if (os::Aix::on_aix()) {
  1732   if (os::Aix::on_aix()) {
  1733     int rc = ::sem_wait(&sig_sem);
  1733     int rc = ::sem_wait(&sig_sem);
  1734     if (rc == -1 && !warn_only_once) {
  1734     if (rc == -1 && !warn_only_once) {
  1735       trcVerbose("sem_wait failed (errno = %d, %s)", errno, strerror(errno));
  1735       trcVerbose("sem_wait failed (errno = %d, %s)", errno, os::errno_name(errno));
  1736       warn_only_once = true;
  1736       warn_only_once = true;
  1737     }
  1737     }
  1738   } else {
  1738   } else {
  1739     guarantee0(p_sig_msem != NULL); // must init before use
  1739     guarantee0(p_sig_msem != NULL); // must init before use
  1740     int rc = ::msem_lock(p_sig_msem, 0);
  1740     int rc = ::msem_lock(p_sig_msem, 0);
  1741     if (rc == -1 && !warn_only_once) {
  1741     if (rc == -1 && !warn_only_once) {
  1742       trcVerbose("msem_lock failed (errno = %d, %s)", errno, strerror(errno));
  1742       trcVerbose("msem_lock failed (errno = %d, %s)", errno, os::errno_name(errno));
  1743       warn_only_once = true;
  1743       warn_only_once = true;
  1744     }
  1744     }
  1745   }
  1745   }
  1746 }
  1746 }
  1747 
  1747 
  2201 #ifdef PRODUCT
  2201 #ifdef PRODUCT
  2202 static void warn_fail_commit_memory(char* addr, size_t size, bool exec,
  2202 static void warn_fail_commit_memory(char* addr, size_t size, bool exec,
  2203                                     int err) {
  2203                                     int err) {
  2204   warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT
  2204   warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT
  2205           ", %d) failed; error='%s' (errno=%d)", addr, size, exec,
  2205           ", %d) failed; error='%s' (errno=%d)", addr, size, exec,
  2206           strerror(err), err);
  2206           os::errno_name(err), err);
  2207 }
  2207 }
  2208 #endif
  2208 #endif
  2209 
  2209 
  2210 void os::pd_commit_memory_or_exit(char* addr, size_t size, bool exec,
  2210 void os::pd_commit_memory_or_exit(char* addr, size_t size, bool exec,
  2211                                   const char* mesg) {
  2211                                   const char* mesg) {
  2410   // See http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.basetechref/doc/basetrf1/mprotect.htm
  2410   // See http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.basetechref/doc/basetrf1/mprotect.htm
  2411 
  2411 
  2412   bool rc = ::mprotect(addr, size, prot) == 0 ? true : false;
  2412   bool rc = ::mprotect(addr, size, prot) == 0 ? true : false;
  2413 
  2413 
  2414   if (!rc) {
  2414   if (!rc) {
  2415     const char* const s_errno = strerror(errno);
  2415     const char* const s_errno = os::errno_name(errno);
  2416     warning("mprotect(" PTR_FORMAT "-" PTR_FORMAT ", 0x%X) failed (%s).", addr, addr + size, prot, s_errno);
  2416     warning("mprotect(" PTR_FORMAT "-" PTR_FORMAT ", 0x%X) failed (%s).", addr, addr + size, prot, s_errno);
  2417     return false;
  2417     return false;
  2418   }
  2418   }
  2419 
  2419 
  2420   // mprotect success check
  2420   // mprotect success check
  2632   param.sched_priority = newpri;
  2632   param.sched_priority = newpri;
  2633   int ret = pthread_setschedparam(thr, policy, &param);
  2633   int ret = pthread_setschedparam(thr, policy, &param);
  2634 
  2634 
  2635   if (ret != 0) {
  2635   if (ret != 0) {
  2636     trcVerbose("Could not change priority for thread %d to %d (error %d, %s)",
  2636     trcVerbose("Could not change priority for thread %d to %d (error %d, %s)",
  2637         (int)thr, newpri, ret, strerror(ret));
  2637         (int)thr, newpri, ret, os::errno_name(ret));
  2638   }
  2638   }
  2639   return (ret == 0) ? OS_OK : OS_ERR;
  2639   return (ret == 0) ? OS_OK : OS_ERR;
  2640 }
  2640 }
  2641 
  2641 
  2642 OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
  2642 OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {