From 059529e685e059d366ee56aa6117ee0d4e899e66 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 21 Jul 2016 10:15:02 +0200 Subject: score: Add debug support to chains This helps to detect * double insert, append, prepend errors, and * get from empty chain errors. --- cpukit/posix/src/aio_misc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cpukit/posix/src/aio_misc.c') diff --git a/cpukit/posix/src/aio_misc.c b/cpukit/posix/src/aio_misc.c index bdcd0d38d8..5a281a94f5 100644 --- a/cpukit/posix/src/aio_misc.c +++ b/cpukit/posix/src/aio_misc.c @@ -116,6 +116,7 @@ rtems_aio_search_fd (rtems_chain_control *chain, int fildes, int create) else { r_chain = malloc (sizeof (rtems_aio_request_chain)); rtems_chain_initialize_empty (&r_chain->perfd); + rtems_chain_initialize_node (&r_chain->next_fd); if (rtems_chain_is_empty (chain)) rtems_chain_prepend (chain, &r_chain->next_fd); @@ -222,9 +223,9 @@ void rtems_aio_remove_fd (rtems_aio_request_chain *r_chain) while (!rtems_chain_is_tail (chain, node)) { - rtems_chain_extract (node); rtems_aio_request *req = (rtems_aio_request *) node; node = rtems_chain_next (node); + rtems_chain_extract (&req->next_prio); req->aiocbp->error_code = ECANCELED; req->aiocbp->return_value = -1; free (req); @@ -311,6 +312,7 @@ rtems_aio_enqueue (rtems_aio_request *req) we can use aio_reqprio to lower the priority of the request */ pthread_getschedparam (pthread_self(), &policy, ¶m); + rtems_chain_initialize_node (&req->next_prio); req->caller_thread = pthread_self (); req->priority = param.sched_priority - req->aiocbp->aio_reqprio; req->policy = policy; -- cgit v1.2.3