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 | |
11 | #include "hdr/types/FILE.h" |
12 | #include "src/__support/common.h" |
13 | #include "src/stdio/gpu/file.h" |
14 | #include "src/string/string_utils.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<LIBC_RENAME>(); |
21 | port.send_n(oldpath, internal::string_length(oldpath) + 1); |
22 | port.send_n(newpath, internal::string_length(newpath) + 1); |
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 | |