From: Ben Gras Date: Fri, 23 Jun 2006 11:51:56 +0000 (+0000) Subject: . leave out dead code from device.c X-Git-Tag: v3.1.3~299 X-Git-Url: http://zhaoyanbai.com/repos/%22/xml/v3/zones/static/Bv9ARM.ch07.html?a=commitdiff_plain;h=82855e9cf51c2276bda38af279c0f9a8bafce4cc;p=minix.git . leave out dead code from device.c . don't loop doing a receive() after sendrec() - chance of recovering is not high, and can lead to receive()ing a notify() (which can't happen in sendrec()), which is terrible . return status from device when DEV_CANCEL is done on a signal; hardcode EAGAIN to become EINTR though --- diff --git a/servers/fs/device.c b/servers/fs/device.c index e1d75d739..14dd6c3a0 100644 --- a/servers/fs/device.c +++ b/servers/fs/device.c @@ -623,42 +623,7 @@ message *mess_ptr; /* pointer to message for task */ proc_e = mess_ptr->IO_ENDPT; -#if DEAD_CODE - while ((r = sendrec(task_nr, mess_ptr)) == ELOCKED) { - /* sendrec() failed to avoid deadlock. The task 'task_nr' is - * trying to send a REVIVE message for an earlier request. - * Handle it and go try again. - */ - if ((r = receive(task_nr, &local_m)) != OK) { - break; - } - - /* If we're trying to send a cancel message to a task which has just - * sent a completion reply, ignore the reply and abort the cancel - * request. The caller will do the revive for the process. - */ - if (mess_ptr->m_type == CANCEL && local_m.REP_ENDPT == proc_e) { - return OK; - } - - /* Otherwise it should be a REVIVE. */ - if (local_m.m_type != REVIVE) { - printf( - "fs: strange device reply from %d, type = %d, proc = %d (1)\n", - local_m.m_source, - local_m.m_type, local_m.REP_ENDPT); - continue; - } - - revive(local_m.REP_ENDPT, local_m.REP_STATUS); - } -#endif - - /* The message received may be a reply to this call, or a REVIVE for some - * other process. - */ r = sendrec(task_nr, mess_ptr); - for(;;) { if (r != OK) { if (r == EDEADSRCDST || r == EDSTDIED || r == ESRCDIED) { printf("fs: dead driver %d\n", task_nr); @@ -673,23 +638,15 @@ message *mess_ptr; /* pointer to message for task */ } /* Did the process we did the sendrec() for get a result? */ - if (mess_ptr->REP_ENDPT == proc_e) { - break; - } -#if 0 - else if (mess_ptr->m_type == REVIVE) { - /* Otherwise it should be a REVIVE. */ - revive(mess_ptr->REP_ENDPT, mess_ptr->REP_STATUS); - } -#endif - else { + if (mess_ptr->REP_ENDPT != proc_e) { printf( - "fs: strange device reply from %d, type = %d, proc = %d (2) ignored\n", + "fs: strange device reply from %d, type = %d, proc = %d (not %d) (2) ignored\n", mess_ptr->m_source, - mess_ptr->m_type, mess_ptr->REP_ENDPT); + mess_ptr->m_type, + proc_e, + mess_ptr->REP_ENDPT); + return EIO; } - r = receive(task_nr, mess_ptr); - } return OK; } diff --git a/servers/fs/pipe.c b/servers/fs/pipe.c index 337259318..790e7c7c3 100644 --- a/servers/fs/pipe.c +++ b/servers/fs/pipe.c @@ -363,7 +363,7 @@ int proc_nr_e; */ register struct fproc *rfp; - int proc_nr_p, task, fild; + int proc_nr_p, task, fild, status = EINTR; struct filp *f; dev_t dev; message mess; @@ -408,6 +408,8 @@ int proc_nr_e; mess.m_type = CANCEL; fp = rfp; /* hack - ctty_io uses fp */ (*dmap[(dev >> MAJOR) & BYTE].dmap_io)(task, &mess); + status = mess.REP_STATUS; + if(status == EAGAIN) status = EINTR; if(GRANT_VALID(rfp->fp_grant)) { if(cpf_revoke(rfp->fp_grant)) { panic(__FILE__,"FS: revoke failed for grant (cancel)", @@ -418,7 +420,7 @@ int proc_nr_e; } rfp->fp_suspended = NOT_SUSPENDED; - reply(proc_nr_e, EINTR); /* signal interrupted call */ + reply(proc_nr_e, status); /* signal interrupted call */ return(OK); }