Copilot commented on code in PR #3517:
URL: https://github.com/apache/brpc/pull/3517#discussion_r3940768299


##########
src/bvar/default_variables.cpp:
##########
@@ -617,11 +618,22 @@ static void get_cmdline(std::ostream& os, void*) {
 struct ReadVersion {
     std::string content;
     ReadVersion() {
-        std::ostringstream oss;
-        if (butil::read_command_output(oss, "uname -ap") != 0) {
+        struct utsname buf;
+        if (uname(&buf) != 0) {
             LOG(ERROR) << "Fail to read kernel version";
             return;
         }
+#if defined(__APPLE__) && (defined(__aarch64__) || defined(__arm64__))
+        const char* processor = "arm";
+#elif defined(__APPLE__) && defined(__x86_64__)
+        const char* processor = "i386";
+#else
+        const char* processor = buf.machine;
+#endif
+        std::ostringstream oss;
+        oss << buf.sysname << ' ' << buf.nodename << ' '
+            << buf.release << ' ' << buf.version << ' '
+            << buf.machine << ' ' << processor << '\n';

Review Comment:
   The PR description says the `kernel_version` bvar output remains equivalent 
to `uname -ap`, but this new formatting only includes `sysname nodename release 
version machine processor`. On Linux, `uname -a` typically includes additional 
fields (e.g., hardware platform and operating system), so this change can alter 
the exported value and may break consumers relying on the previous string.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to