version 1.6, 2012/08/02 00:47:47
|
version 1.7, 2013/03/13 14:54:39
|
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, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 | Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 |
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 271 io_rreadv(int fd, struct iovec * __restrict bufs, int
|
Line 271 io_rreadv(int fd, struct iovec * __restrict bufs, int
|
if (!update) |
if (!update) |
lseek(fd, old, SEEK_SET); |
lseek(fd, old, SEEK_SET); |
|
|
acb = io_calloc(sizeof(void*), nbufs); | acb = e_calloc(sizeof(void*), nbufs); |
if (!acb) { |
if (!acb) { |
LOGERR; |
LOGERR; |
return -1; |
return -1; |
} |
} |
memset(acb, 0, sizeof(void*) * nbufs); |
memset(acb, 0, sizeof(void*) * nbufs); |
for (i = 0, off = offset; i < nbufs; off += bufs[i++].iov_len) { |
for (i = 0, off = offset; i < nbufs; off += bufs[i++].iov_len) { |
acb[i] = io_malloc(sizeof(struct aiocb)); | acb[i] = e_malloc(sizeof(struct aiocb)); |
if (!acb[i]) { |
if (!acb[i]) { |
LOGERR; |
LOGERR; |
for (i = 0; i < nbufs; i++) |
for (i = 0; i < nbufs; i++) |
if (acb[i]) |
if (acb[i]) |
io_free(acb[i]); | e_free(acb[i]); |
io_free(acb); | e_free(acb); |
return -1; |
return -1; |
} else |
} else |
memset(acb[i], 0, sizeof(struct aiocb)); |
memset(acb[i], 0, sizeof(struct aiocb)); |
Line 300 io_rreadv(int fd, struct iovec * __restrict bufs, int
|
Line 300 io_rreadv(int fd, struct iovec * __restrict bufs, int
|
LOGERR; |
LOGERR; |
for (i = 0; i < nbufs; i++) |
for (i = 0; i < nbufs; i++) |
if (acb[i]) |
if (acb[i]) |
io_free(acb[i]); | e_free(acb[i]); |
io_free(acb); | e_free(acb); |
return -1; |
return -1; |
} |
} |
|
|
Line 309 io_rreadv(int fd, struct iovec * __restrict bufs, int
|
Line 309 io_rreadv(int fd, struct iovec * __restrict bufs, int
|
bufs[i].iov_len = aio_return(acb[i]); |
bufs[i].iov_len = aio_return(acb[i]); |
offset += bufs[i].iov_len; |
offset += bufs[i].iov_len; |
if (acb[i]) |
if (acb[i]) |
io_free(acb[i]); | e_free(acb[i]); |
} |
} |
io_free(acb); | e_free(acb); |
#else |
#else |
ret = preadv(fd, bufs, nbufs, offset); |
ret = preadv(fd, bufs, nbufs, offset); |
if (ret == -1) { |
if (ret == -1) { |
Line 362 io_rwritev(int fd, struct iovec * __restrict bufs, int
|
Line 362 io_rwritev(int fd, struct iovec * __restrict bufs, int
|
} |
} |
|
|
#ifdef AIO_OPS |
#ifdef AIO_OPS |
acb = io_calloc(sizeof(void*), nbufs); | acb = e_calloc(sizeof(void*), nbufs); |
if (!acb) { |
if (!acb) { |
LOGERR; |
LOGERR; |
return -1; |
return -1; |
} else |
} else |
memset(acb, 0, sizeof(void*) * nbufs); |
memset(acb, 0, sizeof(void*) * nbufs); |
for (i = 0, off = offset; i < nbufs; off += bufs[i++].iov_len) { |
for (i = 0, off = offset; i < nbufs; off += bufs[i++].iov_len) { |
acb[i] = io_malloc(sizeof(struct aiocb)); | acb[i] = e_malloc(sizeof(struct aiocb)); |
if (!acb[i]) { |
if (!acb[i]) { |
LOGERR; |
LOGERR; |
for (i = 0; i < nbufs; i++) |
for (i = 0; i < nbufs; i++) |
if (acb[i]) |
if (acb[i]) |
io_free(acb[i]); | e_free(acb[i]); |
io_free(acb); | e_free(acb); |
return -1; |
return -1; |
} else |
} else |
memset(acb[i], 0, sizeof(struct aiocb)); |
memset(acb[i], 0, sizeof(struct aiocb)); |
Line 391 io_rwritev(int fd, struct iovec * __restrict bufs, int
|
Line 391 io_rwritev(int fd, struct iovec * __restrict bufs, int
|
LOGERR; |
LOGERR; |
for (i = 0; i < nbufs; i++) |
for (i = 0; i < nbufs; i++) |
if (acb[i]) |
if (acb[i]) |
io_free(acb[i]); | e_free(acb[i]); |
io_free(acb); | e_free(acb); |
return -1; |
return -1; |
} |
} |
|
|
Line 400 io_rwritev(int fd, struct iovec * __restrict bufs, int
|
Line 400 io_rwritev(int fd, struct iovec * __restrict bufs, int
|
bufs[i].iov_len = aio_return(acb[i]); |
bufs[i].iov_len = aio_return(acb[i]); |
offset += bufs[i].iov_len; |
offset += bufs[i].iov_len; |
if (acb[i]) |
if (acb[i]) |
io_free(acb[i]); | e_free(acb[i]); |
} |
} |
io_free(acb); | e_free(acb); |
#else |
#else |
ret = pwritev(fd, bufs, nbufs, offset); |
ret = pwritev(fd, bufs, nbufs, offset); |
if (ret == -1) { |
if (ret == -1) { |