diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-07-13 15:14:47 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-07-18 09:33:16 +0200 |
commit | e0942613f134ac28c5c6cdae99060989b6db1d08 (patch) | |
tree | 9885a2d895e65b40d6c0019a7113f12f57575f50 /cpukit/score/src | |
parent | aarch64: Memory map the noinit section (diff) | |
download | rtems-e0942613f134ac28c5c6cdae99060989b6db1d08.tar.bz2 |
score: Fix _Objects_Active_count()
With unlimited objects the object maximum may be larger than the sum of active
and inactive objects.
Update #4677.
Diffstat (limited to 'cpukit/score/src')
-rw-r--r-- | cpukit/score/src/objectactivecount.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/cpukit/score/src/objectactivecount.c b/cpukit/score/src/objectactivecount.c index 028058e473..5f0304fead 100644 --- a/cpukit/score/src/objectactivecount.c +++ b/cpukit/score/src/objectactivecount.c @@ -46,14 +46,22 @@ Objects_Maximum _Objects_Active_count( const Objects_Information *information ) { - Objects_Maximum inactive; - Objects_Maximum maximum; + Objects_Maximum active; + Objects_Maximum index; + Objects_Maximum maximum; + Objects_Control **local_table; _Assert( _Objects_Allocator_is_owner() ); - inactive = (Objects_Maximum) - _Chain_Node_count_unprotected( &information->Inactive ); + active = 0; maximum = _Objects_Get_maximum_index( information ); + local_table = information->local_table; - return maximum - inactive; + for ( index = 0; index < maximum; ++index ) { + if ( local_table[ index ] != NULL ) { + ++active; + } + } + + return active; } |