Changeset d7d3267 for lib/format_linux_ring.c
- Timestamp:
- 11/29/18 13:37:20 (2 years ago)
- Branches:
- develop
- Children:
- 50e9c6b
- Parents:
- 54642da (diff), fdf23b8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_linux_ring.c
rffae0a5 rd7d3267 45 45 #include <unistd.h> 46 46 #include <string.h> 47 #include <assert.h>48 47 49 48 #ifdef HAVE_INTTYPES_H … … 149 148 150 149 /* In case we have some silly values*/ 151 assert(req->tp_block_size); 152 assert(req->tp_block_nr); 153 assert(req->tp_frame_size); 154 assert(req->tp_frame_nr); 155 assert(req->tp_block_size % req->tp_frame_size == 0); 150 if (!req->tp_block_size) { 151 fprintf(stderr, "Unexpected value of zero for req->tp_block_size in calculate_buffers()\n"); 152 } 153 if (!req->tp_block_nr) { 154 fprintf(stderr, "Unexpected value of zero for req->tp_block_nr in calculate_buffers()\n"); 155 } 156 if (!req->tp_frame_size) { 157 fprintf(stderr, "Unexpected value of zero for req->tp_frame_size in calculate_buffers()\n"); 158 } 159 if (!req->tp_frame_nr) { 160 fprintf(stderr, "Unexpected value of zero for req->tp_frame_nr in calculate_buffers()\n"); 161 } 162 if (req->tp_block_size % req->tp_frame_size != 0) { 163 fprintf(stderr, "Unexpected value of zero for req->tp_block_size %% req->tp_frame_size in calculate_buffers()\n"); 164 } 156 165 } 157 166 … … 448 457 size_t size) 449 458 { 450 assert(packet); 459 if (!packet) { 460 fprintf(stderr, "NULL packet passed into linuxring_set_capture_length()\n"); 461 /* Return -1 on error? */ 462 return ~0U; 463 } 451 464 if (size > trace_get_capture_length(packet)) { 452 465 /* We should avoid making a packet larger */ … … 507 520 packet->buf_control = TRACE_CTRL_EXTERNAL; 508 521 packet->type = TRACE_RT_DATA_LINUX_RING; 509 522 510 523 /* Fetch the current frame */ 511 524 header = GET_CURRENT_BUFFER(stream); 512 525 if ((((unsigned long) header) & (pagesize - 1)) != 0) { 513 trace_set_err(libtrace, TRACE_ERR_BAD_PACKET, 514 "ring frame size is not a multiple of the page size");515 516 526 trace_set_err(libtrace, TRACE_ERR_BAD_IO, "Linux ring packet is not correctly " 527 "aligned to page size in linux_read_string()"); 528 return -1; 529 } 517 530 518 531 /* TP_STATUS_USER means that we can use the frame. … … 677 690 if (packet->buffer == NULL) 678 691 return; 692 <<<<<<< HEAD 679 693 if (!libtrace) { 680 694 return; 681 695 } 696 ======= 697 if (!packet->trace) { 698 fprintf(stderr, "Linux ring packet is not attached to a valid " 699 "trace, Unable to release it, in linuxring_fin_packet()\n"); 700 return; 701 } 702 >>>>>>> fdf23b83dbe8088f53ec27af98ec6ed7b71cc34d 682 703 683 704 /* If we own the packet (i.e. it's not a copy), we need to free it */
Note: See TracChangeset
for help on using the changeset viewer.