[Cbe-oss-dev] [PATCH 3/3] libspe2: Fix isolated mode not supported errno

D. Herrendoerfer d.herrendoerfer at herrendoerfer.name
Tue Mar 4 23:29:54 EST 2008


This patch fixes a wrong errno in case that isolated mode
is requested on a non-isolated mode environment.
In this case the kernel returns EPERM which should be 
translated to ENODEV.

Signed-off-by: Dirk Herrendoerfer < herrend at de.ibm.com >

Index: libspe2/spebase/create.c
===================================================================
--- libspe2/spebase/create.c    (revision 101)
+++ libspe2/spebase/create.c    (working copy)
@@ -271,10 +271,16 @@ spe_context_ptr_t _base_spe_context_crea
                case EEXIST:
                case EINVAL:
                case EBUSY:
-               case EPERM:
                case ENODEV:
                        errno = errno_saved; /* restore errno */
                        break;
+               case EPERM:
+                       /* for ISOLATED mode EPERM signals that this mode is not supported */
+                       if (flags & SPE_ISOLATE)
+                               errno = ENODEV;
+                       else
+                               errno = errno_saved;
+                       break;
                default:
                        errno = EFAULT;
                        break;




More information about the cbe-oss-dev mailing list