plibsys 0.0.5
pshmbuffer.h
Go to the documentation of this file.
1/*
2 * The MIT License
3 *
4 * Copyright (C) 2010-2017 Alexander Saprykin <saprykin.spb@gmail.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * 'Software'), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
70#if !defined (PLIBSYS_H_INSIDE) && !defined (PLIBSYS_COMPILATION)
71# error "Header files shouldn't be included directly, consider using <plibsys.h> instead."
72#endif
73
74#ifndef PLIBSYS_HEADER_PSHMBUFFER_H
75#define PLIBSYS_HEADER_PSHMBUFFER_H
76
77#include <ptypes.h>
78#include <pmacros.h>
79#include <perror.h>
80
82
84typedef struct PShmBuffer_ PShmBuffer;
85
99 psize size,
100 PError **error);
101
111
129
141 ppointer storage,
142 psize len,
143 PError **error);
144
158 ppointer data,
159 psize len,
160 PError **error);
161
170 PError **error);
171
180 PError **error);
181
188
190
191#endif /* PLIBSYS_HEADER_PSHMBUFFER_H */
Error report system.
struct PError_ PError
Opaque data structure for an error object.
Definition perror.h:68
Miscellaneous macros.
#define P_BEGIN_DECLS
Starts .h file declarations to be exported as C functions.
Definition pmacros.h:298
#define P_END_DECLS
Closes .h file declarations to be exported as C functions, should be always used after P_BEGIN_DECLS.
Definition pmacros.h:299
#define P_LIB_API
Exports a symbol from a shared library.
Definition pmacros.h:138
P_LIB_API pssize p_shm_buffer_get_used_space(PShmBuffer *buf, PError **error)
Gets used space in the shared memory buffer.
P_LIB_API void p_shm_buffer_clear(PShmBuffer *buf)
Clears all data in the buffer and fills it with zeros.
P_LIB_API pint p_shm_buffer_read(PShmBuffer *buf, ppointer storage, psize len, PError **error)
Tries to read data from a shared memory buffer.
P_LIB_API pssize p_shm_buffer_write(PShmBuffer *buf, ppointer data, psize len, PError **error)
Tries to write data into a shared memory buffer.
P_LIB_API pssize p_shm_buffer_get_free_space(PShmBuffer *buf, PError **error)
Gets free space in the shared memory buffer.
P_LIB_API PShmBuffer * p_shm_buffer_new(const pchar *name, psize size, PError **error)
Creates a new PShmBuffer structure.
P_LIB_API void p_shm_buffer_take_ownership(PShmBuffer *buf)
Takes ownership of a shared memory buffer.
struct PShmBuffer_ PShmBuffer
Shared memory buffer opaque data structure.
Definition pshmbuffer.h:84
P_LIB_API void p_shm_buffer_free(PShmBuffer *buf)
Frees PShmBuffer structure.
Types definitions.
signed int pssize
Type for a platform independent signed size_t.
Definition ptypes.h:223
char pchar
Type for a char.
Definition ptypes.h:116
unsigned int psize
Type for a platform independent size_t.
Definition ptypes.h:224
void * ppointer
Type for a pointer.
Definition ptypes.h:109
int pint
Type for an int.
Definition ptypes.h:120