version 1.1.1.1, 2008/08/28 13:18:30
|
version 1.1.1.1.2.4, 2010/09/01 20:24:20
|
Line 1
|
Line 1
|
|
/************************************************************************* |
|
* (C) 2008 AITNET ltd - Sofia/Bulgaria - <misho@aitbg.com> |
|
* by Michael Pounov <misho@openbsd-bg.org> |
|
* |
|
* $Author$ |
|
* $Id$ |
|
* |
|
*************************************************************************/ |
#ifndef __AITSESS_H |
#ifndef __AITSESS_H |
#define __AITSESS_H |
#define __AITSESS_H |
|
|
Line 118 inline void *ipc_attachSession(tagSess * __restrict s,
|
Line 126 inline void *ipc_attachSession(tagSess * __restrict s,
|
inline void ipc_detachSession(tagSess * __restrict s); |
inline void ipc_detachSession(tagSess * __restrict s); |
|
|
/* |
/* |
|
* isAttached() Check for mapped/(attached) shared memory |
|
* @s = Session item |
|
* return: -1 null session item, 0 not attached, 1 attached memory |
|
*/ |
|
inline int isAttached(tagSess * __restrict s); |
|
|
|
|
|
/* |
* map_notSemaphore() MMAP negative block if semaphore isn`t signaled |
* map_notSemaphore() MMAP negative block if semaphore isn`t signaled |
* @s = Session item |
* @s = Session item |
*/ |
*/ |
Line 165 inline int ipc_addSemaphore(tagSess * __restrict s);
|
Line 181 inline int ipc_addSemaphore(tagSess * __restrict s);
|
*/ |
*/ |
inline int ipc_decSemaphore(tagSess * __restrict s); |
inline int ipc_decSemaphore(tagSess * __restrict s); |
|
|
|
|
// --------------------------------------------------------- |
// --------------------------------------------------------- |
// |
// |
// Lazy macros for lazy programmers :-) by Michael Pounov; Optimizing work with sessions! |
// Lazy macros for lazy programmers :-) by Michael Pounov; Optimizing work with sessions! |
// |
// |
|
|
#define DESTROY_SESSION(fname, s) do { \ |
#define DESTROY_SESSION(fname, s) do { \ |
switch ((s)->type) { \ | switch (((*s))->type) { \ |
case SHARED_IPC: \ |
case SHARED_IPC: \ |
ipc_destroySession((fname), (s)); \ |
ipc_destroySession((fname), (s)); \ |
break; \ |
break; \ |
Line 181 inline int ipc_decSemaphore(tagSess * __restrict s);
|
Line 198 inline int ipc_decSemaphore(tagSess * __restrict s);
|
} \ |
} \ |
} while(0) |
} while(0) |
|
|
#define ATTACH_MEMORY(s, shared) do { \ | #define ATTACH_MEMORY(s) do { \ |
switch ((s)->type) { \ |
switch ((s)->type) { \ |
case SHARED_IPC: \ |
case SHARED_IPC: \ |
(shared) = ipc_attachSession((s), 0); \ | ipc_attachSession((s), 0); \ |
break; \ |
break; \ |
case SHARED_MAP: \ |
case SHARED_MAP: \ |
(shared) = map_attachSession((s), 0); \ | map_attachSession((s), 0); \ |
break; \ |
break; \ |
} \ |
} \ |
} while(0) |
} while(0) |
Line 255 inline int ipc_decSemaphore(tagSess * __restrict s);
|
Line 272 inline int ipc_decSemaphore(tagSess * __restrict s);
|
|
|
// --------------------------------------------------------- |
// --------------------------------------------------------- |
|
|
|
/* |
|
* sess_GetValues() Get all values from session shared memory |
|
* @s = Session item |
|
* @ppsVals = Return array strings |
|
* return: -1 error: in parameter, !=-1 count of returned strings in ppsVals (must be free after use!) |
|
*/ |
|
int sess_GetValues(tagSess * __restrict s, char ***ppsVals); |
/* |
/* |
* sess_GetValue() Get value from session shared memory from attribute |
* sess_GetValue() Get value from session shared memory from attribute |
* @s = Session item |
* @s = Session item |