aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-03-04 20:13:49 +0000
committerUlrich Drepper <drepper@redhat.com>2001-03-04 20:13:49 +0000
commit9f964ae39265952c51bc0f806d341ccb267e19b8 (patch)
tree70119e24da24c5f4d1ed4932eddd67ae9e5bdb24
parent0f9cc699c9633c7fcb9f03d1a8099992b05a6c5c (diff)
downloadglibc-9f964ae39265952c51bc0f806d341ccb267e19b8.zip
glibc-9f964ae39265952c51bc0f806d341ccb267e19b8.tar.gz
glibc-9f964ae39265952c51bc0f806d341ccb267e19b8.tar.bz2
(lio_listio): Add some asserts.
-rw-r--r--rt/lio_listio.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/rt/lio_listio.c b/rt/lio_listio.c
index aa267a8..e1df603 100644
--- a/rt/lio_listio.c
+++ b/rt/lio_listio.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <aio.h>
+#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
@@ -108,16 +109,20 @@ lio_listio (mode, list, nent, sig)
total = 0;
for (cnt = 0; cnt < nent; ++cnt)
- if (requests[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP)
- {
- waitlist[cnt].cond = &cond;
- waitlist[cnt].next = requests[cnt]->waiting;
- waitlist[cnt].counterp = &total;
- waitlist[cnt].sigevp = NULL;
- waitlist[cnt].caller_pid = 0; /* Not needed. */
- requests[cnt]->waiting = &waitlist[cnt];
- ++total;
- }
+ {
+ assert (requests[cnt] == NULL || list[cnt] != NULL);
+
+ if (requests[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP)
+ {
+ waitlist[cnt].cond = &cond;
+ waitlist[cnt].next = requests[cnt]->waiting;
+ waitlist[cnt].counterp = &total;
+ waitlist[cnt].sigevp = NULL;
+ waitlist[cnt].caller_pid = 0; /* Not needed. */
+ requests[cnt]->waiting = &waitlist[cnt];
+ ++total;
+ }
+ }
/* Since `pthread_cond_wait'/`pthread_cond_timedwait' are cancelation
points we must be careful. We added entries to the waiting lists
@@ -154,16 +159,21 @@ lio_listio (mode, list, nent, sig)
total = 0;
for (cnt = 0; cnt < nent; ++cnt)
- if (requests[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP)
- {
- waitlist->list[cnt].cond = NULL;
- waitlist->list[cnt].next = requests[cnt]->waiting;
- waitlist->list[cnt].counterp = &waitlist->counter;
- waitlist->list[cnt].sigevp = &waitlist->sigev;
- waitlist->list[cnt].caller_pid = caller_pid;
- requests[cnt]->waiting = &waitlist->list[cnt];
- ++total;
- }
+ {
+ assert (requests[cnt] == NULL || list[cnt] != NULL);
+
+ if (requests[cnt] != NULL
+ && list[cnt]->aio_lio_opcode != LIO_NOP)
+ {
+ waitlist->list[cnt].cond = NULL;
+ waitlist->list[cnt].next = requests[cnt]->waiting;
+ waitlist->list[cnt].counterp = &waitlist->counter;
+ waitlist->list[cnt].sigevp = &waitlist->sigev;
+ waitlist->list[cnt].caller_pid = caller_pid;
+ requests[cnt]->waiting = &waitlist->list[cnt];
+ ++total;
+ }
+ }
waitlist->counter = total;
waitlist->sigev = *sig;