[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[UNIKRAFT PATCH v2 15/15] plat/linuxu: Convert linux errno to unikraft errno



There are differences in errno between linux and unikraft. This patch
converts EAGAIN which is 11 in linux to unikraft which is 35.

Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
 plat/linuxu/tap_io.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/plat/linuxu/tap_io.c b/plat/linuxu/tap_io.c
index 030c192..ac1d0ae 100644
--- a/plat/linuxu/tap_io.c
+++ b/plat/linuxu/tap_io.c
@@ -117,7 +117,10 @@ ssize_t tap_read(int fd, void *buf, size_t count)
        while (rc == -EINTR)
                rc = sys_read(fd, buf, count);
 
-       if (rc < 0)
+       if (rc == -11)
+               /* Explicitly added since linux errno has -11 for EAGAIN */
+               rc = -EWOULDBLOCK;
+       else if (rc < 0)
                uk_pr_err("Failed(%ld) to read from the tap device\n", rc);
 
        return rc;
@@ -132,7 +135,12 @@ ssize_t tap_write(int fd, const void *buf, size_t count)
                rc = sys_write(fd, buf, count);
                if (rc == -EINTR)
                        continue;
-               else if (rc < 0) {
+               else if (rc == -11) {
+                       /* 
+                        * Explicitly added since linux errno has -11 for EAGAIN
+                        */
+                       rc = -EWOULDBLOCK;
+               } else if (rc < 0) {
                        uk_pr_err("Failed(%ld) to write to the tap device\n",
                                  rc);
                        return rc;
-- 
2.7.4




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.