Ejemplo n.º 1
0
/*
 * This routine allocates a buffer, puts the data supplied as
 * parameters into the buffer and sends the message. It does *NOT*
 * wait for a reply.
 */
extern int msgsend(ChannelID chan, const char *format,...)
{
    unsigned int length;
    p_Buffer buffer;
    va_list args;
# ifndef TARGET
    Packet *packet;

    packet = DevSW_AllocatePacket(Armsd_BufferSize);
    buffer = packet->pk_buffer;
# else
    buffer = angel_ChannelAllocBuffer(Angel_ChanBuffSize);
# endif

    if (buffer != NULL)
    {
        va_start(args, format);

        length = vmsgbuild(BUFFERDATA(buffer), format, args);

# ifdef TARGET
        angel_ChannelSend(CH_DEFAULT_DEV, chan, buffer, length);
# else
        packet->pk_length = length;
        Adp_ChannelWrite(chan, packet);
# endif

        va_end(args);
        return 0;
    }
    else
        return -1;
}
Ejemplo n.º 2
0
bool logadp_PreWarn(WarnLevel level)
{
    IGNORE(level);

    if ( ! boot_completed )
        return FALSE;

    if ( logadp_buf != NULL )
        return FALSE;            /* busy */

    if ( ! logadp_inUSRmode() )
        return FALSE;

    logadp_buf = angel_ChannelAllocBuffer( Angel_ChanBuffSize );
    if (logadp_buf != NULL)
    {
        char *prefix = LOGADP_PREFIX_STR;

        logadp_pos = (char *)logadp_buf;
        logadp_end = (char *)(logadp_buf + Angel_ChanBuffSize - 1);

        while ( (*logadp_pos++ = *prefix++) != '\0' )
            /* classic strcpy, no body required */ ;

        return TRUE;
    }
    else
        return FALSE;
}