Skip to content

Commit 3b4f708

Browse files
sunny868heiherjkotas
authored
Redefine signal for architecture mips (#40513)
define SIGSTOP 19 is just ok for architecture x86、arm、s390、powerpc and so on. but others architecture has different values. Co-authored-by: Sunguoyun <[email protected]> Co-authored-by: hev <[email protected]> Co-authored-by: Jan Kotas <[email protected]>
1 parent 7e09794 commit 3b4f708

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

src/libraries/Native/Unix/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ elseif (CLR_CMAKE_TARGET_ARCH_WASM)
6464
elseif (CLR_CMAKE_TARGET_ARCH_ARM64)
6565
add_definitions(-DTARGET_64BIT=1)
6666
add_definitions(-DTARGET_ARM64)
67+
elseif (CLR_CMAKE_TARGET_ARCH_MIPS64)
68+
add_definitions(-DTARGET_64BIT=1)
69+
add_definitions(-DTARGET_MIPS64)
6770
elseif (CLR_CMAKE_TARGET_ARCH_ARM)
6871
add_definitions(-DTARGET_32BIT=1)
6972
add_definitions(-DTARGET_ARM)

src/libraries/Native/Unix/System.Native/pal_process.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
#include <sched.h>
2929
#endif
3030

31-
// Validate that our Signals enum values are correct for the platform
32-
c_static_assert(PAL_SIGKILL == SIGKILL);
3331

3432
// Validate that our SysLogPriority values are correct for the platform
3533
c_static_assert(PAL_LOG_EMERG == LOG_EMERG);
@@ -653,6 +651,26 @@ int32_t SystemNative_SetRLimit(RLimitResources resourceType, const RLimit* limit
653651

654652
int32_t SystemNative_Kill(int32_t pid, int32_t signal)
655653
{
654+
switch (signal)
655+
{
656+
case PAL_NONE:
657+
signal = 0;
658+
break;
659+
660+
case PAL_SIGKILL:
661+
signal = SIGKILL;
662+
break;
663+
664+
case PAL_SIGSTOP:
665+
signal = SIGSTOP;
666+
break;
667+
668+
default:
669+
assert_msg(false, "Unknown signal", signal);
670+
errno = EINVAL;
671+
return -1;
672+
}
673+
656674
return kill(pid, signal);
657675
}
658676

src/libraries/Native/Unix/System.Native/pal_process.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ typedef enum
7272

7373
typedef enum
7474
{
75+
PAL_NONE = 0,
7576
PAL_SIGKILL = 9, /* kill the specified process */
77+
PAL_SIGSTOP = 19,
7678
} Signals;
7779

7880
/**

0 commit comments

Comments
 (0)