[Cbe-oss-dev] [PATCH] libspe2: fix implementation of spe_out_mbox_read()

Gerhard Stenzel gerhard.stenzel at de.ibm.com
Fri Apr 13 21:05:15 EST 2007


If no data is available, current spe_out_mbox_read() returns EAGAIN instead
of 0, as it should according to specification. This patch fixes the
implementation.

Signed-off-by: Gerhard Stenzel <stenzel at de.ibm.com>

===================================================================
diff -uprN svn/spebase/mbox.c cvs/spebase/mbox.c
--- svn/spebase/mbox.c  2007-03-28 17:14:36.000000000 +0200
+++ cvs/spebase/mbox.c  2007-03-29 15:20:28.000000000 +0200
@@ -43,8 +43,15 @@ int _base_spe_out_mbox_read(spe_context_
        }

      rc = read(open_if_closed(spectx,FD_MBOX, 0), mbox_data, count*4);
-     if (rc != -1)
+     DEBUG_PRINTF("%s read rc: %d\n", __FUNCTION__, rc);
+     if (rc != -1) {
            rc /= 4;
+     } else {
+           if (errno == EAGAIN ) { // no data ready to be read
+                 errno = 0;
+                 rc = 0;
+           }
+     }

      return rc;
 }


------------------------------------------------------------------
Best regards,

Gerhard Stenzel, Linux on Cell Development, LTC
-----------------------------------------------------------------------------------------------------------------------------------

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Johann Weihen | Geschäftsführung: Herbert
Kircher
Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht Stuttgart,
HRB 243294




More information about the cbe-oss-dev mailing list