On 01/18/2012 04:54 AM, Shang Yanfeng wrote:
> many low memory boards don't have 1G memory,so add get_free_mem function
> for low memory target,limit 1000M for n32 file system test.
>
> signed-off-by: YanFeng.Shang<[email protected]>
> ---
> testcases/kernel/mem/mtest06/mmap2.c | 51
> ++++++++++++++++++++++++++-------
> 1 files changed, 40 insertions(+), 11 deletions(-)
>
> +/*******************************************************************************/
> +/* Finction get_free_mem
> +Description: get the free memory .
> +Return: free memory with M
> +/
> *******************************************************************************/
> +unsigned long get_free_mem()
> +{
> + struct sysinfo board_sysinfo;
> + unsigned long avail_mem;
> + int error;
> + error = sysinfo(&board_sysinfo);
> + printf("\n\ncode error=%d\n",error);
> + avail_mem = board_sysinfo.freeram/MB;
> + return avail_mem;
> +}
> +
Hi,
a few comments
Typo Finction should be replaced by Function
Why are you printing the error code unconditionally? This should
probably need to be replaced by
if(sysinfo(&board_sysinfo))
perror("sysinfo failed\n");
There is also no need to redeclare the error variable. You can use the
one which is globally defined by your C library using
extern int error;
But perror should do the trick anyway.
--
markos
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list