source: lib/data-struct/simple_circular_buffer.h @ 1ed69dc

cachetimestampsdeveloprc-4.0.4ringdecrementfixringperformance
Last change on this file since 1ed69dc was 1ed69dc, checked in by Shane Alcock <salcock@…>, 3 years ago

Be less casual with error checking in SCB data structure

  • ftruncate can fail, so actually check for that during init.
  • If this does happen, return an error from libtrace_scb_init() -- this means that libtrace_scb_init() now returns an int rather than void.
  • Update other API functions to make sure that they don't die horribly if the error returned by init is ignored.
  • Property mode set to 100644
File size: 699 bytes
Line 
1#ifndef LIBTRACE_SCB_H_
2#define LIBTRACE_SCB_H_
3
4#include "libtrace.h"
5
6typedef struct libtracescb {
7        uint8_t *address;
8        uint32_t count_bytes;
9        uint32_t write_offset;
10        uint32_t read_offset;
11        int fd;
12} libtrace_scb_t;
13
14
15DLLEXPORT int libtrace_scb_init(libtrace_scb_t *buf, uint32_t size,
16                uint16_t id);
17DLLEXPORT void libtrace_scb_destroy(libtrace_scb_t *buf);
18DLLEXPORT int libtrace_scb_recv_sock(libtrace_scb_t *buf, int sock,
19                int recvflags);
20DLLEXPORT uint8_t *libtrace_scb_get_read(libtrace_scb_t *buf,
21                uint32_t *available);
22DLLEXPORT void libtrace_scb_advance_read(libtrace_scb_t *buf, uint32_t forward);
23
24#endif
Note: See TracBrowser for help on using the repository browser.