File tree 5 files changed +84
-1
lines changed
5 files changed +84
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,9 @@ add_library(psl-native SHARED
27
27
createsymlink.cpp
28
28
followsymlink.cpp
29
29
createprocess.cpp
30
- nativesyslog.cpp)
30
+ nativesyslog.cpp
31
+ killprocess.cpp
32
+ waitpid.cpp)
31
33
32
34
check_function_exists(sysconf HAVE_SYSCONF)
33
35
Original file line number Diff line number Diff line change
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ // ! @brief kill a process with SIGKILL
5
+
6
+ #include " killprocess.h"
7
+
8
+ #include < sys/types.h>
9
+ #include < signal.h>
10
+
11
+ // ! @brief kill a process with SIGKILL
12
+ // !
13
+ // ! KillProcess
14
+ // !
15
+ // ! @param[in] pid
16
+ // ! @parblock
17
+ // ! The target PID to kill.
18
+ // ! @endparblock
19
+ // !
20
+ // ! @retval true if signal successfully sent, false otherwise
21
+ // !
22
+ bool KillProcess (pid_t pid)
23
+ {
24
+ return kill (pid, SIGKILL) == 0 ;
25
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+
6
+ #include "pal.h"
7
+ #include <sys/types.h>
8
+
9
+ PAL_BEGIN_EXTERNC
10
+
11
+ bool KillProcess (pid_t pid );
12
+
13
+ PAL_END_EXTERNC
Original file line number Diff line number Diff line change
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ // ! @brief wait for a child process to stop or terminate
5
+
6
+ #include " waitpid.h"
7
+
8
+ #include < sys/types.h>
9
+ #include < sys/wait.h>
10
+
11
+ // ! @brief wait for a child process to stop or terminate
12
+ // !
13
+ // ! WaitPid
14
+ // !
15
+ // ! @param[in] pid
16
+ // ! @parblock
17
+ // ! The target PID to wait for.
18
+ // ! @endparblock
19
+ // !
20
+ // ! @param[in] nohang
21
+ // ! @parblock
22
+ // ! Whether to block while waiting for the process.
23
+ // ! @endparblock
24
+ // !
25
+ // ! @retval PID of exited child, or -1 if error
26
+ // !
27
+ pid_t WaitPid (pid_t pid, bool nohang)
28
+ {
29
+ return waitpid (pid, NULL , nohang ? WNOHANG : 0 );
30
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+
6
+ #include "pal.h"
7
+ #include <sys/types.h>
8
+
9
+ PAL_BEGIN_EXTERNC
10
+
11
+ pid_t WaitPid (pid_t pid , bool nohang );
12
+
13
+ PAL_END_EXTERNC
You can’t perform that action at this time.
0 commit comments