1*4b169a6bSchristos #include <stdio.h> 2*4b169a6bSchristos #include <stdlib.h> 3*4b169a6bSchristos 4*4b169a6bSchristos /* Basic sanity check that syscalls to implement malloc (brk, mmap2, 5*4b169a6bSchristos munmap) are trivially functional. */ 6*4b169a6bSchristos main()7*4b169a6bSchristosint main () 8*4b169a6bSchristos { 9*4b169a6bSchristos void *p1, *p2, *p3, *p4, *p5, *p6; 10*4b169a6bSchristos 11*4b169a6bSchristos if ((p1 = malloc (8100)) == NULL 12*4b169a6bSchristos || (p2 = malloc (16300)) == NULL 13*4b169a6bSchristos || (p3 = malloc (4000)) == NULL 14*4b169a6bSchristos || (p4 = malloc (500)) == NULL 15*4b169a6bSchristos || (p5 = malloc (1023*1024)) == NULL 16*4b169a6bSchristos || (p6 = malloc (8191*1024)) == NULL) 17*4b169a6bSchristos { 18*4b169a6bSchristos printf ("fail\n"); 19*4b169a6bSchristos exit (1); 20*4b169a6bSchristos } 21*4b169a6bSchristos 22*4b169a6bSchristos free (p1); 23*4b169a6bSchristos free (p2); 24*4b169a6bSchristos free (p3); 25*4b169a6bSchristos free (p4); 26*4b169a6bSchristos free (p5); 27*4b169a6bSchristos free (p6); 28*4b169a6bSchristos 29*4b169a6bSchristos p1 = malloc (64000); 30*4b169a6bSchristos if (p1 == NULL) 31*4b169a6bSchristos { 32*4b169a6bSchristos printf ("fail\n"); 33*4b169a6bSchristos exit (1); 34*4b169a6bSchristos } 35*4b169a6bSchristos free (p1); 36*4b169a6bSchristos 37*4b169a6bSchristos printf ("pass\n"); 38*4b169a6bSchristos exit (0); 39*4b169a6bSchristos } 40