Skip to content

Commit cb294d9

Browse files
committed
8289910: unify os::message_box across posix platforms
Backport-of: e5491a2605177a9dca87a060d99aa5ea4fd4a239
1 parent 92571e3 commit cb294d9

File tree

4 files changed

+20
-57
lines changed

4 files changed

+20
-57
lines changed

src/hotspot/os/aix/os_aix.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2538,25 +2538,6 @@ os::os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& me
25382538
void os::print_statistics() {
25392539
}
25402540

2541-
bool os::message_box(const char* title, const char* message) {
2542-
int i;
2543-
fdStream err(defaultStream::error_fd());
2544-
for (i = 0; i < 78; i++) err.print_raw("=");
2545-
err.cr();
2546-
err.print_raw_cr(title);
2547-
for (i = 0; i < 78; i++) err.print_raw("-");
2548-
err.cr();
2549-
err.print_raw_cr(message);
2550-
for (i = 0; i < 78; i++) err.print_raw("=");
2551-
err.cr();
2552-
2553-
char buf[16];
2554-
// Prevent process from exiting upon "read error" without consuming all CPU
2555-
while (::read(0, buf, sizeof(buf)) <= 0) { ::sleep(100); }
2556-
2557-
return buf[0] == 'y' || buf[0] == 'Y';
2558-
}
2559-
25602541
// This code originates from JDK's sysOpen and open64_w
25612542
// from src/solaris/hpi/src/system_md.c
25622543

src/hotspot/os/bsd/os_bsd.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,25 +2239,6 @@ void os::os_exception_wrapper(java_call_t f, JavaValue* value,
22392239
void os::print_statistics() {
22402240
}
22412241

2242-
bool os::message_box(const char* title, const char* message) {
2243-
int i;
2244-
fdStream err(defaultStream::error_fd());
2245-
for (i = 0; i < 78; i++) err.print_raw("=");
2246-
err.cr();
2247-
err.print_raw_cr(title);
2248-
for (i = 0; i < 78; i++) err.print_raw("-");
2249-
err.cr();
2250-
err.print_raw_cr(message);
2251-
for (i = 0; i < 78; i++) err.print_raw("=");
2252-
err.cr();
2253-
2254-
char buf[16];
2255-
// Prevent process from exiting upon "read error" without consuming all CPU
2256-
while (::read(0, buf, sizeof(buf)) <= 0) { ::sleep(100); }
2257-
2258-
return buf[0] == 'y' || buf[0] == 'Y';
2259-
}
2260-
22612242
static inline struct timespec get_mtime(const char* filename) {
22622243
struct stat st;
22632244
int ret = os::stat(filename, &st);

src/hotspot/os/linux/os_linux.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4908,25 +4908,6 @@ os::os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& me
49084908
void os::print_statistics() {
49094909
}
49104910

4911-
bool os::message_box(const char* title, const char* message) {
4912-
int i;
4913-
fdStream err(defaultStream::error_fd());
4914-
for (i = 0; i < 78; i++) err.print_raw("=");
4915-
err.cr();
4916-
err.print_raw_cr(title);
4917-
for (i = 0; i < 78; i++) err.print_raw("-");
4918-
err.cr();
4919-
err.print_raw_cr(message);
4920-
for (i = 0; i < 78; i++) err.print_raw("=");
4921-
err.cr();
4922-
4923-
char buf[16];
4924-
// Prevent process from exiting upon "read error" without consuming all CPU
4925-
while (::read(0, buf, sizeof(buf)) <= 0) { ::sleep(100); }
4926-
4927-
return buf[0] == 'y' || buf[0] == 'Y';
4928-
}
4929-
49304911
// This code originates from JDK's sysOpen and open64_w
49314912
// from src/solaris/hpi/src/system_md.c
49324913

src/hotspot/os/posix/os_posix.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "runtime/orderAccess.hpp"
4646
#include "runtime/perfMemory.hpp"
4747
#include "utilities/align.hpp"
48+
#include "utilities/defaultStream.hpp"
4849
#include "utilities/events.hpp"
4950
#include "utilities/formatBuffer.hpp"
5051
#include "utilities/macros.hpp"
@@ -1995,6 +1996,25 @@ int os::fork_and_exec(const char* cmd, bool prefer_vfork) {
19951996
}
19961997
}
19971998

1999+
bool os::message_box(const char* title, const char* message) {
2000+
int i;
2001+
fdStream err(defaultStream::error_fd());
2002+
for (i = 0; i < 78; i++) err.print_raw("=");
2003+
err.cr();
2004+
err.print_raw_cr(title);
2005+
for (i = 0; i < 78; i++) err.print_raw("-");
2006+
err.cr();
2007+
err.print_raw_cr(message);
2008+
for (i = 0; i < 78; i++) err.print_raw("=");
2009+
err.cr();
2010+
2011+
char buf[16];
2012+
// Prevent process from exiting upon "read error" without consuming all CPU
2013+
while (::read(0, buf, sizeof(buf)) <= 0) { ::sleep(100); }
2014+
2015+
return buf[0] == 'y' || buf[0] == 'Y';
2016+
}
2017+
19982018
////////////////////////////////////////////////////////////////////////////////
19992019
// runtime exit support
20002020

0 commit comments

Comments
 (0)