#NEWLINE# def mini_send( caller_ptr , dst_e , m_ptr , flags ) : #NEWLINE# #INDENT# dst_p = ENDPOINT ( dst_e ) #NEWLINE# dst_ptr = proc_addr ( dst_p ) #NEWLINE# if RTS_ISSET ( dst_ptr , RTS_NO_ENDPOINT ) : #NEWLINE# #INDENT# return EDEADSRCDST #NEWLINE# #UNINDENT# "Check if 'dst' is blocked waiting for this message. The\n    destination's RTS_SENDING flag may be set when its SENDREC\n    call blocked while sending" #NEWLINE# if WILLRECEIVE ( dst_ptr , caller_ptr [ 'p_endpoint' ] ) : #NEWLINE# #INDENT# assert ( not ( dst_ptr [ 'p_misc_flags' ] & MF_DELIVERMSG ) ) #NEWLINE# if ( not ( flags & FROM_KERNEL ) ) : #NEWLINE# #INDENT# if copy_msg_from_user ( m_ptr , dst_ptr [ 'p_delivermsg' ] ) : #NEWLINE# #INDENT# return EFAULT #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# dst_ptr [ 'p_delivermsg' ] = m_ptr #NEWLINE# IPC_STATUS_ADD_FLAGS ( dst_ptr , IPC_FLG_MSG_FROM_KERNEL ) #NEWLINE# #UNINDENT# dst_ptr [ 'p_delivermsg' ] [ 'm_source' ] = caller_ptr [ 'p_endpoint' ] #NEWLINE# dst_ptr [ 'p_misc_flags' ] |= MF_DELIVERMSG #NEWLINE# if ( caller_ptr [ 'p_misc_flags' ] & MF_REPLY_PEND ) : #NEWLINE# #INDENT# call = SENDREC #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( flags & NON_BLOCKING ) : #NEWLINE# #INDENT# call = SENDNB #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# call = SEND #NEWLINE# #UNINDENT# #UNINDENT# IPC_STATUS_ADD_CALL ( dst_ptr , dst_e ) #NEWLINE# if ( dst_ptr [ 'p_misc_flags' ] & MF_REPLY_PEND ) : #NEWLINE# #INDENT# dst_ptr [ 'p_misc_flags' ] &= ( ~ MF_REPLY_PEND ) #NEWLINE# #UNINDENT# RTS_UNSET ( dst_ptr , RTS_RECEIVING ) #NEWLINE# if DEBUG_IPC_HOOK : #NEWLINE# #INDENT# hook_ipc_msgsend ( dst_ptr [ 'p_delivermsg' ] , caller_ptr , dst_ptr ) #NEWLINE# hook_ipc_msgrecv ( dst_ptr [ 'p_delivermsg' ] , caller_ptr , dst_ptr ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( flags & NON_BLOCKING ) : #NEWLINE# #INDENT# return ENOTREADY #NEWLINE# #UNINDENT# if deadlock ( send , caler_ptr , dst_e ) : #NEWLINE# #INDENT# return ELOCKED #NEWLINE# #UNINDENT# if ( not ( flags & FROM_KERNEL ) ) : #NEWLINE# #INDENT# if copy_msg_from_user ( m_ptr , caller_ptr [ 'p_sendmsg' ] ) : #NEWLINE# #INDENT# return EFAULT #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# caller_ptr [ 'p_sendmsg' ] = m_ptr #NEWLINE# 'We need to remember that this message is from kernel\n            so we can set the delivery status flags when the message\n            is actually delivered' #NEWLINE# caller_ptr [ 'p_misc_flags' ] |= MF_SENDING_FROM_KERNEL #NEWLINE# #UNINDENT# RTS_SET ( caller_ptr , RTS_SENDING ) #NEWLINE# caller_ptr [ 'p_sendto_e' ] = dst_e #NEWLINE# assert ( caller_ptr [ 'p_q_link' ] == None ) #NEWLINE# '\n        while (*xpp) xpp = &(*xpp)->p_q_link;\n\t*xpp = caller_ptr;\n        ' #NEWLINE# if DEBUG_IPC_HOOK : #NEWLINE# #INDENT# hook_ipc_msgsend ( caller_ptr [ 'p_sendmsg' ] , caller_ptr , dst_ptr ) #NEWLINE# #UNINDENT# #UNINDENT# return OK