On Fri, 5 Jun 2026 18:11:24 GMT, Coleen Phillimore <[email protected]> wrote:

> Please review this change to allow XX configuration for specifying a 
> different /tmp directory for the JVM to use.  In some container environments, 
> /tmp and /proc/pid/root/tmp might not be usable and an alternate would be 
> used.  This requires a release note and CSR.   Usage is:
> 
> java -XX:AltTempDir=/diags <app>
> jps -J-XX:AltTempDir=/diags
> jcmd -J-XX:AltTempDir=/diags <pid> <cmds>
> 
> Tested with a couple of tests and locally, and ran tier1-4.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Generally looks good. We have multiple other ways in Hotspot to have a user 
specify a directory or path that the VM may write a file to, so I don't see 
this having any concerns that we don't normally also have.

src/hotspot/os/posix/perfMemory_posix.cpp line 140:

> 138: static char* get_user_tmp_dir(const char* user, int vmid, int nspid) {
> 139:   char* tmpdir = (char *)os::get_temp_directory();
> 140:   char buffer[PATH_MAX] = {0};

> The functions snprintf() and vsnprintf() write at most size bytes (including 
> the terminating null byte ('\0')) to str. 

So this can store a path that's 1 less byte than the actual `PATH_MAX`.

-------------

Marked as reviewed by jsjolen (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/31407#pullrequestreview-4456277356
PR Review Comment: https://git.openjdk.org/jdk/pull/31407#discussion_r3378704033

Reply via email to