Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 99e7f7c

Browse files
committed
Merge pull request #2973 from krytarowski/netbsd-support-25
Disable FEATURE_HIJACK in NetBSD as unimplemented
2 parents eb780ed + 652335e commit 99e7f7c

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,9 +694,10 @@ if(FEATURE_EVENT_TRACE)
694694
endif(FEATURE_EVENT_TRACE)
695695
add_definitions(-DFEATURE_EXCEPTIONDISPATCHINFO)
696696
add_definitions(-DFEATURE_FRAMEWORK_INTERNAL)
697-
if(NOT CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM)
697+
# NetBSD doesn't implement this feature
698+
if(NOT CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
698699
add_definitions(-DFEATURE_HIJACK)
699-
endif(NOT CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM)
700+
endif(NOT CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
700701
add_definitions(-DFEATURE_HOST_ASSEMBLY_RESOLVER)
701702
add_definitions(-DFEATURE_HOSTED_BINDER)
702703
add_definitions(-DFEATURE_ICASTABLE)

src/pal/src/exception/signal.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ using namespace CorUnix;
4545

4646
SET_DEFAULT_DEBUG_CHANNEL(EXCEPT);
4747

48+
#ifdef SIGRTMIN
4849
#define INJECT_ACTIVATION_SIGNAL SIGRTMIN
50+
#endif
51+
52+
#if !defined(INJECT_ACTIVATION_SIGNAL) && defined(FEATURE_HIJACK)
53+
#error FEATURE_HIJACK requires INJECT_ACTIVATION_SIGNAL to be defined
54+
#endif
4955

5056
/* local type definitions *****************************************************/
5157

@@ -70,7 +76,9 @@ static void sigquit_handler(int code, siginfo_t *siginfo, void *context);
7076
static void common_signal_handler(PEXCEPTION_POINTERS pointers, int code,
7177
native_context_t *ucontext);
7278

79+
#ifdef INJECT_ACTIVATION_SIGNAL
7380
static void inject_activation_handler(int code, siginfo_t *siginfo, void *context);
81+
#endif
7482

7583
static void handle_signal(int signal_id, SIGFUNC sigfunc, struct sigaction *previousAction);
7684
static void restore_signal(int signal_id, struct sigaction *previousAction);
@@ -125,7 +133,9 @@ BOOL SEHInitializeSignals()
125133
handle_signal(SIGINT, sigint_handler, &g_previous_sigint);
126134
handle_signal(SIGQUIT, sigquit_handler, &g_previous_sigquit);
127135

136+
#ifdef INJECT_ACTIVATION_SIGNAL
128137
handle_signal(INJECT_ACTIVATION_SIGNAL, inject_activation_handler, NULL);
138+
#endif
129139

130140
/* The default action for SIGPIPE is process termination.
131141
Since SIGPIPE can be signaled when trying to write on a socket for which
@@ -484,6 +494,7 @@ static void sigquit_handler(int code, siginfo_t *siginfo, void *context)
484494
kill(gPID, code);
485495
}
486496

497+
#ifdef INJECT_ACTIVATION_SIGNAL
487498
/*++
488499
Function :
489500
inject_activation_handler
@@ -523,6 +534,7 @@ static void inject_activation_handler(int code, siginfo_t *siginfo, void *contex
523534
}
524535
}
525536
}
537+
#endif
526538

527539
/*++
528540
Function :
@@ -538,6 +550,7 @@ Parameters :
538550
--*/
539551
PAL_ERROR InjectActivationInternal(CorUnix::CPalThread* pThread)
540552
{
553+
#ifdef INJECT_ACTIVATION_SIGNAL
541554
int status = pthread_kill(pThread->GetPThreadSelf(), INJECT_ACTIVATION_SIGNAL);
542555
if (status != 0)
543556
{
@@ -550,6 +563,9 @@ PAL_ERROR InjectActivationInternal(CorUnix::CPalThread* pThread)
550563
}
551564

552565
return NO_ERROR;
566+
#else
567+
return ERROR_CANCELLED;
568+
#endif
553569
}
554570

555571
/*++

0 commit comments

Comments
 (0)