File tree Expand file tree Collapse file tree 6 files changed +51
-0
lines changed Expand file tree Collapse file tree 6 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,7 @@ set(TARGET_LIBC_ENTRYPOINTS
205
205
libc.src.stdio.putc
206
206
libc.src.stdio.putchar
207
207
libc.src.stdio.puts
208
+ libc.src.stdio.remove
208
209
libc.src.stdio.stderr
209
210
libc.src.stdio.stdin
210
211
libc.src.stdio.stdout
Original file line number Diff line number Diff line change @@ -227,6 +227,7 @@ puts |check| |check|
227
227
fputs |check | |check |
228
228
fputc |check | |check |
229
229
fwrite |check | |check |
230
+ remove |check | |check |
230
231
putc |check | |check |
231
232
putchar |check | |check |
232
233
fclose |check | |check |
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ typedef enum {
34
34
RPC_PRINTF_TO_STDOUT ,
35
35
RPC_PRINTF_TO_STDERR ,
36
36
RPC_PRINTF_TO_STREAM ,
37
+ RPC_REMOVE ,
37
38
RPC_LAST = 0xFFFF ,
38
39
} rpc_opcode_t ;
39
40
Original file line number Diff line number Diff line change @@ -262,6 +262,17 @@ add_entrypoint_object(
262
262
.gpu_file
263
263
)
264
264
265
+ add_entrypoint_object (
266
+ remove
267
+ SRCS
268
+ remove .cpp
269
+ HDRS
270
+ ../remove.h
271
+ DEPENDS
272
+ libc.include.stdio
273
+ .gpu_file
274
+ )
275
+
265
276
add_entrypoint_object (
266
277
stdin
267
278
SRCS
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation of remove ------------------------------------------===//
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/remove.h"
10
+ #include " file.h"
11
+
12
+ #include < stdio.h>
13
+
14
+ namespace LIBC_NAMESPACE {
15
+
16
+ LLVM_LIBC_FUNCTION (int , remove, (const char *path)) {
17
+ int ret;
18
+ rpc::Client::Port port = rpc::client.open <RPC_REMOVE>();
19
+ port.send_n (path, internal::string_length (path) + 1 );
20
+ port.recv (
21
+ [&](rpc::Buffer *buffer) { ret = static_cast <int >(buffer->data [0 ]); });
22
+ port.close ();
23
+ return ret;
24
+ }
25
+
26
+ } // namespace LIBC_NAMESPACE
Original file line number Diff line number Diff line change @@ -343,6 +343,17 @@ rpc_status_t handle_server_impl(
343
343
handle_printf<lane_size>(*port);
344
344
break ;
345
345
}
346
+ case RPC_REMOVE: {
347
+ uint64_t sizes[lane_size] = {0 };
348
+ void *args[lane_size] = {nullptr };
349
+ port->recv_n (args, sizes, [&](uint64_t size) { return new char [size]; });
350
+ port->send ([&](rpc::Buffer *buffer, uint32_t id) {
351
+ buffer->data [0 ] = static_cast <uint64_t >(
352
+ remove (reinterpret_cast <const char *>(args[id])));
353
+ delete[] reinterpret_cast <uint8_t *>(args[id]);
354
+ });
355
+ break ;
356
+ }
346
357
case RPC_NOOP: {
347
358
port->recv ([](rpc::Buffer *) {});
348
359
break ;
You can’t perform that action at this time.
0 commit comments