Hi!
> +     case 0:
> +             sprintf(mapfile, "/proc/%u/maps", getpid());

You could use /proc/self/maps instead.

> +             memset(t, 2, ps);
> +             u = mmap(t + 3*ps, 3*ps, PROT_WRITE,
> +                         MAP_ANONYMOUS|MAP_PRIVATE, 0, 0);
> +             if (u == MAP_FAILED)
> +                     tst_brkm(TBROK|TERRNO, NULL, "mmap");
> +             tst_resm(TINFO, "u = %p", u);
> +             memset(u, 2, 4096);
> +             x = get_end_addr(u, mapfile);
> +             if (x == u + 6*ps)
> +                     tst_resm(TFAIL, "A single 6*ps VMA found.");
> +             else if (x == u + 3*ps) {
> +                     y = get_end_addr(x, mapfile);
> +                     if (y == x + 3*ps)
> +                             tst_resm(TPASS, "two 3*ps VMAs found.");
> +             } else
> +                     tst_brkm(TBROK, cleanup, "unexpected VMA found.");
> +             exit(0);
> +     default:
> +             break;
> +     }
> +
> +}
> +
> +static void *get_end_addr(void *addr_s, char *mapfile)
> +{
> +     FILE *fp;
> +     void *s, *t;
> +     char buf[BUFSIZ];
> +
> +     fp = fopen(mapfile, "r+");

Hmm, "r+" opens the file for reading and writing (and sets the possition
on the start of the file). Shouldn't just "r" be sufficient?


-- 
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to