Changeset 0a6638f for lib/trace.c


Ignore:
Timestamp:
02/20/06 18:36:13 (16 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
5b91b48
Parents:
8ee7caa
Message:

Fixed up erf output
Force trace_create_packet to be called, don't let people cheat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    rdf338b3 r0a6638f  
    331331 */
    332332       
    333 struct libtrace_out_t *trace_create_output(const char *uri) {
     333libtrace_out_t *trace_create_output(const char *uri) {
    334334        struct libtrace_out_t *libtrace = malloc(sizeof(struct libtrace_out_t));
    335335       
     
    382382        assert( libtrace->fifo);
    383383        free(scan);
     384        libtrace->started=false;
    384385        return libtrace;
    385386}
     
    403404
    404405        libtrace->started=true;
     406        return 0;
     407}
     408
     409int trace_start_output(libtrace_out_t *libtrace)
     410{
     411        assert(libtrace);
     412        if (libtrace->format->start_output) {
     413                int ret=libtrace->format->start_output(libtrace);
     414                if (ret < 0) {
     415                        return ret;
     416                }
     417        }
     418
     419        libtrace->started=false;
    405420        return 0;
    406421}
     
    495510libtrace_packet_t *trace_create_packet() {
    496511        libtrace_packet_t *packet = calloc(1,sizeof(libtrace_packet_t));
    497         /* This used to malloc a packet!  Why do we need to malloc a packet
    498          * if we're doing zero copy?
    499          */
     512        packet->buf_control=PACKET;
    500513        return packet;
    501514}
     
    525538        assert(libtrace->started && "BUG: You must call libtrace_start() before trace_read_packet()\n");
    526539        assert(packet);
     540        assert((packet->buf_control==PACKET || packet->buf_control==EXTERNAL)&&
     541                "BUG: You must allocate a packet using packet_create()");
    527542     
    528543        /* Store the trace we are reading from into the packet opaque
     
    15551570 * @param errcode either an Econstant from libc, or a LIBTRACE_ERROR
    15561571 * @param msg a plaintext error message
     1572 * @internal
    15571573 */
    15581574void trace_set_err(int errcode,const char *msg,...)
Note: See TracChangeset for help on using the changeset viewer.