Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6447182

temp dir locations should not be hardcoded for hsperfdata_<USER> dirctories

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: hs14, 5.0, 6
    • Fix Version/s: 7-pool
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Topic "hsperfdata_<USER> dirctories" was updated by briansully with the following message:
      ------------------------------------------------
      From googling the net and searching these forums I understand the JVM needs to create the hsperfdata files. I can live with that I guess. My problem is that the JVM always creates them in /tmp on my SuSE Enterprise 9 server. I need to be able to specify the location of these files. I tried setting environment variables, TMP and TEMP. That did not work. I tried a -Djava.io.tmpdir=/mydir and that did not work.

      I went to the JVM source and found in perfMemory_linux.cpp:

      static char* get_user_tmp_dir(const char* user) {

        const char* tmpdir = os::get_temp_directory();
        const char* perfdir = PERFDATA_NAME;
        size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 2;
        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);

        return dirname;
      }

      I then tracked down this get_temp_directory function and found this in os_linux.cpp:

      const char* os::get_temp_directory() { return "/tmp/"; }

      So this means the JVM is hard coded to access /tmp. There is no reason the JVM should be hardcoded to such a location, it should be customizable through some sort of parameter. Anyone have ideas?
      ------------------------------------------------

      To view the topic, visit:
      http://forum.java.sun.com/thread.jspa?forumID=37&threadID=750466

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              coleenp Coleen Phillimore
              Reporter:
              collins Gary Collins (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: