You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
721 B
37 lines
721 B
/**
|
|
* my implementation of a ringbuffer.
|
|
* It maps a shared memory object twice directly following
|
|
* thus make it possible to read and write from any
|
|
* position within the buffer without the nasty wrap
|
|
* calculations.
|
|
* This is achived because the same memory region is mapped
|
|
* at the two addresses.
|
|
*/
|
|
#ifndef __RINGBUFFER_H__
|
|
#define __RINGBUFFER_H__
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include "class.h"
|
|
|
|
#define ERBOVRFL 100
|
|
|
|
|
|
CLASS(Ringbuffer) {
|
|
char * shm_name; // shared memory identifier
|
|
|
|
char * buffer;
|
|
char * mirror;
|
|
|
|
size_t bsize;
|
|
size_t bused;
|
|
size_t bstart;
|
|
size_t bend;
|
|
};
|
|
|
|
ssize_t rbRead(Ringbuffer, int fd);
|
|
ssize_t rbWrite(Ringbuffer, int fd);
|
|
|
|
#endif // __RINGBUFFER_H__
|
|
|
|
// vim: set ts=4 sw=4:
|