version 1.5, 2014/02/08 22:06:17
|
version 1.6, 2016/08/18 09:06:31
|
Line 12 terms:
|
Line 12 terms:
|
All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
|
|
Copyright 2004 - 2014 | Copyright 2004 - 2016 |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
|
|
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
Line 215 map_createSession(int nSeed, long nSize, sess_t * __re
|
Line 215 map_createSession(int nSeed, long nSize, sess_t * __re
|
{ |
{ |
char szSName[2][FILENAME_MAX]; |
char szSName[2][FILENAME_MAX]; |
va_list lst; |
va_list lst; |
|
struct stat st; |
|
|
if (!Sess || !*Sess->sess_name) |
if (!Sess || !*Sess->sess_name) |
return -1; |
return -1; |
Line 237 map_createSession(int nSeed, long nSize, sess_t * __re
|
Line 238 map_createSession(int nSeed, long nSize, sess_t * __re
|
memset(szSName, 0, sizeof szSName); |
memset(szSName, 0, sizeof szSName); |
snprintf(szSName[0], SEMNAME_MAX, "/%X.ANS", (u_int) Sess->sess_key); |
snprintf(szSName[0], SEMNAME_MAX, "/%X.ANS", (u_int) Sess->sess_key); |
#ifdef HAVE_SHM_OPEN |
#ifdef HAVE_SHM_OPEN |
snprintf(szSName[1], FILENAME_MAX, "/%s-%x.ANM", Sess->sess_name, (u_int) Sess->sess_key); | snprintf(szSName[1], FILENAME_MAX, "/%X.ANM", (u_int) Sess->sess_key); |
#else |
#else |
snprintf(szSName[1], FILENAME_MAX, "%s-%x.ANM", Sess->sess_name, (u_int) Sess->sess_key); |
snprintf(szSName[1], FILENAME_MAX, "%s-%x.ANM", Sess->sess_name, (u_int) Sess->sess_key); |
#endif |
#endif |
|
|
/* create semaphore & add 1 */ |
/* create semaphore & add 1 */ |
Sess->sess_id.sid = sem_open(szSName[0], O_CREAT, SESS_MEM_MODE); | Sess->sess_id.sid = sem_open(szSName[0], O_CREAT, SESS_MEM_MODE, 0); |
if (Sess->sess_id.sid == SEM_FAILED) { |
if (Sess->sess_id.sid == SEM_FAILED) { |
LOGERR; |
LOGERR; |
map_destroySession(Sess); |
map_destroySession(Sess); |
Line 264 map_createSession(int nSeed, long nSize, sess_t * __re
|
Line 265 map_createSession(int nSeed, long nSize, sess_t * __re
|
map_destroySession(Sess); |
map_destroySession(Sess); |
return -1; |
return -1; |
} |
} |
if (!Sess->sess_zcpy) { | if (fstat(Sess->sess_mem.fd, &st) == -1) { |
| LOGERR; |
| map_destroySession(Sess); |
| return -1; |
| } |
| if (st.st_size < nSize) { |
/* #ifdef HAVE_SHM_OPEN */ |
/* #ifdef HAVE_SHM_OPEN */ |
if (ftruncate(Sess->sess_mem.fd, nSize) == -1) { |
if (ftruncate(Sess->sess_mem.fd, nSize) == -1) { |
LOGERR; |
LOGERR; |