tst-valloc.c 375 B

1234567891011121314151617181920212223
  1. /* Test case by Stephen Tweedie <sct@redhat.com>. */
  2. #include <unistd.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. int
  6. main (void)
  7. {
  8. char *p;
  9. int pagesize = getpagesize ();
  10. int i;
  11. p = valloc (pagesize);
  12. i = (long int) p;
  13. if ((i & (pagesize-1)) != 0)
  14. {
  15. fprintf (stderr, "Alignment problem: valloc returns %p\n", p);
  16. exit (1);
  17. }
  18. return 0;
  19. }