From 433743127447a25d51a935473a4c2984c84e9197 Mon Sep 17 00:00:00 2001 From: KJlaccHoeUM9l Date: Wed, 9 Jun 2021 17:37:24 +0300 Subject: [PATCH 1/2] add support of cpp RPC server for Apple --- apps/cpp_rpc/rpc_server.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/cpp_rpc/rpc_server.cc b/apps/cpp_rpc/rpc_server.cc index 52b5da965b4c..40a6966f9aff 100644 --- a/apps/cpp_rpc/rpc_server.cc +++ b/apps/cpp_rpc/rpc_server.cc @@ -22,9 +22,10 @@ * \brief RPC Server implementation. */ #include -#if defined(__linux__) || defined(__ANDROID__) +#if defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) #include #include +#include #endif #include #include @@ -52,7 +53,7 @@ namespace runtime { * \brief wait the child process end. * \param status status value */ -#if defined(__linux__) || defined(__ANDROID__) +#if defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) static pid_t waitPidEintr(int* status) { pid_t pid = 0; while ((pid = waitpid(-1, status, 0)) == -1) { @@ -162,7 +163,7 @@ class RPCServer { } int timeout = GetTimeOutFromOpts(opts); -#if defined(__linux__) || defined(__ANDROID__) +#if defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) // step 3: serving if (timeout != 0) { const pid_t timer_pid = fork(); @@ -219,6 +220,10 @@ class RPCServer { auto dur = high_resolution_clock::now() - start_time; LOG(INFO) << "Serve Time " << duration_cast(dur).count() << "ms"; +#else + LOG(WARNING) << "Unknown platform. It is not known how to bring up the subprocess." + << " RPC will be launched in the main thread."; + ServerLoopProc(conn, addr, work_dir_); #endif // close from our side. LOG(INFO) << "Socket Connection Closed"; From a40e3af4d2272b9efb7abf3ccf579f880627e453 Mon Sep 17 00:00:00 2001 From: KJlaccHoeUM9l Date: Fri, 11 Jun 2021 16:31:34 +0300 Subject: [PATCH 2/2] fix for CI --- apps/cpp_rpc/rpc_server.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/cpp_rpc/rpc_server.cc b/apps/cpp_rpc/rpc_server.cc index 40a6966f9aff..bab01463de2a 100644 --- a/apps/cpp_rpc/rpc_server.cc +++ b/apps/cpp_rpc/rpc_server.cc @@ -23,9 +23,9 @@ */ #include #if defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) +#include #include #include -#include #endif #include #include