Define SIGSTOP for architecture mips (#40299)
authorSUN Guoyun <40024232+sunny868@users.noreply.github.com>
Thu, 6 Aug 2020 05:06:02 +0000 (13:06 +0800)
committerGitHub <noreply@github.com>
Thu, 6 Aug 2020 05:06:02 +0000 (22:06 -0700)
 define SIGSTOP 19 is just ok for architecture x86、arm、s390、powerpc and so on.
 but others architecture has different values.

Co-Authored-By: hev <wangrui@loongson.cn>
src/libraries/Native/Unix/CMakeLists.txt
src/libraries/Native/Unix/System.Native/pal_process.c
src/libraries/Native/Unix/System.Native/pal_process.h

index 3168c7e..a4f8970 100644 (file)
@@ -64,6 +64,9 @@ elseif (CLR_CMAKE_TARGET_ARCH_WASM)
 elseif (CLR_CMAKE_TARGET_ARCH_ARM64)
     add_definitions(-DTARGET_64BIT=1)
     add_definitions(-DTARGET_ARM64)
+elseif (CLR_CMAKE_TARGET_ARCH_MIPS64)
+    add_definitions(-DTARGET_64BIT=1)
+    add_definitions(-DTARGET_MIPS64)
 elseif (CLR_CMAKE_TARGET_ARCH_ARM)
     add_definitions(-DTARGET_32BIT=1)
     add_definitions(-DTARGET_ARM)
index 6d86efe..a1559e8 100644 (file)
@@ -28,8 +28,6 @@
 #include <sched.h>
 #endif
 
-// Validate that our Signals enum values are correct for the platform
-c_static_assert(PAL_SIGKILL == SIGKILL);
 
 // Validate that our SysLogPriority values are correct for the platform
 c_static_assert(PAL_LOG_EMERG == LOG_EMERG);
@@ -653,6 +651,22 @@ int32_t SystemNative_SetRLimit(RLimitResources resourceType, const RLimit* limit
 
 int32_t SystemNative_Kill(int32_t pid, int32_t signal)
 {
+    switch (signal)
+    {
+        case PAL_SIGKILL:
+             signal = SIGKILL;
+             break;
+
+        case PAL_SIGSTOP:
+             signal = SIGSTOP;
+             break;
+
+        default:
+             assert_msg(false, "Unknown signal",signal);
+             errno = EINVAL;
+             return -1;
+    }
+
     return kill(pid, signal);
 }
 
index 92eaf66..6c79cef 100644 (file)
@@ -73,6 +73,7 @@ typedef enum
 typedef enum
 {
     PAL_SIGKILL = 9, /* kill the specified process */
+    PAL_SIGSTOP = 19,
 } Signals;
 
 /**