[libc-commits] [libc] [libc] Export the RPC interface from `libc` (PR #71432)

Jon Chesterfield via libc-commits libc-commits at lists.llvm.org
Tue Mar 19 06:28:43 PDT 2024


================
@@ -0,0 +1,25 @@
+//===---------- GPU implementation of the external RPC port interface -----===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/gpu/rpc_close_port.h"
+
+#include "src/__support/GPU/utils.h"
+#include "src/__support/RPC/rpc_client.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+static_assert(sizeof(rpc_port_t) == sizeof(rpc::Client::Port), "ABI mismatch");
+
+LLVM_LIBC_FUNCTION(void, rpc_close_port, (rpc_port_t * handle)) {
+  rpc::Client::Port port = cpp::bit_cast<rpc::Client::Port>(*handle);
+  port.close();
+  *handle = cpp::bit_cast<rpc_port_t>(port);
----------------
JonChesterfield wrote:

Should this be returning the port after it has been closed? Presumably the caller can do nothing with that value

https://github.com/llvm/llvm-project/pull/71432


More information about the libc-commits mailing list