version 1.3.2.2, 2011/09/07 16:08:41
|
version 1.3.2.5, 2011/09/07 23:38:39
|
Line 340 sess_prepareSession(tagSess * __restrict s, u_char use
|
Line 340 sess_prepareSession(tagSess * __restrict s, u_char use
|
sess_SetErr(EINVAL, "Error:: invalid argument\n"); |
sess_SetErr(EINVAL, "Error:: invalid argument\n"); |
return NULL; |
return NULL; |
} |
} |
|
if (s->addr) { |
|
sess_SetErr(EINVAL, "Error:: already attached memory\n"); |
|
return NULL; |
|
} |
|
|
ATTACH_MEMORY(s); |
ATTACH_MEMORY(s); |
if (!s->addr) |
if (!s->addr) |
Line 359 sess_prepareSession(tagSess * __restrict s, u_char use
|
Line 363 sess_prepareSession(tagSess * __restrict s, u_char use
|
hdr->hdr_argc, useDirect); |
hdr->hdr_argc, useDirect); |
ADD_SEMAPHORE(s, ret); |
ADD_SEMAPHORE(s, ret); |
|
|
if (!s->zcopy) | DETACH_MEMORY(s); |
DETACH_MEMORY(s); | |
return arr; |
return arr; |
} |
} |
|
|
Line 381 sess_doneSession(tagSess * __restrict s, array_t ** __
|
Line 384 sess_doneSession(tagSess * __restrict s, array_t ** __
|
|
|
if (!s->zcopy) |
if (!s->zcopy) |
io_arrayFree(*arr); |
io_arrayFree(*arr); |
else |
|
DETACH_MEMORY(s); |
|
io_arrayDestroy(arr); |
io_arrayDestroy(arr); |
} |
} |
|
|
Line 404 sess_commitSession(tagSess * __restrict s, array_t * _
|
Line 405 sess_commitSession(tagSess * __restrict s, array_t * _
|
return -1; |
return -1; |
} |
} |
|
|
if (!s->zcopy) | ATTACH_MEMORY(s); |
ATTACH_MEMORY(s); | |
if (!s->addr) { |
if (!s->addr) { |
if (!s->zcopy) | DETACH_MEMORY(s); |
DETACH_MEMORY(s); | |
| |
return -1; |
return -1; |
} else |
} else |
hdr = (sess_hdr_t*) s->addr; |
hdr = (sess_hdr_t*) s->addr; |
if (hdr->hdr_magic != SESS_AIT_MAGIC) { |
|
if (!s->zcopy) |
|
DETACH_MEMORY(s); |
|
|
|
sess_SetErr(EINVAL, "Error:: shared memory not contains values with proper format\n"); |
|
return -1; |
|
} |
|
|
|
DEC_SEMAPHORE(s, rs); |
DEC_SEMAPHORE(s, rs); |
if ((ret = io_vals2map(s->addr + sizeof(sess_hdr_t), s->eom - sizeof(sess_hdr_t), arr)) != -1) { |
if ((ret = io_vals2map(s->addr + sizeof(sess_hdr_t), s->eom - sizeof(sess_hdr_t), arr)) != -1) { |
|
hdr->hdr_magic = SESS_AIT_MAGIC; |
hdr->hdr_argc = io_arraySize(arr); |
hdr->hdr_argc = io_arraySize(arr); |
ret += sizeof(sess_hdr_t); |
ret += sizeof(sess_hdr_t); |
} |
} |
ADD_SEMAPHORE(s, rs); |
ADD_SEMAPHORE(s, rs); |
|
|
if (!s->zcopy) | DETACH_MEMORY(s); |
DETACH_MEMORY(s); | |
return ret; |
return ret; |
} |
} |