From: Frank L. <fra...@gm...> - 2011-11-20 01:29:42
|
Handle EINTR and EAGAIN during vde_send() and vde_recv() in case the VDE library doesn't. Use the same approach that net_user.c takes. Signed-off-by: Frank Laub<fl...@an...> --- a/arch/um/drivers/vde_user.c +++ b/arch/um/drivers/vde_user.c @@ -11,6 +11,7 @@ #include "um_malloc.h" #include "user.h" #include "vde.h" +#include "os.h" static int vde_user_init(void *data, void *dev) { @@ -103,7 +104,7 @@ int vde_user_read(void *conn, void *buf, if (vconn == NULL) return 0; - rv = vde_recv(vconn, buf, len, 0); + CATCH_EINTR(rv = vde_recv(vconn, buf, len, 0)); if (rv < 0) { if (errno == EAGAIN) return 0; @@ -118,10 +119,17 @@ int vde_user_read(void *conn, void *buf, int vde_user_write(void *conn, void *buf, int len) { VDECONN *vconn = conn; + int rv; if (vconn == NULL) return 0; - return vde_send(vconn, buf, len, 0); + CATCH_EINTR(rv = vde_send(vconn, buf, len, 0)); + if (rv < 0) { + if (errno == EAGAIN) + return 0; + return -errno; + } + return rv; } |