]> Zhao Yanbai Git Server - minix.git/commitdiff
MF_REPLY_PEND should be removed when sendrec finishes
authorBen Gras <ben@minix3.org>
Tue, 29 Jun 2010 12:08:37 +0000 (12:08 +0000)
committerBen Gras <ben@minix3.org>
Tue, 29 Jun 2010 12:08:37 +0000 (12:08 +0000)
(r7565 from trunk)

kernel/proc.c

index 70983478c73493e6b2816c055e4dcf6a9b59a90a..49ed85b87bf5fc827daa2be44870c261813a0a26 100644 (file)
@@ -561,6 +561,10 @@ PUBLIC int mini_send(
        call = (caller_ptr->p_misc_flags & MF_REPLY_PEND ? SENDREC
                : (flags & NON_BLOCKING ? SENDNB : SEND));
        IPC_STATUS_ADD_CALL(dst_ptr, call);
+
+       if (dst_ptr->p_misc_flags & MF_REPLY_PEND)
+               dst_ptr->p_misc_flags &= ~MF_REPLY_PEND;
+
        RTS_UNSET(dst_ptr, RTS_RECEIVING);
   } else {
        if(flags & NON_BLOCKING) {
@@ -679,7 +683,7 @@ PRIVATE int mini_receive(
 
            IPC_STATUS_ADD_CALL(caller_ptr, NOTIFY);
 
-           return(OK);
+           goto receive_done;
         }
     }
 
@@ -693,7 +697,7 @@ PRIVATE int mini_receive(
 
        if (r == OK) {
                IPC_STATUS_ADD_CALL(caller_ptr, SENDA);
-               return OK;      /* Got a message */
+               goto receive_done;
        }
     }
 
@@ -731,7 +735,7 @@ PRIVATE int mini_receive(
 
             *xpp = sender->p_q_link;           /* remove from queue */
            sender->p_q_link = NULL;
-            return(OK);                                /* report success */
+           goto receive_done;
        }
        xpp = &sender->p_q_link;                /* proceed to next */
     }
@@ -752,6 +756,11 @@ PRIVATE int mini_receive(
   } else {
        return(ENOTREADY);
   }
+
+receive_done:
+  if (caller_ptr->p_misc_flags & MF_REPLY_PEND)
+         caller_ptr->p_misc_flags &= ~MF_REPLY_PEND;
+  return OK;
 }
 
 /*===========================================================================*