Skip to content

Commit 64b25ea

Browse files
author
David Holmes
committed
8291569: Consider removing JNI checks for signals SIGPIPE and SIGXFSZ
Reviewed-by: stuefe, rehn
1 parent 1ff4646 commit 64b25ea

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/hotspot/os/posix/signals_posix.cpp

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2023, 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
@@ -921,8 +921,6 @@ void os::run_periodic_checks(outputStream* st) {
921921
print_handlers |= check_signal_handler(SIGILL);
922922
print_handlers |= check_signal_handler(SIGFPE);
923923
print_handlers |= check_signal_handler(SIGBUS);
924-
print_handlers |= check_signal_handler(SIGPIPE);
925-
print_handlers |= check_signal_handler(SIGXFSZ);
926924
PPC64_ONLY(print_handlers |= check_signal_handler(SIGTRAP);)
927925

928926
// ReduceSignalUsage allows the user to override these handlers
@@ -936,6 +934,9 @@ void os::run_periodic_checks(outputStream* st) {
936934

937935
print_handlers |= check_signal_handler(PosixSignals::SR_signum);
938936

937+
// As we ignore SIGPIPE and SIGXFSZ, and expect other code to potentially
938+
// install handlers for them, we don't bother checking them here.
939+
939940
if (print_handlers) {
940941
// If we had a mismatch:
941942
// - print all signal handlers. As part of that printout, details will be printed
@@ -1274,7 +1275,13 @@ void set_signal_handler(int sig) {
12741275
// Save handler setup for possible later checking
12751276
vm_handlers.set(sig, &sigAct);
12761277

1277-
do_check_signal_periodically[sig] = true;
1278+
bool do_check = true;
1279+
if (sig == SIGPIPE || sig == SIGXFSZ) {
1280+
// As we ignore these signals, and expect other code to potentially
1281+
// install handlers for them, we don't bother checking them.
1282+
do_check = false;
1283+
}
1284+
do_check_signal_periodically[sig] = do_check;
12781285
#ifdef ASSERT
12791286
void* oldhand2 = get_signal_handler(&oldAct);
12801287
assert(oldhand2 == oldhand, "no concurrent signal handler installation");

0 commit comments

Comments
 (0)