[libc-commits] [PATCH] D157622: [libc] Implement fopen, fclose, and fread on the GPU
Joseph Huber via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Aug 10 09:41:44 PDT 2023
jhuber6 added a comment.
In D157622#4577353 <https://reviews.llvm.org/D157622#4577353>, @JonChesterfield wrote:
> Linux has in-memory files that would be a good fit for testing this. Memfd. Gives you a block of allocated memory that acts like a file.
That's neat, would save us the temporary file. But I think it's a little out of scope since the test already exists and this patch just uses it.
================
Comment at: libc/src/stdio/gpu/fopen.cpp:24
+ [=](rpc::Buffer *buffer) {
+ inline_memcpy(buffer->data, mode, internal::string_length(mode) + 1);
+ },
----------------
I should probably make this max out at the buffer size in case someone does `fopen("foo.txt", /*ReallyLongString=*/str)`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157622/new/
https://reviews.llvm.org/D157622
More information about the libc-commits
mailing list