From d3434cb55bd7039b96a8a55c00522b3283866626 Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Sun, 31 Aug 2014 17:12:45 +0000 Subject: [PATCH] VFS: convert EINTR to EAGAIN for nonblocking I/O The conversion was never properly implemented for asynchronous character drivers, and got lost during the removal of the synchronous character protocol. Change-Id: Ib858806859aa7a52d6b391d4c6c521a2be361fdd --- minix/servers/vfs/device.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/minix/servers/vfs/device.c b/minix/servers/vfs/device.c index 7d34c0479..9fed98ae1 100644 --- a/minix/servers/vfs/device.c +++ b/minix/servers/vfs/device.c @@ -751,7 +751,7 @@ static void cdev_generic_reply(message *m_ptr) struct fproc *rfp; struct worker_thread *wp; endpoint_t proc_e; - int slot; + int r, slot; proc_e = m_ptr->m_lchardriver_vfs_reply.id; @@ -777,7 +777,13 @@ static void cdev_generic_reply(message *m_ptr) */ printf("VFS: proc %d not blocked on %d\n", proc_e, m_ptr->m_source); } else { - revive(proc_e, m_ptr->m_lchardriver_vfs_reply.status); + /* Some services (inet) use the same infrastructure for nonblocking + * and cancelled requests, resulting in one of EINTR or EAGAIN when the + * other is really the appropriate code. Thus, cdev_cancel converts + * EAGAIN into EINTR, and we convert EINTR into EAGAIN here. + */ + r = m_ptr->m_lchardriver_vfs_reply.status; + revive(proc_e, (r == EINTR) ? EAGAIN : r); } }