diff options
| author | Joseph Huber <huberjn@outlook.com> | 2024-12-02 15:34:29 -0600 |
|---|---|---|
| committer | Joseph Huber <huberjn@outlook.com> | 2024-12-02 15:35:08 -0600 |
| commit | a6ef0debb1d60966b5bcc69f7d58a2b75c9c621d (patch) | |
| tree | 605761672904fd2e4efe865d8e883ad37ee88872 /libc/src/stdio | |
| parent | 4226e0a0c75e5cfd784eff429f93101c03a1995c (diff) | |
[libc][NFC] Rename RPC opcodes to better reflect their usage
Summary:
RPC_ is a generic prefix here, use LIBC_ to indicate that these are
opcodes used to implement the C library
Diffstat (limited to 'libc/src/stdio')
| -rw-r--r-- | libc/src/stdio/gpu/clearerr.cpp | 2 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/fclose.cpp | 2 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/feof.cpp | 2 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/ferror.cpp | 2 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/fflush.cpp | 2 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/fgets.cpp | 2 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/file.h | 10 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/fopen.cpp | 2 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/fseek.cpp | 2 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/ftell.cpp | 2 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/puts.cpp | 2 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/remove.cpp | 2 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/rename.cpp | 2 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/ungetc.cpp | 2 | ||||
| -rw-r--r-- | libc/src/stdio/gpu/vfprintf_utils.h | 28 |
15 files changed, 32 insertions, 32 deletions
diff --git a/libc/src/stdio/gpu/clearerr.cpp b/libc/src/stdio/gpu/clearerr.cpp index 4c631b9f946f..4d843e4be33e 100644 --- a/libc/src/stdio/gpu/clearerr.cpp +++ b/libc/src/stdio/gpu/clearerr.cpp @@ -15,7 +15,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(void, clearerr, (::FILE * stream)) { - rpc::Client::Port port = rpc::client.open<RPC_CLEARERR>(); + rpc::Client::Port port = rpc::client.open<LIBC_CLEARERR>(); port.send_and_recv( [=](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = file::from_stream(stream); diff --git a/libc/src/stdio/gpu/fclose.cpp b/libc/src/stdio/gpu/fclose.cpp index 683e0548495d..847d6b846172 100644 --- a/libc/src/stdio/gpu/fclose.cpp +++ b/libc/src/stdio/gpu/fclose.cpp @@ -18,7 +18,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) { uint64_t ret = 0; uintptr_t file = reinterpret_cast<uintptr_t>(stream); - rpc::Client::Port port = rpc::client.open<RPC_CLOSE_FILE>(); + rpc::Client::Port port = rpc::client.open<LIBC_CLOSE_FILE>(); port.send_and_recv( [=](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = file; }, [&](rpc::Buffer *buffer, uint32_t) { ret = buffer->data[0]; }); diff --git a/libc/src/stdio/gpu/feof.cpp b/libc/src/stdio/gpu/feof.cpp index 02adb4ce73d6..a15e4874d0e2 100644 --- a/libc/src/stdio/gpu/feof.cpp +++ b/libc/src/stdio/gpu/feof.cpp @@ -16,7 +16,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, feof, (::FILE * stream)) { int ret; - rpc::Client::Port port = rpc::client.open<RPC_FEOF>(); + rpc::Client::Port port = rpc::client.open<LIBC_FEOF>(); port.send_and_recv( [=](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = file::from_stream(stream); diff --git a/libc/src/stdio/gpu/ferror.cpp b/libc/src/stdio/gpu/ferror.cpp index ca777131fd1b..827382037067 100644 --- a/libc/src/stdio/gpu/ferror.cpp +++ b/libc/src/stdio/gpu/ferror.cpp @@ -16,7 +16,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) { int ret; - rpc::Client::Port port = rpc::client.open<RPC_FERROR>(); + rpc::Client::Port port = rpc::client.open<LIBC_FERROR>(); port.send_and_recv( [=](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = file::from_stream(stream); diff --git a/libc/src/stdio/gpu/fflush.cpp b/libc/src/stdio/gpu/fflush.cpp index 577325b70c4e..5a5137be6a4a 100644 --- a/libc/src/stdio/gpu/fflush.cpp +++ b/libc/src/stdio/gpu/fflush.cpp @@ -16,7 +16,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, fflush, (::FILE * stream)) { int ret; - rpc::Client::Port port = rpc::client.open<RPC_FFLUSH>(); + rpc::Client::Port port = rpc::client.open<LIBC_FFLUSH>(); port.send_and_recv( [=](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = file::from_stream(stream); diff --git a/libc/src/stdio/gpu/fgets.cpp b/libc/src/stdio/gpu/fgets.cpp index fbc1b0cf7d1a..d90b7aa4aa66 100644 --- a/libc/src/stdio/gpu/fgets.cpp +++ b/libc/src/stdio/gpu/fgets.cpp @@ -26,7 +26,7 @@ LLVM_LIBC_FUNCTION(char *, fgets, uint64_t recv_size; void *buf = nullptr; - rpc::Client::Port port = rpc::client.open<RPC_READ_FGETS>(); + rpc::Client::Port port = rpc::client.open<LIBC_READ_FGETS>(); port.send([=](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = count; buffer->data[1] = file::from_stream(stream); diff --git a/libc/src/stdio/gpu/file.h b/libc/src/stdio/gpu/file.h index 6ca792b45458..437ee9982438 100644 --- a/libc/src/stdio/gpu/file.h +++ b/libc/src/stdio/gpu/file.h @@ -54,7 +54,7 @@ LIBC_INLINE uint64_t write_impl(::FILE *file, const void *data, size_t size) { uint64_t ret = 0; rpc::Client::Port port = rpc::client.open<opcode>(); - if constexpr (opcode == RPC_WRITE_TO_STREAM) { + if constexpr (opcode == LIBC_WRITE_TO_STREAM) { port.send([&](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = reinterpret_cast<uintptr_t>(file); }); @@ -70,17 +70,17 @@ LIBC_INLINE uint64_t write_impl(::FILE *file, const void *data, size_t size) { LIBC_INLINE uint64_t write(::FILE *f, const void *data, size_t size) { if (f == stdout) - return write_impl<RPC_WRITE_TO_STDOUT>(f, data, size); + return write_impl<LIBC_WRITE_TO_STDOUT>(f, data, size); else if (f == stderr) - return write_impl<RPC_WRITE_TO_STDERR>(f, data, size); + return write_impl<LIBC_WRITE_TO_STDERR>(f, data, size); else - return write_impl<RPC_WRITE_TO_STREAM>(f, data, size); + return write_impl<LIBC_WRITE_TO_STREAM>(f, data, size); } LIBC_INLINE uint64_t read_from_stream(::FILE *file, void *buf, size_t size) { uint64_t ret = 0; uint64_t recv_size; - rpc::Client::Port port = rpc::client.open<RPC_READ_FROM_STREAM>(); + rpc::Client::Port port = rpc::client.open<LIBC_READ_FROM_STREAM>(); port.send([=](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = size; buffer->data[1] = from_stream(file); diff --git a/libc/src/stdio/gpu/fopen.cpp b/libc/src/stdio/gpu/fopen.cpp index e165d2acd210..18dd71953778 100644 --- a/libc/src/stdio/gpu/fopen.cpp +++ b/libc/src/stdio/gpu/fopen.cpp @@ -18,7 +18,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(::FILE *, fopen, (const char *__restrict path, const char *__restrict mode)) { uintptr_t file; - rpc::Client::Port port = rpc::client.open<RPC_OPEN_FILE>(); + rpc::Client::Port port = rpc::client.open<LIBC_OPEN_FILE>(); port.send_n(path, internal::string_length(path) + 1); port.send_and_recv( [=](rpc::Buffer *buffer, uint32_t) { diff --git a/libc/src/stdio/gpu/fseek.cpp b/libc/src/stdio/gpu/fseek.cpp index 37c40bc602d8..5ada5de50db8 100644 --- a/libc/src/stdio/gpu/fseek.cpp +++ b/libc/src/stdio/gpu/fseek.cpp @@ -16,7 +16,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, fseek, (::FILE * stream, long offset, int whence)) { int ret; - rpc::Client::Port port = rpc::client.open<RPC_FSEEK>(); + rpc::Client::Port port = rpc::client.open<LIBC_FSEEK>(); port.send_and_recv( [=](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = file::from_stream(stream); diff --git a/libc/src/stdio/gpu/ftell.cpp b/libc/src/stdio/gpu/ftell.cpp index 226aeda2f8de..04bb0ddfa06a 100644 --- a/libc/src/stdio/gpu/ftell.cpp +++ b/libc/src/stdio/gpu/ftell.cpp @@ -16,7 +16,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(long, ftell, (::FILE * stream)) { long ret; - rpc::Client::Port port = rpc::client.open<RPC_FSEEK>(); + rpc::Client::Port port = rpc::client.open<LIBC_FSEEK>(); port.send_and_recv( [=](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = file::from_stream(stream); diff --git a/libc/src/stdio/gpu/puts.cpp b/libc/src/stdio/gpu/puts.cpp index 20f7a889a378..fc252abe52d1 100644 --- a/libc/src/stdio/gpu/puts.cpp +++ b/libc/src/stdio/gpu/puts.cpp @@ -18,7 +18,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) { cpp::string_view str_view(str); - auto written = file::write_impl<RPC_WRITE_TO_STDOUT_NEWLINE>(stdout, str, + auto written = file::write_impl<LIBC_WRITE_TO_STDOUT_NEWLINE>(stdout, str, str_view.size()); if (written != str_view.size() + 1) return EOF; diff --git a/libc/src/stdio/gpu/remove.cpp b/libc/src/stdio/gpu/remove.cpp index 6604be1c31f2..4bfb5d3fe8ed 100644 --- a/libc/src/stdio/gpu/remove.cpp +++ b/libc/src/stdio/gpu/remove.cpp @@ -16,7 +16,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, remove, (const char *path)) { int ret; - rpc::Client::Port port = rpc::client.open<RPC_REMOVE>(); + rpc::Client::Port port = rpc::client.open<LIBC_REMOVE>(); port.send_n(path, internal::string_length(path) + 1); port.recv([&](rpc::Buffer *buffer, uint32_t) { ret = static_cast<int>(buffer->data[0]); diff --git a/libc/src/stdio/gpu/rename.cpp b/libc/src/stdio/gpu/rename.cpp index e6396e212b8b..589bf2456c8d 100644 --- a/libc/src/stdio/gpu/rename.cpp +++ b/libc/src/stdio/gpu/rename.cpp @@ -17,7 +17,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, rename, (const char *oldpath, const char *newpath)) { int ret; - rpc::Client::Port port = rpc::client.open<RPC_RENAME>(); + rpc::Client::Port port = rpc::client.open<LIBC_RENAME>(); port.send_n(oldpath, internal::string_length(oldpath) + 1); port.send_n(newpath, internal::string_length(newpath) + 1); port.recv([&](rpc::Buffer *buffer, uint32_t) { diff --git a/libc/src/stdio/gpu/ungetc.cpp b/libc/src/stdio/gpu/ungetc.cpp index dce14391b7de..fd1db467975e 100644 --- a/libc/src/stdio/gpu/ungetc.cpp +++ b/libc/src/stdio/gpu/ungetc.cpp @@ -16,7 +16,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, ungetc, (int c, ::FILE *stream)) { int ret; - rpc::Client::Port port = rpc::client.open<RPC_UNGETC>(); + rpc::Client::Port port = rpc::client.open<LIBC_UNGETC>(); port.send_and_recv( [=](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = c; diff --git a/libc/src/stdio/gpu/vfprintf_utils.h b/libc/src/stdio/gpu/vfprintf_utils.h index a0a8c39781ad..df157d36c516 100644 --- a/libc/src/stdio/gpu/vfprintf_utils.h +++ b/libc/src/stdio/gpu/vfprintf_utils.h @@ -23,8 +23,8 @@ LIBC_INLINE int vfprintf_impl(::FILE *__restrict file, uint64_t mask = gpu::get_lane_mask(); rpc::Client::Port port = rpc::client.open<opcode>(); - if constexpr (opcode == RPC_PRINTF_TO_STREAM || - opcode == RPC_PRINTF_TO_STREAM_PACKED) { + if constexpr (opcode == LIBC_PRINTF_TO_STREAM || + opcode == LIBC_PRINTF_TO_STREAM_PACKED) { port.send([&](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = reinterpret_cast<uintptr_t>(file); }); @@ -63,24 +63,24 @@ LIBC_INLINE int vfprintf_internal(::FILE *__restrict stream, // separate opcode so the server knows how much to advance the pointers. #if defined(LIBC_TARGET_ARCH_IS_AMDGPU) if (stream == stdout) - return vfprintf_impl<RPC_PRINTF_TO_STDOUT_PACKED>(stream, format, - format_size, vlist); + return vfprintf_impl<LIBC_PRINTF_TO_STDOUT_PACKED>(stream, format, + format_size, vlist); else if (stream == stderr) - return vfprintf_impl<RPC_PRINTF_TO_STDERR_PACKED>(stream, format, - format_size, vlist); + return vfprintf_impl<LIBC_PRINTF_TO_STDERR_PACKED>(stream, format, + format_size, vlist); else - return vfprintf_impl<RPC_PRINTF_TO_STREAM_PACKED>(stream, format, - format_size, vlist); + return vfprintf_impl<LIBC_PRINTF_TO_STREAM_PACKED>(stream, format, + format_size, vlist); #else if (stream == stdout) - return vfprintf_impl<RPC_PRINTF_TO_STDOUT>(stream, format, format_size, - vlist); + return vfprintf_impl<LIBC_PRINTF_TO_STDOUT>(stream, format, format_size, + vlist); else if (stream == stderr) - return vfprintf_impl<RPC_PRINTF_TO_STDERR>(stream, format, format_size, - vlist); + return vfprintf_impl<LIBC_PRINTF_TO_STDERR>(stream, format, format_size, + vlist); else - return vfprintf_impl<RPC_PRINTF_TO_STREAM>(stream, format, format_size, - vlist); + return vfprintf_impl<LIBC_PRINTF_TO_STREAM>(stream, format, format_size, + vlist); #endif } |
