--- libaitio/src/sess.c 2013/03/13 14:25:32 1.1.2.2 +++ libaitio/src/sess.c 2013/03/13 14:42:28 1.1.2.4 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: sess.c,v 1.1.2.2 2013/03/13 14:25:32 misho Exp $ +* $Id: sess.c,v 1.1.2.4 2013/03/13 14:42:28 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -62,11 +62,11 @@ sess_initSession(int id, const char *csFName, ait_sess char szStr[STRSIZ]; if (!csFName) { - sess_SetErr(EINVAL, "Filename is NULL"); + io_SetErr(EINVAL, "Filename is NULL"); return -1; } if (id < SHARED_UNKNOWN || id > SHARED_MAP) { - sess_SetErr(EPROTONOSUPPORT, "Session type not supported"); + io_SetErr(EPROTONOSUPPORT, "Session type not supported"); return -1; } @@ -80,7 +80,7 @@ sess_initSession(int id, const char *csFName, ait_sess memset(*Sess, 0, sizeof(ait_sess_t)); strlcpy((*Sess)->name, csFName, sizeof (*Sess)->name); - h = open((*Sess)->name, O_WRONLY | O_CREAT | O_EXCL, MEM_MODE); + h = open((*Sess)->name, O_WRONLY | O_CREAT | O_EXCL, SESS_MEM_MODE); if (h == -1) { if (errno != EEXIST) { LOGERR; @@ -124,7 +124,7 @@ sess_initSession(int id, const char *csFName, ait_sess (*Sess)->sess.incSem = (int (*)(void*)) map_incSemaphore; (*Sess)->sess.decSem = (int (*)(void*)) map_decSemaphore; } else { - sess_SetErr(EPROTONOSUPPORT, + io_SetErr(EPROTONOSUPPORT, "Session type not supported or wrong session type"); close(h); e_free(*Sess); @@ -156,7 +156,7 @@ sess_initSession(int id, const char *csFName, ait_sess (*Sess)->sess.incSem = (int (*)(void*)) map_incSemaphore; (*Sess)->sess.decSem = (int (*)(void*)) map_decSemaphore; } else { - sess_SetErr(EINVAL, "Session type must be specified"); + io_SetErr(EINVAL, "Session type must be specified"); close(h); unlink(csFName); e_free(*Sess); @@ -243,7 +243,7 @@ map_createSession(int nSeed, long nSize, ait_sess_t * #endif /* create semaphore & add 1 */ - Sess->id.sid = sem_open(szSName[0], O_CREAT, MEM_MODE); + Sess->id.sid = sem_open(szSName[0], O_CREAT, SESS_MEM_MODE); if (Sess->id.sid == SEM_FAILED) { LOGERR; map_destroySession(Sess); @@ -255,9 +255,9 @@ map_createSession(int nSeed, long nSize, ait_sess_t * /* create file for shared memory storage */ #ifdef HAVE_SHM_OPEN - Sess->mem.fd = shm_open(szSName[1], O_RDWR | O_CREAT, MEM_MODE); + Sess->mem.fd = shm_open(szSName[1], O_RDWR | O_CREAT, SESS_MEM_MODE); #else - Sess->mem.fd = open(szSName[1], O_RDWR | O_CREAT, MEM_MODE); + Sess->mem.fd = open(szSName[1], O_RDWR | O_CREAT, SESS_MEM_MODE); #endif if (Sess->mem.fd == -1) { LOGERR; @@ -360,7 +360,7 @@ ipc_createSession(int nSeed, long nSize, ait_sess_t * } /* create semaphore */ - Sess->id.semid = semget(Sess->key, 1, MEM_MODE | IPC_CREAT); + Sess->id.semid = semget(Sess->key, 1, SESS_MEM_MODE | IPC_CREAT); if (Sess->id.semid == -1) { LOGERR; ipc_destroySession(Sess); @@ -377,7 +377,7 @@ ipc_createSession(int nSeed, long nSize, ait_sess_t * } /* create shared memory object */ - Sess->mem.shmid = shmget(Sess->key, nSize, MEM_MODE | IPC_CREAT); + Sess->mem.shmid = shmget(Sess->key, nSize, SESS_MEM_MODE | IPC_CREAT); if (Sess->mem.shmid == -1) { LOGERR; ipc_destroySession(Sess); @@ -940,11 +940,11 @@ sess_prepareSession(ait_sess_t * __restrict s, char us assert(s); if (!s) { - sess_SetErr(EINVAL, "Invalid argument\n"); + io_SetErr(EINVAL, "Invalid argument\n"); return NULL; } if (s->addr) { - sess_SetErr(EINVAL, "Already attached memory\n"); + io_SetErr(EINVAL, "Already attached memory\n"); return NULL; } @@ -956,7 +956,7 @@ sess_prepareSession(ait_sess_t * __restrict s, char us if (hdr->hdr_magic != SESS_AIT_MAGIC) { DETACH_MEMORY(s); - sess_SetErr(EINVAL, "Shared memory not contains values with proper format\n"); + io_SetErr(EINVAL, "Shared memory not contains values with proper format\n"); return NULL; } @@ -983,7 +983,7 @@ sess_doneSession(ait_sess_t * __restrict s, array_t ** { assert(s); if (!s) { - sess_SetErr(EINVAL, "Invalid argument\n"); + io_SetErr(EINVAL, "Invalid argument\n"); return; } @@ -1009,7 +1009,7 @@ sess_commitSession(ait_sess_t * __restrict s, array_t assert(s && arr); if (!s || !arr) { - sess_SetErr(EINVAL, "Invalid argument\n"); + io_SetErr(EINVAL, "Invalid argument\n"); return -1; }