src/lib/occlib/ipc_ping.c
//Command that can be run in a thread context to ping another target
//The message is allocated on the stack
Command that can be run in a thread context to ping another target
The message is allocated on the stack
Command that can be run in a thread context to ping another target The message is allocated on the stack
int ipc_ping(ipc_ping_cmd_t* ping_cmd, uint32_t target_id)
{
    int rc;
    do
    {
        rc = ipc_set_cmd_target(&ping_cmd->msg, target_id);
        if(rc)
        {
            break;
        }
        rc = ipc_send_cmd(&ping_cmd->msg);
        if(rc)
        {
            break;
        }
        rc = KERN_SEMAPHORE_PEND(&ping_cmd->sem, KERN_SECONDS(1));
        if(rc)
        {
            if(rc == -KERN_SEMAPHORE_PEND_TIMED_OUT)
            {
                rc = IPC_RC_TIMEOUT;
            }
            break;
        }
        rc = ipc_get_rc(&ping_cmd->msg);
    }
    while(0);
    return rc;
}
int ipc_ping ( ipc_ping_cmd_t * ping_cmd , uint32_t target_id ) { int rc ; do { rc = ipc_set_cmd_target ( & ping_cmd -> msg , target_id ) ; if ( rc ) { break ; } rc = ipc_send_cmd ( & ping_cmd -> msg ) ; if ( rc ) { break ; } rc = KERN_SEMAPHORE_PEND ( & ping_cmd -> sem , KERN_SECONDS ( 1 ) ) ; if ( rc ) { if ( rc == - KERN_SEMAPHORE_PEND_TIMED_OUT ) { rc = IPC_RC_TIMEOUT ; } break ; } rc = ipc_get_rc ( & ping_cmd -> msg ) ; } while ( 0 ) ; return rc ; }
Command that can be run in a thread context to ping another target
The message is allocated on the stack
Command that can be run in a thread context to ping another target The message is allocated on the stack
//set the target (since this is a multi-target command) //send the command //assume that if we timed out then the target must have gone down. //response message was received.  Now return the ipc_rc