Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions include_core/omrporterror.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@
#define OMRPORT_ERROR_STARTUP_SHMEM_MOSERVICE (OMRPORT_ERROR_STARTUP_BASE -25)
#define OMRPORT_ERROR_STARTUP_SYSINFO_MONITOR_INIT (OMRPORT_ERROR_STARTUP_BASE -26)
#define OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS (OMRPORT_ERROR_STARTUP_BASE -27)
#define OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS1 OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS
#define OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS2 (OMRPORT_ERROR_STARTUP_BASE -28)
#define OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS3 (OMRPORT_ERROR_STARTUP_BASE -29)
#define OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS4 (OMRPORT_ERROR_STARTUP_BASE -30)
#define OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS5 (OMRPORT_ERROR_STARTUP_BASE -31)
#define OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS6 (OMRPORT_ERROR_STARTUP_BASE -32)
#define OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS7 (OMRPORT_ERROR_STARTUP_BASE -33)
#define OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS8 (OMRPORT_ERROR_STARTUP_BASE -34)
#define OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS9 (OMRPORT_ERROR_STARTUP_BASE -35)
#define OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS10 (OMRPORT_ERROR_STARTUP_BASE -36)
#define OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS11 (OMRPORT_ERROR_STARTUP_BASE -37)
#define OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS12 (OMRPORT_ERROR_STARTUP_BASE -38)

/** @} */

Expand Down
24 changes: 11 additions & 13 deletions port/unix/omrsignal.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,9 +768,7 @@ omrsig_startup(struct OMRPortLibrary *portLibrary)
oldActions[index].restore = 0;
}

if (0 != initializeSignalTools(portLibrary)) {
result = OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS;
}
result = initializeSignalTools(portLibrary);

}
omrthread_monitor_exit(globalMonitor);
Expand Down Expand Up @@ -1561,30 +1559,30 @@ initializeSignalTools(OMRPortLibrary *portLibrary)

/* use this to record the end of the list of signal infos */
if (omrthread_tls_alloc(&tlsKey)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS1;
}

/* use this to record the last signal that occurred such that we can call omrsig_handler in omrexit_shutdown_and_exit */
if (omrthread_tls_alloc(&tlsKeyCurrentSignal)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS2;
}

#if defined(OMR_PORT_ZOS_CEEHDLRSUPPORT)
if (0 != ceehdlr_startup(portLibrary)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS3;
}
#endif /* defined(OMR_PORT_ZOS_CEEHDLRSUPPORT) */

if (omrthread_monitor_init_with_name(&registerHandlerMonitor, 0, "portLibrary_omrsig_registerHandler_monitor")) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS4;
}

if (omrthread_monitor_init_with_name(&asyncReporterShutdownMonitor, 0, "portLibrary_omrsig_asynch_reporter_shutdown_monitor")) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS5;
}

if (omrthread_monitor_init_with_name(&asyncMonitor, 0, "portLibrary_omrsig_async_monitor")) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS6;
}

#if !defined(J9ZOS390)
Expand All @@ -1598,18 +1596,18 @@ initializeSignalTools(OMRPortLibrary *portLibrary)

/* The asynchronous signal reporter will wait on this semaphore */
if (SIGSEM_ERROR == SIGSEM_INIT(wakeUpASyncReporter, SIGSEM_NAME(0))) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS7;
}
SIGSEM_UNLINK(SIGSEM_NAME(0));
#undef SIGSEM_NAME

#else /* !defined(J9ZOS390) */
if (pthread_mutex_init(&wakeUpASyncReporterMutex, NULL)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS8;
}

if (pthread_cond_init(&wakeUpASyncReporterCond, NULL)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS9;
}

if (TRUE == checkIfResumableTrapsSupported(portLibrary)) {
Expand All @@ -1629,7 +1627,7 @@ initializeSignalTools(OMRPortLibrary *portLibrary)
NULL,
J9THREAD_CATEGORY_SYSTEM_THREAD)
) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS10;
}
#endif /* defined(OMR_PORT_ASYNC_HANDLER) */

Expand Down
28 changes: 13 additions & 15 deletions port/ztpf/omrsignal.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,7 @@ omrsig_startup(struct OMRPortLibrary *portLibrary)
for (index = 0; index < MAX_UNIX_SIGNAL_TYPES ;index++) {
oldActions[index].restore = 0;
}
if (0 != initializeSignalTools(portLibrary)) {
result = OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS;
}
result = initializeSignalTools(portLibrary);
}
omrthread_monitor_exit(globalMonitor);

Expand Down Expand Up @@ -1151,50 +1149,50 @@ initializeSignalTools(OMRPortLibrary *portLibrary)

/* use this to record the end of the list of signal infos */
if(omrthread_tls_alloc(&tlsKey)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS1;
}

/* use this to record the last signal that occured such that we can call omrsig_handler in omrexit_shutdown_and_exit */
if(omrthread_tls_alloc(&tlsKeyCurrentSignal)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS2;
}

if(omrthread_monitor_init_with_name( &mainHandlerMonitor, 0, "portLibrary_omrsig_mainHandler_monitor" ) ) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS3;
}

if(omrthread_monitor_init_with_name( &asyncReporterShutdownMonitor, 0, "portLibrary_omrsig_asynch_reporter_shutdown_monitor" ) ) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS4;
}

if(omrthread_monitor_init_with_name( &asyncMonitor, 0, "portLibrary_omrsig_async_monitor" ) ) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS5;
}

/* The asynchronous signal reporter will wait on this semaphore */
if(0 != sem_init(&wakeUpASyncReporter, 0, 0)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS6;
}

/* The asynchronous signal reporter keeps track of the number of pending singals with these... */
if(0 != sem_init(&sigQuitPendingSem, 0, 0)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS7;
}
if(0 != sem_init(&sigAbrtPendingSem, 0, 0)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS8;
}
if(0 != sem_init(&sigTermPendingSem, 0, 0)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS9;
}
if(0 != sem_init(&sigReconfigPendingSem, 0, 0)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS10;
}
if(0 != sem_init(&sigXfszPendingSem, 0, 0)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS11;
}
#if defined(OMR_PORT_ASYNC_HANDLER)
if(J9THREAD_SUCCESS != createThreadWithCategory(&asynchSignalReporterThread, 256 * 1024, J9THREAD_PRIORITY_MAX, 0, &asynchSignalReporter, NULL, J9THREAD_CATEGORY_SYSTEM_THREAD)) {
return -1;
return OMRPORT_ERROR_STARTUP_SIGNAL_TOOLS12;
}
#endif
return 0;
Expand Down