harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r982039 - in /harmony/enhanced/java/branches/java6: ./ classlib/ classlib/depends/libs/ drlvm/ jdktools/ jdktools/modules/samsa/src/main/native/samsa/samsa.c
Date Tue, 03 Aug 2010 21:33:26 GMT
Author: hindessm
Date: Tue Aug  3 21:33:26 2010
New Revision: 982039

URL: http://svn.apache.org/viewvc?rev=982039&view=rev
Log:
Merge change from /harmony/enhanced/java/trunk@981763:

  r981763 | hindessm | 2010-08-03 08:35:40 +0100 (Tue, 03 Aug 2010) | 7 lines
  
  Revert all but the basename fix from commit r951009:
     These implementations should be portable enough that we don't need the
     #error.
  
  This will break on aix & z/OS until we add platform-specific implementation
  for them.
  


Modified:
    harmony/enhanced/java/branches/java6/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/depends/libs/   (props changed)
    harmony/enhanced/java/branches/java6/drlvm/   (props changed)
    harmony/enhanced/java/branches/java6/jdktools/   (props changed)
    harmony/enhanced/java/branches/java6/jdktools/modules/samsa/src/main/native/samsa/samsa.c

Propchange: harmony/enhanced/java/branches/java6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug  3 21:33:26 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/java/branches/mrh:935751-941490
-/harmony/enhanced/java/trunk:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356
+/harmony/enhanced/java/trunk:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763
 /harmony/enhanced/trunk:476395-929252
 /incubator/harmony/enhanced/trunk:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug  3 21:33:26 2010
@@ -1,7 +1,7 @@
 /harmony/enhanced/classlib/trunk:713674-735919,765923-926091,926318-926838
 /harmony/enhanced/classlib/trunk/working_classlib:884014-884286
 /harmony/enhanced/java/branches/mrh/classlib:935751-941490
-/harmony/enhanced/java/trunk/classlib:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356
+/harmony/enhanced/java/trunk/classlib:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763
 /harmony/enhanced/trunk/classlib:476395-929252
 /harmony/enhanced/trunk/working_classlib:476396-920147
 /incubator/harmony/enhanced/trunk/classlib:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/depends/libs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug  3 21:33:26 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/classlib/trunk/depends/libs:544451-926091
-/harmony/enhanced/java/trunk/classlib/depends/libs:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356
+/harmony/enhanced/java/trunk/classlib/depends/libs:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763
 /harmony/enhanced/trunk/classlib/depends/libs:476395-929252
 /incubator/harmony/enhanced/trunk/classlib/depends/libs:292550-476394

Propchange: harmony/enhanced/java/branches/java6/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug  3 21:33:26 2010
@@ -1,5 +1,5 @@
 /harmony/enhanced/java/branches/mrh/drlvm:935751-941490
-/harmony/enhanced/java/trunk/drlvm:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356
+/harmony/enhanced/java/trunk/drlvm:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763
 /harmony/enhanced/trunk/drlvm:476395-929252
 /harmony/enhanced/trunk/working_vm:476396-920147
 /incubator/harmony/enhanced/trunk/drlvm:292550-476394

Propchange: harmony/enhanced/java/branches/java6/jdktools/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug  3 21:33:26 2010
@@ -1,4 +1,4 @@
-/harmony/enhanced/java/trunk/jdktools:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356
+/harmony/enhanced/java/trunk/jdktools:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763
 /harmony/enhanced/jdktools/trunk:630107-925933
 /harmony/enhanced/trunk/jdktools:476395-929252
 /harmony/enhanced/trunk/working_jdktools:476396-920147

Modified: harmony/enhanced/java/branches/java6/jdktools/modules/samsa/src/main/native/samsa/samsa.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/jdktools/modules/samsa/src/main/native/samsa/samsa.c?rev=982039&r1=982038&r2=982039&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/jdktools/modules/samsa/src/main/native/samsa/samsa.c
(original)
+++ harmony/enhanced/java/branches/java6/jdktools/modules/samsa/src/main/native/samsa/samsa.c
Tue Aug  3 21:33:26 2010
@@ -15,10 +15,6 @@
  *  limitations under the License.
  */
 
-#if defined(FREEBSD)
-#include <sys/param.h>
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
@@ -95,8 +91,8 @@ typedef struct ToolData {
 } TOOLDATA;
 
 char     *cleanToolName(const char *);
-char     *getExeDir(const char*);
-char     *getRoot(const char*);
+char     *getExeDir();
+char     *getRoot();
 TOOLDATA *getToolData(const char *, const char *, int toolType);
 int getToolType(const char*, const char*);
 char* jarFile(const char*, const char*);
@@ -145,7 +141,7 @@ int main (int argc, char **argv, char **
      *  and the full paths to jars.  This way, we can be called 
      *  from anywhere
      */    
-    root = getRoot(argv[0]);
+    root = getRoot();
 
 //    printf("root = %s\n", root);
     
@@ -437,14 +433,14 @@ char *cleanToolName(const char *name) 
 }
 
 /******************************************************************
- *  getRoot(const char* argv0)
+ *  getRoot()
  * 
  *  returns the root (JDK or JRE) where this executable is located
  *  if it can figure it out or NULL if it can't
  */
-char *getRoot(const char* argv0) { 
+char *getRoot() { 
     
-    char *exeDir = getExeDir(argv0);
+    char *exeDir = getExeDir();
 
     char *last = strrchr(exeDir, PATH_SEPARATOR_CHAR);
     
@@ -457,27 +453,36 @@ char *getRoot(const char* argv0) { 
 }
 
 /*****************************************************************
- * getExeDir(const char* argv0)
+ * getExeDir()
  * 
  *  returns directory of running exe
  */
-char *getExeDir(const char* argv0) {
+char *getExeDir() {
 
     char *last = NULL;
     
-#if defined(WIN32)
+#if defined(LINUX)
+    char buffer[PATH_MAX + 1];
+    
+    int size = readlink ("/proc/self/exe", buffer, sizeof(buffer)-2);
+    
+    buffer[size+1] = '\0';
+#elif defined(FREEBSD)
+    Dl_info info;
+    char buffer[PATH_MAX + 1];
+    if (dladdr( (const void*)&main, &info) == 0) {
+        return NULL;
+    }
+    strncpy(buffer, info.dli_fname, PATH_MAX);
+    buffer[PATH_MAX] = '\0';
+
+#elif defined(WIN32)
     char buffer[512];
     DWORD dwRet = GetModuleFileName(NULL, buffer, 512);
         
     // FIXME - handle this right - it could be that 512 isn't enough
 #else
-    char buffer[PATH_MAX + 1];
-
-    char *rc = realpath(argv0, buffer);
-    if (!rc) {
-      return NULL;
-    }
-    buffer[PATH_MAX] = '\0';
+#error Need to implement executable name code
 #endif
 
     last = strrchr(buffer, PATH_SEPARATOR_CHAR);



Mime
View raw message