This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit c4ed79847d6a5578aa7c00394c771a3534027edf
Author: Marco Casaroli <[email protected]>
AuthorDate: Fri Oct 30 19:28:12 2026 +0100

    benchmarks/osperf: Use the correct ends of the pipe in pipe-rw.
    
    pipe_performance() wrote to pipefd[0] and read from pipefd[1].
    pipefd[0] is the read end and pipefd[1] is the write end, so both
    calls failed and the pipe-rw test measured two failed system calls.
    The test did not check the results, so nothing showed the failure.
    
    Write to pipefd[1] and read from pipefd[0], and print the results and
    errno when the write or the read does not transfer one byte.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 benchmarks/osperf/osperf.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/benchmarks/osperf/osperf.c b/benchmarks/osperf/osperf.c
index aa8cfc401..f0146fa5b 100644
--- a/benchmarks/osperf/osperf.c
+++ b/benchmarks/osperf/osperf.c
@@ -25,6 +25,7 @@
  ****************************************************************************/
 
 #include <assert.h>
+#include <errno.h>
 #include <limits.h>
 #include <pthread.h>
 #include <sched.h>
@@ -305,6 +306,8 @@ static size_t poll_performance(void)
 static size_t pipe_performance(void)
 {
   struct performance_time_s result;
+  ssize_t wret;
+  ssize_t rret;
   int pipefd[2];
   int ret;
   char r;
@@ -313,10 +316,15 @@ static size_t pipe_performance(void)
   DEBUGASSERT(ret == 0);
 
   performance_start(&result);
-  write(pipefd[0], "a", 1);
-  read(pipefd[1], &r, 1);
+  wret = write(pipefd[1], "a", 1);
+  rret = read(pipefd[0], &r, 1);
   performance_end(&result);
 
+  if (wret != 1 || rret != 1)
+    {
+      printf("pipe-rw: write %zd, read %zd, errno %d\n", wret, rret, errno);
+    }
+
   close(pipefd[0]);
   close(pipefd[1]);
   return performance_gettime(&result);

Reply via email to