llama.cpp on a jailbroken PS5: run any GGUF model natively on the console, starting with Qwen 3.8
Subject: [PATCH] rpc: avoid strnlen hidden by PS5 XOPEN feature macros
The native CMake build uses _XOPEN_SOURCE=600, which hides strnlen in the
PS5 SDK headers. Use a bounded C++ scan with the same semantics instead.
This does not enable peer communications; NO_COMM still rejects them.
diff --git a/ggml/src/ggml-rpc/ggml-rpc.cpp b/ggml/src/ggml-rpc/ggml-rpc.cpp
--- a/ggml/src/ggml-rpc/ggml-rpc.cpp
+++ b/ggml/src/ggml-rpc/ggml-rpc.cpp
@@ -2226,7 +2226,8 @@
}
state.peer->update_caps(remote_caps);
} else {
- const std::string host(request.host, strnlen(request.host, sizeof(request.host)));
+ const char * host_end = std::find(request.host, request.host + sizeof(request.host), '\0');
+ const std::string host(request.host, host_end);
// rank 0 may not be listening yet, retry for a few seconds
for (int i = 0; i < 100 && state.peer == nullptr; i++) {
state.peer = socket_t::connect(host.c_str(), request.port);