/[rtmk]/rtmk/ipc-syscall.c
ViewVC logotype

Diff of /rtmk/ipc-syscall.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by jrydberg, Thu Feb 21 20:14:42 2002 UTC revision 1.11 by jrydberg, Fri Feb 22 22:41:48 2002 UTC
# Line 26  Foundation, Inc., 59 Temple Place - Suit Line 26  Foundation, Inc., 59 Temple Place - Suit
26  #include "ipc-object.h"  #include "ipc-object.h"
27  #include "ipc-port.h"  #include "ipc-port.h"
28  #include "ipc-kmsg.h"  #include "ipc-kmsg.h"
29    #include "exception.h"
30    
31  #include "task.h"  #include "task.h"
32  #include "thread.h"  #include "thread.h"
# Line 204  timeout_send (void *arg) Line 205  timeout_send (void *arg)
205    thread_interrupt (thread);    thread_interrupt (thread);
206  }  }
207    
208    /* Demuxer for kernel object requests.  Request is located in KMSG_IN.
209       Reply will be put in KMSG_OUT.  Returns RIG return code.  */
210    static kern_return_t
211    kobject_demux (struct ipc_kmsg *kmsg_in, struct ipc_kmsg *kmsg_out)
212    {
213      kern_return_t kr = RIG_RESULT_SUCCESS;
214    
215      if (kmsg_in->header.msgh_id == EXCEPTION_REPLY_ID)
216        exception_handler (kmsg_in);
217      else
218        kr = rtmk__demux (&kmsg_in->header, &kmsg_out->header);
219      return kr;
220    }
221    
222    
223  /* User entry point for IPC send/receive.  /* User entry point for IPC send/receive.
224    
# Line 330  internal_msg_trap (struct rtmk_msg_heade Line 345  internal_msg_trap (struct rtmk_msg_heade
345    
346            /* We unlock the object before calling the kernel demuxer.              /* We unlock the object before calling the kernel demuxer.  
347               Right after the demux, we acquire it again.  */               Right after the demux, we acquire it again.  */
348              thread_lock_unlock (&port->lock);
349            ipc_object_unlock (object);            ipc_object_unlock (object);
350            kr = rtmk__demux (&kmsg->header, &reply_kmsg->header);            kr = kobject_demux (kmsg, reply_kmsg);
351            ipc_object_lock (object);            ipc_object_lock (object);
352                        
353            if (LIKELY (kr == RIG_RESULT_NOTIFY))            if (LIKELY (kr == RIG_RESULT_NOTIFY))
# Line 353  internal_msg_trap (struct rtmk_msg_heade Line 369  internal_msg_trap (struct rtmk_msg_heade
369                                      reply_kmsg->reply_port, get_esp ());                                      reply_kmsg->reply_port, get_esp ());
370                        trace_printf ("kmsg length %d",                        trace_printf ("kmsg length %d",
371                                      reply_kmsg->header.msgh_length);                                      reply_kmsg->header.msgh_length);
372                        goto enqueue_kernel_reply;                        assert (0);
373                      }                      }
374    
375                    /* ??? check so that the message fits in the buffer.  */                    /* ??? check so that the message fits in the buffer.  */
# Line 365  internal_msg_trap (struct rtmk_msg_heade Line 381  internal_msg_trap (struct rtmk_msg_heade
381                    if (kr != KERN_SUCCESS)                    if (kr != KERN_SUCCESS)
382                      {                      {
383                        /* The copyout thang failed.  Enqueueing this message                        /* The copyout thang failed.  Enqueueing this message
384                           could result in a crash and burn, so we discard it.  */                           could result in a crash and burn, so we discard it. */
385                                        
386                        /* But since we where already on our way to free the                        /* But since we where already on our way to free the
387                           message and unlock all locks, we just fall through. */                           message and unlock all locks, we just fall through. */
# Line 384  internal_msg_trap (struct rtmk_msg_heade Line 400  internal_msg_trap (struct rtmk_msg_heade
400              }              }
401            else if (kr == RIG_RESULT_SUCCESS)            else if (kr == RIG_RESULT_SUCCESS)
402              {              {
403                  ipc_kmsg_free (kmsg);
404                ipc_kmsg_free (reply_kmsg);                ipc_kmsg_free (reply_kmsg);
405                kr = KERN_SUCCESS;                kr = KERN_SUCCESS;
406              }              }
407            else if (kr == RIG_RESULT_FAILURE)            else if (kr == RIG_RESULT_FAILURE)
408              {              {
409                  ipc_kmsg_free (kmsg);
410                ipc_kmsg_free (reply_kmsg);                ipc_kmsg_free (reply_kmsg);
411                kr = KERN_FAILURE;                kr = KERN_FAILURE;
412              }              }
# Line 396  internal_msg_trap (struct rtmk_msg_heade Line 414  internal_msg_trap (struct rtmk_msg_heade
414              assert (0);              assert (0);
415    
416          done_with_kernel_rpc:          done_with_kernel_rpc:
           thread_lock_unlock (&port->lock);  
417            ipc_object_unlock (object);            ipc_object_unlock (object);
418            return kr;            return kr;
419          }          }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26