1 //===-- GPU Implementation of rename --------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "src/stdio/rename.h" 10 #include "src/__support/CPP/string_view.h" 11 #include "src/__support/macros/config.h" 12 #include "src/stdio/gpu/file.h" 13 14 #include "hdr/types/FILE.h" 15 16 namespace LIBC_NAMESPACE_DECL { 17 18 LLVM_LIBC_FUNCTION(int, rename, (const char *oldpath, const char *newpath)) { 19 int ret; 20 rpc::Client::Port port = rpc::client.open<RPC_RENAME>(); 21 port.send_n(oldpath, internal::string_length(oldpath) + 1); 22 port.send_n(newpath, internal::string_length(newpath) + 1); __anoneff98ba50102(rpc::Buffer *buffer, uint32_t) 23 port.recv([&](rpc::Buffer *buffer, uint32_t) { 24 ret = static_cast<int>(buffer->data[0]); 25 }); 26 port.close(); 27 28 return ret; 29 } 30 31 } // namespace LIBC_NAMESPACE_DECL 32