Revision 7dd7c987 tests/test-mmap.c
b/tests/test-mmap.c | ||
---|---|---|
377 | 377 |
|
378 | 378 |
void check_file_fixed_mmaps(void) |
379 | 379 |
{ |
380 |
unsigned int *addr;
|
|
380 |
unsigned char *addr;
|
|
381 | 381 |
unsigned int *p1, *p2, *p3, *p4; |
382 | 382 |
int i; |
383 | 383 |
|
384 | 384 |
/* Find a suitable address to start with. */ |
385 |
addr = mmap(NULL, pagesize * 44 * 3, PROT_READ,
|
|
385 |
addr = mmap(NULL, pagesize * 40 * 4, PROT_READ,
|
|
386 | 386 |
MAP_PRIVATE | MAP_ANONYMOUS, |
387 | 387 |
-1, 0); |
388 | 388 |
fprintf (stderr, "%s addr=%p", __func__, (void *)addr); |
... | ... | |
405 | 405 |
|
406 | 406 |
/* Make sure we get pages aligned with the pagesize. |
407 | 407 |
The target expects this. */ |
408 |
fail_unless (p1 == addr); |
|
409 |
fail_unless (p2 == addr + pagesize); |
|
410 |
fail_unless (p3 == addr + pagesize * 2); |
|
411 |
fail_unless (p4 == addr + pagesize * 3); |
|
408 |
fail_unless (p1 == (void *)addr);
|
|
409 |
fail_unless (p2 == (void *)addr + pagesize);
|
|
410 |
fail_unless (p3 == (void *)addr + pagesize * 2);
|
|
411 |
fail_unless (p4 == (void *)addr + pagesize * 3);
|
|
412 | 412 |
|
413 | 413 |
/* Verify that the file maps was made correctly. */ |
414 | 414 |
fail_unless (*p1 == 0); |
... | ... | |
425 | 425 |
munmap (p2, pagesize); |
426 | 426 |
munmap (p3, pagesize); |
427 | 427 |
munmap (p4, pagesize); |
428 |
addr += pagesize * 3;
|
|
428 |
addr += pagesize * 4;
|
|
429 | 429 |
} |
430 | 430 |
fprintf (stderr, " passed\n"); |
431 | 431 |
} |
Also available in: Unified diff