mirror of
https://github.com/wassname/ray.git
synced 2026-08-04 13:14:14 +08:00
Fix & improve GitHub Actions CI builds (#7784)
This commit is contained in:
@@ -16,8 +16,6 @@ syntax = "proto3";
|
||||
|
||||
package ray.rpc;
|
||||
|
||||
import "src/ray/protobuf/common.proto";
|
||||
|
||||
message GetProfilingStatsRequest {
|
||||
// PID of the worker process.
|
||||
uint32 pid = 1;
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
#include "ray/raylet/worker_pool.h"
|
||||
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
|
||||
@@ -51,6 +51,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef _WINSOCKAPI_
|
||||
#include <WinSock2.h>
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
#include <io.h>
|
||||
#include <ws2tcpip.h> /* socklen_t, et al (MSVC20xx) */
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#include <sys/wait.h>
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
|
||||
pid_t waitpid(pid_t pid, int *status, int options) {
|
||||
int result;
|
||||
if (pid <= 0) {
|
||||
result = -1;
|
||||
errno = ECHILD;
|
||||
} else if (HANDLE process = OpenProcess(SYNCHRONIZE, FALSE, pid)) {
|
||||
DWORD timeout = status && *status == WNOHANG ? 0 : INFINITE;
|
||||
if (WaitForSingleObject(process, timeout) != WAIT_FAILED) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = -1;
|
||||
errno = ECHILD;
|
||||
}
|
||||
CloseHandle(process);
|
||||
} else {
|
||||
result = -1;
|
||||
errno = ECHILD;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef WAIT_H
|
||||
#define WAIT_H
|
||||
|
||||
#include <unistd.h> // pid_t
|
||||
|
||||
#define WNOHANG 1
|
||||
|
||||
__declspec(
|
||||
deprecated("Waiting on a process by ID has an inherent race condition"
|
||||
" on Windows and is discouraged. "
|
||||
"Please use a wrapper that keeps the process handle alive"
|
||||
" and waits on it directly as needed."
|
||||
"")) pid_t waitpid(pid_t pid, int *status, int options);
|
||||
|
||||
#endif /* WAIT_H */
|
||||
@@ -71,25 +71,3 @@ unsigned sleep(unsigned seconds) {
|
||||
Sleep(seconds * 1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int kill(pid_t pid, int sig) {
|
||||
int result;
|
||||
if (HANDLE process = OpenProcess(PROCESS_TERMINATE, FALSE, pid)) {
|
||||
if (sig == SIGKILL) {
|
||||
if (TerminateProcess(process, ERROR_PROCESS_ABORTED)) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = -1;
|
||||
errno = EPERM;
|
||||
}
|
||||
} else {
|
||||
result = -1;
|
||||
errno = EINVAL;
|
||||
}
|
||||
CloseHandle(process);
|
||||
} else {
|
||||
result = -1;
|
||||
errno = ESRCH;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user