File: testsbrk.c

package info (click to toggle)
zmailer 2.99.51.52pre3-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 16,596 kB
  • ctags: 7,422
  • sloc: ansic: 90,470; sh: 3,608; makefile: 2,784; perl: 1,585; python: 115; awk: 22
file content (22 lines) | stat: -rw-r--r-- 392 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>

int incr = 201;
char *cp;
int i;

main()
{
	extern char *sbrk();
	int sz;

	sz = getpagesize();
	printf("pagesize is 0x%08x (%d)\n", sz, sz);
	for(i = 0; i < 1000; i++) {
		if ((cp = sbrk(incr)) == (char *) -1) {
			fprintf(stderr, "Cannot sbrk further\n");
			exit(-1);
		}
		printf("segment starts at 0x%08x, ends at 0x%08x\n", (int) cp,
			(int) (cp + incr - 1));
	}
}