From: David van Moolenbroek Date: Sun, 31 Aug 2014 17:12:45 +0000 (+0000) Subject: VFS: convert EINTR to EAGAIN for nonblocking I/O X-Git-Tag: v3.3.0~30 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F2801%2F1;p=minix.git 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 --- 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); } }