High-Level Data Reduction Library 1.6.0a5
High-Level data reduction routines for ESO pipelines
Loading...
Searching...
No Matches
hdrl_buffer.c File Reference
#include "hdrl_buffer.h"
#include "hdrl_types.h"
#include "hdrl_utils.h"
#include <cpl.h>
#include <cxlist.h>
#include <unistd.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <fcntl.h>
#include <string.h>
Include dependency graph for hdrl_buffer.c:

Data Structures

struct  _hdrl_buffer_
 
struct  hdrl_pool_base
 
struct  hdrl_pool_mmap
 
struct  hdrl_pool_malloc
 

Macros

#define _POSIX_C_SOURCE   200112L /* posix_fallocate, ftruncate */
 
#define _XOPEN_SOURCE   600
 

Typedefs

typedef hdrl_pool_base hdrl_pool
 

Functions

hdrl_buffer * hdrl_buffer_new (void)
 Create buffer object.
 
size_t hdrl_buffer_set_malloc_threshold (hdrl_buffer *buf, size_t t)
 set total amount of memory the buffer can malloc
 
void hdrl_buffer_readonly (hdrl_buffer *buf, cpl_boolean ro)
 
char * hdrl_buffer_allocate (hdrl_buffer *buf, size_t size)
 Allocate memory block from buffer.
 
void hdrl_buffer_free (hdrl_buffer *HDRL_UNUSED(buf), char *p)
 
void hdrl_buffer_delete (hdrl_buffer *buf)
 delete buffer
 

Macro Definition Documentation

◆ _POSIX_C_SOURCE

#define _POSIX_C_SOURCE   200112L /* posix_fallocate, ftruncate */

◆ _XOPEN_SOURCE

#define _XOPEN_SOURCE   600

Typedef Documentation

◆ hdrl_pool

Function Documentation

◆ hdrl_buffer_allocate()

char * hdrl_buffer_allocate ( hdrl_buffer *  buf,
size_t  size 
)

Allocate memory block from buffer.

Parameters
bufbuffer object
sizesize of memory to allocate
Returns
writable memory block, or NULL on failure

◆ hdrl_buffer_delete()

void hdrl_buffer_delete ( hdrl_buffer *  buf)

delete buffer

Parameters
bufbuffer

Invalidates memory of all objects contained in the buffer

◆ hdrl_buffer_free()

void hdrl_buffer_free ( hdrl_buffer *  HDRL_UNUSEDbuf,
char *  p 
)

◆ hdrl_buffer_new()

hdrl_buffer * hdrl_buffer_new ( void  )

Create buffer object.

Returns
buffer object useable to obtain memory mapped memory

◆ hdrl_buffer_readonly()

void hdrl_buffer_readonly ( hdrl_buffer *  buf,
cpl_boolean  ro 
)

◆ hdrl_buffer_set_malloc_threshold()

size_t hdrl_buffer_set_malloc_threshold ( hdrl_buffer *  buf,
size_t  t 
)

set total amount of memory the buffer can malloc

Parameters
bufbuffer object
tamount of memory in MiB
Returns
old amount in wMiB
Note
changing threshold will only affect future allocation