Changeset 7d1ada1
- Timestamp:
- 02/23/16 16:03:43 (5 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, master, ndag_format, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- a1935fa
- Parents:
- 9636216
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/trace.c
r9636216 r7d1ada1 1781 1781 1782 1782 /* Now fill in the libtrace packet itself */ 1783 assert(deadtrace); 1783 1784 packet->trace=deadtrace; 1784 1785 size=len+sizeof(hdr); 1786 if (size < LIBTRACE_PACKET_BUFSIZE) 1787 size = LIBTRACE_PACKET_BUFSIZE; 1785 1788 if (packet->buf_control==TRACE_CTRL_PACKET) { 1786 packet->buffer=realloc(packet->buffer,size);1789 packet->buffer = realloc(packet->buffer, size); 1787 1790 } 1788 1791 else { 1789 packet->buffer =malloc(size);1792 packet->buffer = malloc(size); 1790 1793 } 1791 1794 packet->buf_control=TRACE_CTRL_PACKET; 1792 1795 packet->header=packet->buffer; 1793 1796 packet->payload=(void*)((char*)packet->buffer+sizeof(hdr)); 1794 1795 /* Ugh, memcpy - sadly necessary */ 1796 memcpy(packet->header,&hdr,sizeof(hdr)); 1797 memcpy(packet->payload,data,(size_t)len); 1797 1798 /* Ugh, memmove - sadly necessary, also beware that we might be 1799 * moving data around within this packet, so ordering is important. 1800 */ 1801 memmove(packet->payload, data, (size_t)len); 1802 memmove(packet->header, &hdr, sizeof(hdr)); 1798 1803 packet->type=pcap_linktype_to_rt(libtrace_to_pcap_linktype(linktype)); 1799 1804
Note: See TracChangeset
for help on using the changeset viewer.