Skip to content

Commit f1e0e0c

Browse files
author
Roger Riggs
committed
8374544: Add SleepyCat diagnostics for all platforms
Reviewed-by: jpai
1 parent fbc59ac commit f1e0e0c

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

test/jdk/java/lang/RuntimeTests/exec/SleepyCat.java

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -66,26 +66,19 @@ public boolean timedOut() {
6666
* @param pids the processes to dump status for
6767
*/
6868
static void dumpState(Process... pids) {
69-
if (!System.getProperty("os.name").contains("SunOS")) {
70-
return;
71-
}
7269
try {
7370
String[] psArgs = {"ps", "-elf"};
74-
Process ps = new ProcessBuilder(psArgs).inheritIO().start();
75-
ps.waitFor();
76-
String[] sfiles = {"pfiles", "self"};
77-
Process fds = new ProcessBuilder(sfiles).inheritIO().start();
78-
fds.waitFor();
71+
try (Process ps = new ProcessBuilder(psArgs).inheritIO().start()) {
72+
ps.waitFor();
73+
}
7974

8075
for (Process p : pids) {
8176
if (p == null)
8277
continue;
83-
String[] pfiles = {"pfiles", Long.toString(p.pid())};
84-
fds = new ProcessBuilder(pfiles).inheritIO().start();
85-
fds.waitFor();
86-
String[] pstack = {"pstack", Long.toString(p.pid())};
87-
fds = new ProcessBuilder(pstack).inheritIO().start();
88-
fds.waitFor();
78+
String[] pfiles = {"lsof", "-p", Long.toString(p.pid())};
79+
try (Process fds = new ProcessBuilder(pfiles).inheritIO().start()) {
80+
fds.waitFor();
81+
}
8982
}
9083
} catch (IOException | InterruptedException i) {
9184
i.printStackTrace();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
maxOutputSize=6000000

0 commit comments

Comments
 (0)