jdk/src/solaris/demo/jvmti/hprof/hprof_md.c
changeset 22597 7515a991bb37
parent 16726 f76b2e6bd199
--- a/jdk/src/solaris/demo/jvmti/hprof/hprof_md.c	Thu Nov 21 12:28:16 2013 -0800
+++ b/jdk/src/solaris/demo/jvmti/hprof/hprof_md.c	Tue Nov 26 16:40:31 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -42,7 +42,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#if !defined(LINUX) && !defined(_ALLBSD_SOURCE)
+#if !defined(LINUX) && !defined(_ALLBSD_SOURCE) && !defined(AIX)
 #include <procfs.h>
 #endif
 
@@ -65,6 +65,10 @@
 #include "jvm_md.h"
 #include "hprof.h"
 
+#ifdef AIX
+#include "porting_aix.h" /* For the 'dladdr' function. */
+#endif
+
 int
 md_getpid(void)
 {
@@ -86,7 +90,7 @@
 void
 md_init(void)
 {
-#if defined(LINUX) || defined(_ALLBSD_SOURCE)
+#if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(AIX)
     /* No Hi-Res timer option? */
 #else
     if ( gdata->micro_state_accounting ) {
@@ -253,7 +257,7 @@
 jlong
 md_get_microsecs(void)
 {
-#if defined(LINUX) || defined(_ALLBSD_SOURCE)
+#if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(AIX)
     return (jlong)(md_timeofday() * (jlong)1000); /* Milli to micro */
 #else
     return (jlong)(gethrtime()/(hrtime_t)1000); /* Nano seconds to micro seconds */
@@ -271,7 +275,7 @@
 jlong
 md_get_thread_cpu_timemillis(void)
 {
-#if defined(LINUX) || defined(_ALLBSD_SOURCE)
+#if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(AIX)
     return md_timeofday();
 #else
     return (jlong)(gethrvtime()/1000); /* Nano seconds to milli seconds */
@@ -286,7 +290,7 @@
     Dl_info dlinfo;
 
     libdir[0] = 0;
-#if defined(LINUX) || defined(_ALLBSD_SOURCE)
+#if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(AIX)
     addr = (void*)&Agent_OnLoad;
 #else
     /* Just using &Agent_OnLoad will get the first external symbol with
@@ -457,3 +461,5 @@
     sym =  dlsym(handle, name);
     return sym;
 }
+
+