8374544: Add SleepyCat diagnostics for all platforms

Reviewed-by: jpai
This commit is contained in:
Roger Riggs 2026-01-06 18:07:43 +00:00
parent fbc59ac0a1
commit f1e0e0c25e
2 changed files with 9 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -66,26 +66,19 @@ public class SleepyCat {
* @param pids the processes to dump status for
*/
static void dumpState(Process... pids) {
if (!System.getProperty("os.name").contains("SunOS")) {
return;
}
try {
String[] psArgs = {"ps", "-elf"};
Process ps = new ProcessBuilder(psArgs).inheritIO().start();
ps.waitFor();
String[] sfiles = {"pfiles", "self"};
Process fds = new ProcessBuilder(sfiles).inheritIO().start();
fds.waitFor();
try (Process ps = new ProcessBuilder(psArgs).inheritIO().start()) {
ps.waitFor();
}
for (Process p : pids) {
if (p == null)
continue;
String[] pfiles = {"pfiles", Long.toString(p.pid())};
fds = new ProcessBuilder(pfiles).inheritIO().start();
fds.waitFor();
String[] pstack = {"pstack", Long.toString(p.pid())};
fds = new ProcessBuilder(pstack).inheritIO().start();
fds.waitFor();
String[] pfiles = {"lsof", "-p", Long.toString(p.pid())};
try (Process fds = new ProcessBuilder(pfiles).inheritIO().start()) {
fds.waitFor();
}
}
} catch (IOException | InterruptedException i) {
i.printStackTrace();

View File

@ -0,0 +1 @@
maxOutputSize=6000000