changeset 1495:d6d1af32c5f9

. Make changes to the BSD specific files equivalent to the Linux specific changes.
author Greg Lewis <glewis@eyesbeyond.com>
date Sun, 09 May 2010 14:48:29 -0700
parents 178bf8b51447
children 395f9d4370b0
files make/bsd/makefiles/adlc.make src/os/bsd/vm/attachListener_bsd.cpp src/os/bsd/vm/os_bsd.cpp src/os/bsd/vm/perfMemory_bsd.cpp src/os_cpu/bsd_zero/vm/thread_bsd_zero.hpp
diffstat 5 files changed, 25 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/make/bsd/makefiles/adlc.make	Sat May 08 10:54:27 2010 -0700
+++ b/make/bsd/makefiles/adlc.make	Sun May 09 14:48:29 2010 -0700
@@ -127,6 +127,9 @@
 # Note that product files are updated via "mv", which is atomic.
 TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
 
+# Debuggable by default
+CFLAGS += -g
+
 # Pass -D flags into ADLC.
 ADLCFLAGS += $(SYSDEFS)
 
@@ -135,7 +138,7 @@
 
 # Normally, debugging is done directly on the ad_<arch>*.cpp files.
 # But -g will put #line directives in those files pointing back to <arch>.ad.
-#ADLCFLAGS += -g
+ADLCFLAGS += -g
 
 ifdef LP64
 ADLCFLAGS += -D_LP64
--- a/src/os/bsd/vm/attachListener_bsd.cpp	Sat May 08 10:54:27 2010 -0700
+++ b/src/os/bsd/vm/attachListener_bsd.cpp	Sun May 09 14:48:29 2010 -0700
@@ -179,7 +179,8 @@
   struct sockaddr_un addr;
   addr.sun_family = AF_UNIX;
 
-  sprintf(path, "%s/.java_pid%d", os::get_temp_directory(), os::current_process_id());
+  snprintf(path, PATH_MAX+1, "%s/.java_pid%d",
+           os::get_temp_directory(), os::current_process_id());
   strcpy(addr.sun_path, path);
   ::unlink(path);
   res = ::bind(listener, (struct sockaddr*)&addr, sizeof(addr));
@@ -463,7 +464,8 @@
   int ret;
   struct stat st;
 
-  sprintf(path, "%s/.attach_pid%d", os::get_temp_directory(), os::current_process_id());
+  snprintf(path, PATH_MAX + 1, "%s/.attach_pid%d",
+           os::get_temp_directory(), os::current_process_id());
   RESTARTABLE(::stat(path, &st), ret);
   if (ret == 0) {
     // simple check to avoid starting the attach mechanism when
--- a/src/os/bsd/vm/os_bsd.cpp	Sat May 08 10:54:27 2010 -0700
+++ b/src/os/bsd/vm/os_bsd.cpp	Sun May 09 14:48:29 2010 -0700
@@ -1651,7 +1651,10 @@
 
 const char* os::dll_file_extension() { return JNI_LIB_SUFFIX; }
 
-const char* os::get_temp_directory() { return "/tmp/"; }
+const char* os::get_temp_directory() {
+  const char *prop = Arguments::get_property("java.io.tmpdir");
+  return prop == NULL ? "/tmp" : prop;
+}
 
 static bool file_exists(const char* filename) {
   struct stat statbuf;
@@ -2542,10 +2545,11 @@
     return;
   }
 
-  char buf[40];
+  char buf[PATH_MAX + 1];
   int num = Atomic::add(1, &cnt);
 
-  sprintf(buf, "/tmp/hs-vm-%d-%d", os::current_process_id(), num);
+  snprintf(buf, PATH_MAX + 1, "%s/hs-vm-%d-%d",
+           os::get_temp_directory(), os::current_process_id(), num);
   unlink(buf);
 
   int fd = open(buf, O_CREAT | O_RDWR, S_IRWXU);
--- a/src/os/bsd/vm/perfMemory_bsd.cpp	Sat May 08 10:54:27 2010 -0700
+++ b/src/os/bsd/vm/perfMemory_bsd.cpp	Sun May 09 14:48:29 2010 -0700
@@ -145,11 +145,11 @@
 
   const char* tmpdir = os::get_temp_directory();
   const char* perfdir = PERFDATA_NAME;
-  size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 2;
+  size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 3;
   char* dirname = NEW_C_HEAP_ARRAY(char, nbytes);
 
   // construct the path name to user specific tmp directory
-  snprintf(dirname, nbytes, "%s%s_%s", tmpdir, perfdir, user);
+  snprintf(dirname, nbytes, "%s/%s_%s", tmpdir, perfdir, user);
 
   return dirname;
 }
@@ -331,8 +331,9 @@
     }
 
     char* usrdir_name = NEW_C_HEAP_ARRAY(char,
-                              strlen(tmpdirname) + strlen(dentry->d_name) + 1);
+                              strlen(tmpdirname) + strlen(dentry->d_name) + 2);
     strcpy(usrdir_name, tmpdirname);
+    strcat(usrdir_name, "/");
     strcat(usrdir_name, dentry->d_name);
 
     DIR* subdirp = os::opendir(usrdir_name);
--- a/src/os_cpu/bsd_zero/vm/thread_bsd_zero.hpp	Sat May 08 10:54:27 2010 -0700
+++ b/src/os_cpu/bsd_zero/vm/thread_bsd_zero.hpp	Sun May 09 14:48:29 2010 -0700
@@ -1,6 +1,6 @@
 /*
  * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2007, 2008, 2009 Red Hat, Inc.
+ * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,12 +68,13 @@
 
  public:
   void set_last_Java_frame() {
-    JavaFrameAnchor *jfa = frame_anchor();
-    jfa->set_last_Java_sp((intptr_t *) top_zero_frame());
+    set_last_Java_frame(top_zero_frame());
   }
   void reset_last_Java_frame() {
-    JavaFrameAnchor *jfa = frame_anchor();
-    jfa->set_last_Java_sp(NULL);
+    set_last_Java_frame(NULL);
+  }
+  void set_last_Java_frame(ZeroFrame* frame) {
+    frame_anchor()->set_last_Java_sp((intptr_t *) frame);
   }
 
  private: