#include <sys/types.h>
Go to the source code of this file.
Data Structures | |
struct | shbuf_status |
Structure encapsulating the status of a shared buffer. More... | |
Typedefs | |
typedef _shbuf | shbuf |
typedef of a shbuf object | |
Functions | |
shbuf * | shbuf_create (key_t key, unsigned long size) |
Creates a new shared buffer and returns a shbuf object encapsulating it. | |
shbuf * | shbuf_open (key_t key) |
Opens an existing shared buffer created by a call to shbuf_create() and returns a shbuf object encapsulating it. | |
void | shbuf_free (shbuf *sb) |
Frees an opened shared buffer and removes it, when the calling process is the provider. | |
int | shbuf_access (shbuf *sb, int mode) |
Sets the Unix access mode of the shared buffer. | |
key_t | shbuf_get_key (shbuf *sb) |
Returns the shared memory key of the shbuf object. | |
unsigned long | shbuf_get_size (shbuf *sb) |
Returns the size of the shared buffer in bytes. | |
unsigned char * | shbuf_get_pointer (shbuf *sb) |
Returns a pointer to the shared buffer. | |
shbuf_status * | shbuf_get_status (shbuf *sb) |
Returns a pointer to the shbuf_status object attached to the shared buffer. | |
int | shbuf_notify_enable (shbuf *sb, int b) |
Enables or disabled notifying mode. | |
int | shbuf_notify (shbuf *sb) |
Notifies the other side of the shared buffer. | |
int | shbuf_wait (shbuf *sb) |
Waits for a notification from the other side of the shared buffer. | |
int | shbuf_get_select_fd (shbuf *sb) |
Returns the file descriptor the program may select() on for waiting for changes in the buffer. | |
int | shbuf_post_select (shbuf *sb) |
Cleans up a notifying shbuf. | |
int | shbuf_status_lock (shbuf *sb) |
Lock the shbuf_status structure attached to the shbuf object. | |
int | shbuf_status_unlock (shbuf *sb) |
Unlock the shbuf_status structure attached to the shbuf object. | |
int | shbuf_reset (shbuf *sb) |
Reset the status structure of the shared buffer. | |
int | shbuf_zero (shbuf *sb) |
Similar to shbuf_reset() , but zeroes the shared buffered completely. | |
int | shbuf_set_backlog_target (shbuf *sb, unsigned long bl) |
Sets the desired backlog size in bytes. | |
unsigned long | shbuf_get_backlog_target (shbuf *sb) |
Returns the current desired backlog size in bytes. | |
const unsigned char * | shbuf_get_read_pointer (shbuf *sb, unsigned long *l) |
Returns a pointer to the next data which may be read from the buffer. | |
int | shbuf_inc_read_pointer (shbuf *sb, unsigned long r) |
Increments the read index of the shared buffer by a given amount of bytes. | |
unsigned char * | shbuf_get_write_pointer (shbuf *sb, unsigned long *l) |
Returns a pointer to the next data which may be written to the buffer. | |
int | shbuf_inc_write_pointer (shbuf *sb, unsigned long r) |
Increments the write index of the shared buffer by a given amount of bytes. | |
int | shbuf_connected (shbuf *sb) |
Checks whether a client as well as a provider are connected to the the shared buffer. | |
int | shbuf_is_full (shbuf *sb) |
Checks whether the shared buffer is full. | |
int | shbuf_is_empty (shbuf *sb) |
Checks whether the shared buffer is empty. | |
unsigned long | shbuf_rewind (shbuf *sb, unsigned long v) |
Tries to rewind the read index or returns the size of the current backlog. | |
signed long | shbuf_read (shbuf *sb, unsigned char *c, signed long l) |
A function similar to the C library's read() . | |
signed long | shbuf_write (shbuf *sb, const unsigned char *c, signed long l) |
A function similar to the C library's write() . |
|
typedef of a shbuf object
|
|
Sets the Unix access mode of the shared buffer. It defaults to 0700 on creation.
|
|
Checks whether a client as well as a provider are connected to the the shared buffer.
|
|
Creates a new shared buffer and returns a shbuf object encapsulating it. The calling process becomes the provider of the buffer.
|
|
Frees an opened shared buffer and removes it, when the calling process is the provider. The shbuf object is freed.
|
|
Returns the current desired backlog size in bytes. This defaults to 0 on newly created shbuf objects.
|
|
Returns the shared memory key of the shbuf object.
|
|
Returns a pointer to the shared buffer. It is valid until the shbuf object is freed.
|
|
Returns a pointer to the next data which may be read from the buffer.
|
|
Returns the file descriptor the program may
|
|
Returns the size of the shared buffer in bytes.
|
|
Returns a pointer to the It is valid until the shbuf object is freed.
|
|
Returns a pointer to the next data which may be written to the buffer.
|
|
Increments the read index of the shared buffer by a given amount of bytes.
|
|
Increments the write index of the shared buffer by a given amount of bytes.
|
|
Checks whether the shared buffer is empty.
|
|
Checks whether the shared buffer is full.
|
|
Notifies the other side of the shared buffer. A call to this function will be ignored when the other side hasn't enabled notifying mode.
|
|
Enables or disabled notifying mode.
When this is enabled, the process may wait for changes in the buffer with standard
|
|
Opens an existing shared buffer created by a call to The calling process becomes the client of the shbuf.
|
|
Cleans up a notifying shbuf.
Should be called immediately after a
|
|
A function similar to the C library's
Reads at most
|
|
Reset the status structure of the shared buffer. This may be used for emptying the buffer at once.
|
|
Tries to rewind the read index or returns the size of the current backlog.
|
|
Sets the desired backlog size in bytes.
|
|
Lock the This should be done before accessing any of the member fields. This may block when another process has locked the shared buffer. These locks are not recursive!
|
|
Unlock the This should be done after accessing any of the member fields.
|
|
Waits for a notification from the other side of the shared buffer.
This call doesn't do anything more than calling
|
|
A function similar to the C library's
Writes at most
|
|
Similar to
|