Debian Codegraph @

modules/libcom/src/osi/os/RTEMS-posix/osdPoolStatus.c

raw
1 /*************************************************************************\
2 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE Versions 3.13.7
7 * and higher are distributed subject to a Software License Agreement found
8 * in file LICENSE that is included with this distribution.
9 \*************************************************************************/
10 #include <rtems.h>
11 #include <rtems/malloc.h>
12 #include <rtems/score/heap.h>
13 #define epicsExportSharedSymbols
14 #include "osiPoolStatus.h"
15
16 #if __RTEMS_MAJOR__<5
17 /*
18 * * osiSufficentSpaceInPool ()
19 * */
20 LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize )
21 {
22 rtems_malloc_statistics_t s;
23 unsigned long n;
24
25 malloc_get_statistics(&s);
26 n = s.space_available - (unsigned long)(s.lifetime_allocated - s.lifetime_freed);
27 return (n > (50000 + contiguousBlockSize));
28 }
29
30 #else
31 /*
32 * osiSufficentSpaceInPool ()
33 */
34 LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize )
35 {
36 unsigned long n;
37 Heap_Information_block info;
38
39 malloc_info( &info );
40 n = info.Stats.size - (unsigned long)(info.Stats.lifetime_allocated - info.Stats.lifetime_freed);
41 return (n > (50000 + contiguousBlockSize));
42 }
43 #endif