Changeset 1336

Show
Ignore:
Timestamp:
02/04/08 16:26:47 (9 months ago)
Author:
spa1
Message:
  • Fixed compile error on systems where bh_tstamp in the bpf header is a bpf_timeval rather than a timeval, e.g. OpenBSD ( Reported by Niclas Rosell )
  • Updated all formats that require it to use the new "Do not own the buffer" prepare_packet flag
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/format_bpf.c

    r1332 r1336  
    353353                                FORMATIN(libtrace)->buffer; 
    354354        } 
    355  
     355        flags |= TRACE_PREP_DO_NOT_OWN_BUFFER; 
    356356        /* Read one packet out */ 
    357357         
     
    388388{ 
    389389        struct timeval tv; 
    390         tv=BPFHDR(packet)->bh_tstamp; 
     390        /* OpenBSD uses a bpf_timeval rather than a timeval so we must copy 
     391         * each timeval element individually rather than doing a structure 
     392         * assignment */ 
     393        tv.tv_sec = BPFHDR(packet)->bh_tstamp.tv_sec; 
     394        tv.tv_usec = BPFHDR(packet)->bh_tstamp.tv_usec; 
     395 
    391396        return tv; 
    392397} 
  • trunk/lib/format_dag24.c

    r1333 r1336  
    325325        } 
    326326 
     327        flags |= TRACE_PREP_DO_NOT_OWN_BUFFER; 
     328         
    327329        if (packet->buf_control == TRACE_CTRL_PACKET) { 
    328330                packet->buf_control = TRACE_CTRL_EXTERNAL; 
  • trunk/lib/format_dag25.c

    r1333 r1336  
    473473        } 
    474474 
     475        flags |= TRACE_PREP_DO_NOT_OWN_BUFFER; 
     476         
    475477        if (packet->buf_control == TRACE_CTRL_PACKET) { 
    476478                free(packet->buffer); 
  • trunk/lib/format_rt.c

    r1332 r1336  
    496496                libtrace_packet_t *packet, int blocking) { 
    497497        uint32_t prep_flags = 0; 
    498          
     498 
     499        prep_flags |= TRACE_PREP_DO_NOT_OWN_BUFFER; 
     500 
    499501        if (rt_read(libtrace, &packet->buffer, (size_t)RT_INFO->rt_hdr.length,  
    500502                                blocking) != RT_INFO->rt_hdr.length) {