On 02/08/2012 04:21 PM, Wanlong Gao wrote:
> -static void setup(void)
> +void setup(void)
> {
> - char mypid[40];
> -
> - sprintf(mypid, "/%d", getpid());
> - TEMPFILE = strcat(mypid, TEMPFILE);
> - TEMPFILE = strcat(Hopt, TEMPFILE);
> -
> - tst_sig(FORK, DEF_HANDLER, cleanup);
> -
> TEST_PAUSE;
> -
> + tst_require_root(NULL);
> + if (mount("none", Hopt, "hugetlbfs", 0, NULL) < 0)
> + tst_brkm(TBROK|TERRNO, NULL,
> + "mount failed on %s", Hopt);
> +
> + set_sys_tune("nr_hugepages", hugepages, 1);
> + snprintf(TEMPFILE, sizeof(TEMPFILE), "%s/mmapfile%d",
> + Hopt, getpid());
> }
>
> -static void cleanup(void)
> +void cleanup(void)
> {
> TEST_CLEANUP;
>
> unlink(TEMPFILE);
>
> + umount(Hopt);
> + tst_rmdir();
> }
Hi, I just have another concern, that you might want to keep the initial
value of nr_hugepages and restore it once the test is done.
Thanks,
Caspar
------------------------------------------------------------------------------
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