Ignore:
Timestamp:
11/29/18 13:37:20 (2 years ago)
Author:
Shane Alcock <salcock@…>
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.
Message:

Merge branch 'master' of git://github.com/jacobvw/libtrace into jacobvw-master

Conflicts:

lib/format_linux_ring.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_linux_ring.c

    rffae0a5 rd7d3267  
    4545#include <unistd.h>
    4646#include <string.h>
    47 #include <assert.h>
    4847
    4948#ifdef HAVE_INTTYPES_H
     
    149148
    150149        /* 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        }
    156165}
    157166
     
    448457                                           size_t size)
    449458{
    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        }
    451464        if (size > trace_get_capture_length(packet)) {
    452465                /* We should avoid making a packet larger */
     
    507520        packet->buf_control = TRACE_CTRL_EXTERNAL;
    508521        packet->type = TRACE_RT_DATA_LINUX_RING;
    509        
     522
    510523        /* Fetch the current frame */
    511524        header = GET_CURRENT_BUFFER(stream);
    512525        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                 return -1;
    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        }
    517530
    518531        /* TP_STATUS_USER means that we can use the frame.
     
    677690        if (packet->buffer == NULL)
    678691                return;
     692<<<<<<< HEAD
    679693        if (!libtrace) {
    680694                return;
    681695        }
     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
    682703
    683704        /* 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.