From: Markos Chandras <Markos.Chandras@imgtec.com>
To: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] updated mmap2.c for low memory target
Date: Wed, 18 Jan 2012 09:23:39 +0000 [thread overview]
Message-ID: <4F168F9B.3070709@imgtec.com> (raw)
In-Reply-To: <1326862455-16756-1-git-send-email-YanFeng.Shang@windriver.com>
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<YanFeng.Shang@windriver.com>
> ---
> 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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
prev parent reply other threads:[~2012-01-18 9:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-18 4:54 [LTP] [PATCH] updated mmap2.c for low memory target Shang Yanfeng
2012-01-18 9:23 ` Markos Chandras [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F168F9B.3070709@imgtec.com \
--to=markos.chandras@imgtec.com \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox