@@ -129,14 +129,16 @@ void process_create_windows(const char* cmd, const char* stdin_stream,
129
129
}
130
130
131
131
// Query process state on a Windows system
132
- void process_query_status_windows (int pid , bool wait , bool * is_running , int * exit_code )
132
+ void process_query_status_windows (stdlib_pid pid , bool wait , bool * is_running , int * exit_code )
133
133
{
134
134
int wait_code ;
135
135
HANDLE hProcess ;
136
- DWORD dwExitCode ;
136
+ DWORD dwExitCode ,dwPid ;
137
+
138
+ dwPid = (DWORD ) pid ;
137
139
138
140
// Open the process with the appropriate access rights
139
- hProcess = OpenProcess (PROCESS_QUERY_INFORMATION | SYNCHRONIZE , FALSE, pid );
141
+ hProcess = OpenProcess (PROCESS_QUERY_INFORMATION | SYNCHRONIZE , FALSE, dwPid );
140
142
141
143
// Error opening the process, likely pid does not exist
142
144
if (hProcess == NULL ) {
@@ -179,11 +181,14 @@ void process_query_status_windows(int pid, bool wait, bool* is_running, int* exi
179
181
// Kill a process on Windows by sending a PROCESS_TERMINATE signal.
180
182
// Return true if the operation succeeded, or false if it failed (process does not
181
183
// exist anymore, or we may not have the rights to kill the process).
182
- bool process_kill_windows (int pid ) {
184
+ bool process_kill_windows (stdlib_pid pid ) {
183
185
HANDLE hProcess ;
186
+ DWORD dwPid ;
187
+
188
+ dwPid = (DWORD ) pid ;
184
189
185
190
// Open the process with terminate rights
186
- hProcess = OpenProcess (PROCESS_TERMINATE , FALSE, pid );
191
+ hProcess = OpenProcess (PROCESS_TERMINATE , FALSE, dwPid );
187
192
188
193
if (hProcess == NULL ) {
189
194
// Failed to open the process; return false
@@ -208,7 +213,7 @@ bool process_kill_windows(int pid) {
208
213
/////////////////////////////////////////////////////////////////////////////////////
209
214
// Unix-specific code
210
215
/////////////////////////////////////////////////////////////////////////////////////
211
- void process_query_status_unix (int pid , bool wait , bool * is_running , int * exit_code )
216
+ void process_query_status_unix (stdlib_pid pid , bool wait , bool * is_running , int * exit_code )
212
217
{
213
218
int status ;
214
219
int wait_code ;
@@ -249,7 +254,7 @@ void process_query_status_unix(int pid, bool wait, bool* is_running, int* exit_c
249
254
250
255
// Kill a process by sending a SIGKILL signal. Return .true. if succeeded, or false if not.
251
256
// Killing process may fail due to unexistent process, or not enough rights to kill.
252
- bool process_kill_unix (int pid ) {
257
+ bool process_kill_unix (stdlib_pid pid ) {
253
258
// Send the SIGKILL signal to the process
254
259
if (kill (pid , SIGKILL ) == 0 ) {
255
260
// Successfully sent the signal
@@ -292,7 +297,7 @@ void process_create(const char* cmd, const char* stdin_stream, const char* stdin
292
297
}
293
298
294
299
// Cross-platform interface: query process state
295
- void process_query_status (int pid , bool wait , bool * is_running , int * exit_code )
300
+ void process_query_status (stdlib_pid pid , bool wait , bool * is_running , int * exit_code )
296
301
{
297
302
#ifdef _WIN32
298
303
process_query_status_windows (pid , wait , is_running , exit_code );
@@ -302,7 +307,7 @@ void process_query_status(int pid, bool wait, bool* is_running, int* exit_code)
302
307
}
303
308
304
309
// Cross-platform interface: kill process by ID
305
- bool process_kill (int pid )
310
+ bool process_kill (stdlib_pid pid )
306
311
{
307
312
#ifdef _WIN32
308
313
return process_kill_windows (pid );
0 commit comments