EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: EPICS/RTEMS bug in osdPoolStatus.c
From: Till Straumann <[email protected]>
To: Kate Feng <[email protected]>
Cc: [email protected]
Date: Mon, 11 Jun 2007 11:14:05 -0700
Kate Feng wrote:
EPICS  OSI Release : 3.14.x   ( at least 3.14.6 and up )
File : src/libCom/osi/os/RTEMS/osdPoolStatus.c

Problem :
"return (malloc_free_space() > 50000 + contiguousBlockSize);"
will falsely return true when RTEMS function call
malloc_free_space() returns -1, which actually indicates
an internal RTEMS error such as corrupted heap,or illegal
region id etc. Since neither EPICS nor RTEMS prints out
the error condition, this kind of error could be hard to be
debugged.
In most cases heap corruption results due to programming
errors (rather than internal errors) which emphasizes
Kate's point. osdPoolStatus should check
the return state of malloc_free_space(). However,
I'd suggest more drastic measures than just returning 0
such as printing a console message and aborting the
application.

Anyways, under RTEMS 4.8 the implementation has
changed and AFAIK malloc_free_space() can no longer
return -1.

T.

FIX : src/libCom/osi/os/RTEMS/osdPoolStatus.c return ( ((int) malloc_free_space()) > 50000 + contiguousBlockSize);

Or I actually preferred something like :

/*
 * osiSufficentSpaceInPool ()
 */
epicsShareFunc int epicsShareAPI osiSufficentSpaceInPool ( size_t
contiguousBlockSize )
{
  int free;

  if ( (free=malloc_free_space())==-1)
     return(0);
  if ( free < 100000 + contiguousBlockSize) {
    printf("Largest free space available : 0x%x,  requested
contiguousBlockSize : 0x%x\n",
    free, contiguousBlockSize);
    return(0);
  }
  return(1);
}

Besides, RTEMS should print out what the internal error message is.

Regards,
Kate




References:
EPICS/RTEMS bug in osdPoolStatus.c Kate Feng

Navigate by Date:
Prev: RE: IK320 problem Shepherd, EL (Emma)
Next: Re: CA client on unix bug Till Straumann
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: EPICS/RTEMS bug in osdPoolStatus.c Kate Feng
Next: Want support for MDS SMMC Steve Lewis
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·