< prev index next >

src/share/vm/runtime/os.cpp

Print this page
rev 10257 : 8149036: Add tracing for thread related events at os level
Reviewed-by:

@@ -58,10 +58,11 @@
 #include "services/nmtCommon.hpp"
 #include "services/threadService.hpp"
 #include "utilities/defaultStream.hpp"
 #include "utilities/events.hpp"
 
+# include <errno.h>
 # include <signal.h>
 
 OSThread*         os::_starting_thread    = NULL;
 address           os::_polling_page       = NULL;
 volatile int32_t* os::_mem_serialize_page = NULL;

@@ -1751,5 +1752,228 @@
 void TestOS_test() {
   TestOS::run_tests();
 }
 
 #endif // PRODUCT
+
+
+const char* os::errno_name(int err_no) {
+  switch (err_no) {
+  case E2BIG: return "E2BIG";
+  case EACCES: return "EACCES";
+#ifdef EADDRINUSE
+  case EADDRINUSE: return "EADDRINUSE";
+#endif
+#ifdef EADDRNOTAVAIL
+  case EADDRNOTAVAIL: return "EADDRNOTAVAIL";
+#endif
+#ifdef EAFNOSUPPORT
+  case EAFNOSUPPORT: return "EAFNOSUPPORT";
+#endif
+  case EAGAIN: return "EAGAIN";
+#ifdef EALREADY
+  case EALREADY: return "EALREADY";
+#endif
+  case EBADF: return "EBADF";
+#ifdef EBADMSG
+  case EBADMSG: return "EBADMSG";
+#endif
+  case EBUSY: return "EBUSY";
+#ifdef ECANCELED
+  case ECANCELED: return "ECANCELED";
+#endif
+#ifdef ECHILD
+  case ECHILD: return "ECHILD";
+#endif
+#ifdef ECONNABORTED
+  case ECONNABORTED: return "ECONNABORTED";
+#endif
+#ifdef ECONNREFUSED
+  case ECONNREFUSED: return "ECONNREFUSED";
+#endif
+#ifdef ECONNRESET
+  case ECONNRESET: return "ECONNRESET";
+#endif
+#ifdef EDEADLK
+  case EDEADLK: return "EDEADLK";
+#endif
+#ifdef EDESTADDRREQ
+  case EDESTADDRREQ: return "EDESTADDRREQ";
+#endif
+#ifdef EDOM
+  case EDOM: return "EDOM";
+#endif
+#ifdef EDQUOT
+  case EDQUOT: return "EDQUOT";
+#endif
+#ifdef EEXIST
+  case EEXIST: return "EEXIST";
+#endif
+  case EFAULT: return "EFAULT";
+#ifdef EFBIG
+  case EFBIG: return "EFBIG";
+#endif
+#ifdef EHOSTUNREACH
+  case EHOSTUNREACH: return "EHOSTUNREACH";
+#endif
+#ifdef EIDRM
+  case EIDRM: return "EIDRM";
+#endif
+#ifdef EILSEQ
+  case EILSEQ: return "EILSEQ";
+#endif
+#ifdef EINPROGRESS
+  case EINPROGRESS: return "EINPROGRESS";
+#endif
+  case EINTR: return "EINTR";
+  case EINVAL: return "EINVAL";
+#ifdef EIO
+  case EIO: return "EIO";
+#endif
+#ifdef EISCONN
+  case EISCONN: return "EISCONN";
+#endif
+  case EISDIR: return "EISDIR";
+#ifdef ELOOP
+  case ELOOP: return "ELOOP";
+#endif
+#ifdef EMFILE
+  case EMFILE: return "EMFILE";
+#endif
+#ifdef EMLINK
+  case EMLINK: return "EMLINK";
+#endif
+#ifdef EMSGSIZE
+  case EMSGSIZE: return "EMSGSIZE";
+#endif
+#ifdef EMULTIHOP
+  case EMULTIHOP: return "EMULTIHOP";
+#endif
+  case ENAMETOOLONG: return "ENAMETOOLONG";
+#ifdef ENETDOWN
+  case ENETDOWN: return "ENETDOWN";
+#endif
+#ifdef ENETRESET
+  case ENETRESET: return "ENETRESET";
+#endif
+#ifdef ENETUNREACH
+  case ENETUNREACH: return "ENETUNREACH";
+#endif
+#ifdef ENFILE
+  case ENFILE: return "ENFILE";
+#endif
+#ifdef ENOBUFS
+  case ENOBUFS: return "ENOBUFS";
+#endif
+#ifdef ENODATA
+  case ENODATA: return "ENODATA";
+#endif
+#ifdef ENODEV
+  case ENODEV: return "ENODEV";
+#endif
+  case ENOENT: return "ENOENT";
+#ifdef ENOEXEC
+  case ENOEXEC: return "ENOEXEC";
+#endif
+#ifdef ENOLCK
+  case ENOLCK: return "ENOLCK";
+#endif
+#ifdef ENOLINK
+  case ENOLINK: return "ENOLINK";
+#endif
+  case ENOMEM: return "ENOMEM";
+#ifdef ENOMSG
+  case ENOMSG: return "ENOMSG";
+#endif
+#ifdef ENOPROTOOPT
+  case ENOPROTOOPT: return "ENOPROTOOPT";
+#endif
+#ifdef ENOSPC
+  case ENOSPC: return "ENOSPC";
+#endif
+#ifdef ENOSR
+  case ENOSR: return "ENOSR";
+#endif
+#ifdef ENOSTR
+  case ENOSTR: return "ENOSTR";
+#endif
+#ifdef ENOSYS
+  case ENOSYS: return "ENOSYS";
+#endif
+#ifdef ENOTCONN
+  case ENOTCONN: return "ENOTCONN";
+#endif
+#ifdef ENOTDIR
+  case ENOTDIR: return "ENOTDIR";
+#endif
+// AIX: ENOTEMPTY == EEXIST
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST)
+  case ENOTEMPTY: return "ENOTEMPTY";
+#endif
+#ifdef ENOTSOCK
+  case ENOTSOCK: return "ENOTSOCK";
+#endif
+#ifdef ENOTSUP
+  case ENOTSUP: return "ENOTSUP";
+#endif
+#ifdef ENOTTY
+  case ENOTTY: return "ENOTTY";
+#endif
+#ifdef ENXIO
+  case ENXIO: return "ENXIO";
+#endif
+// on some unices EOPNOTSUPP==ENOTSUPP
+#if defined(ENOTSUP) && defined(EOPNOTSUPP) && (EOPNOTSUPP != ENOTSUP)
+  case EOPNOTSUPP: return "EOPNOTSUPP";
+#endif
+#ifdef EOVERFLOW
+  case EOVERFLOW: return "EOVERFLOW";
+#endif
+#ifdef EPERM
+  case EPERM: return "EPERM";
+#endif
+#ifdef EPIPE
+  case EPIPE: return "EPIPE";
+#endif
+#ifdef EPROTO
+  case EPROTO: return "EPROTO";
+#endif
+#ifdef EPROTONOSUPPORT
+  case EPROTONOSUPPORT: return "EPROTONOSUPPORT";
+#endif
+#ifdef EPROTOTYPE
+  case EPROTOTYPE: return "EPROTOTYPE";
+#endif
+  case ERANGE: return "ERANGE";
+#ifdef EROFS
+  case EROFS: return "EROFS";
+#endif
+#ifdef ESPIPE
+  case ESPIPE: return "ESPIPE";
+#endif
+#ifdef ESRCH
+  case ESRCH: return "ESRCH";
+#endif
+#ifdef ESTALE
+  case ESTALE: return "ESTALE";
+#endif
+#ifdef ETIME
+  case ETIME: return "ETIME";
+#endif
+#ifdef ETIMEDOUT
+  case ETIMEDOUT: return "ETIMEDOUT";
+#endif
+#ifdef ETXTBSY
+  case ETXTBSY: return "ETXTBSY";
+#endif
+// on some unices EWOULDBLOCK==EAGAIN
+#if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN)
+  case EWOULDBLOCK: return "EWOULDBLOCK";
+#endif
+#ifdef EXDEV
+  case EXDEV: return "EXDEV";
+#endif
+  default: return "unknown";
+  }
+}
+
+
< prev index next >