tst-valloc.c 429 B

123456789101112131415161718192021222324252627
  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. #if __UCLIBC_SUSV2_LEGACY__
  9. char *p;
  10. int pagesize = getpagesize ();
  11. int i;
  12. p = valloc (pagesize);
  13. i = (long int) p;
  14. if ((i & (pagesize-1)) != 0)
  15. {
  16. fprintf (stderr, "Alignment problem: valloc returns %p\n", p);
  17. exit (1);
  18. }
  19. return 0;
  20. #else
  21. return 23;
  22. #endif
  23. }