--- libaitsess/src/aitsess.c 2008/08/28 13:18:30 1.1.1.1 +++ libaitsess/src/aitsess.c 2008/10/13 18:22:01 1.1.1.1.2.2 @@ -1,3 +1,11 @@ +/************************************************************************* +* (C) 2008 AITNET ltd - Sofia/Bulgaria - +* by Michael Pounov +* +* $Author: misho $ +* $Id: aitsess.c,v 1.1.1.1.2.2 2008/10/13 18:22:01 misho Exp $ +* +*************************************************************************/ #include "global.h" #include "aitsess.h" @@ -387,6 +395,19 @@ inline void ipc_detachSession(tagSess * __restrict s) shmdt(s->addr); s->addr = NULL; } +} + +/* + * 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) +{ + if (!s) + return -1; + + return (s->addr ? 1 : 0); }