- Timestamp:
- 09/22/06 14:00:36 (16 years ago)
- 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:
- bed8c66
- Parents:
- 52c7cda
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_rt.c
rbad6a93 r01818c6 242 242 return -1; 243 243 } 244 RT_INFO->rt_hdr.type = RT_LAST; 244 245 245 246 return 0; … … 288 289 static int rt_read(libtrace_t *libtrace, void **buffer, size_t len, int block) { 289 290 int numbytes; 290 rt_header_t *test_hdr;291 291 292 292 assert(len <= RT_BUF_SIZE); … … 486 486 static int rt_read_packet_versatile(libtrace_t *libtrace, 487 487 libtrace_packet_t *packet,int blocking) { 488 static rt_header_t *pkt_hdr = 0; 489 490 if (pkt_hdr == 0) { 491 /* first time through */ 492 pkt_hdr = malloc(sizeof(rt_header_t)); 493 RT_INFO->rt_hdr.type = RT_LAST; 494 } 495 496 /* 497 if (packet->buf_control == TRACE_CTRL_EXTERNAL || !packet->buffer) { 498 packet->buf_control = TRACE_CTRL_PACKET; 499 packet->buffer = malloc(LIBTRACE_PACKET_BUFSIZE); 500 } 501 */ 488 rt_header_t *pkt_hdr = NULL; 489 void *void_hdr; 490 502 491 if (packet->buf_control == TRACE_CTRL_PACKET) { 503 492 packet->buf_control = TRACE_CTRL_EXTERNAL; … … 509 498 * rt header - I know it's hax and maybe I'll fix it later on */ 510 499 if (RT_INFO->rt_hdr.type == RT_LAST) { 511 500 void_hdr = (void *)pkt_hdr; 501 512 502 /* FIXME: Better error handling required */ 513 if (rt_read(libtrace, (void **)&pkt_hdr,503 if (rt_read(libtrace, &void_hdr, 514 504 sizeof(rt_header_t),blocking) != 515 505 sizeof(rt_header_t)) { 516 506 return -1; 517 507 } 518 508 pkt_hdr = (rt_header_t *)void_hdr; 509 519 510 /* Need to salvage these in case the next rt_read overwrites 520 511 * the buffer they came from! */
Note: See TracChangeset
for help on using the changeset viewer.