Files
ftmemsim-valgrind/none/tests/mips32/bug320057-mips32.c
Petar Jovanovic 302ca71a6a mips32: another VG_(am_get_advisory) needs non-single-page-size adjustment
Another mmap issue in which another VG_(am_get_advisory) needs adjustment
wrapper for cases when (VKI_SHMLBA > VKI_PAGE_SIZE) and argument is
VKI_MAP_SHARED.

Fix by DejanJ for Bug #320057.
Issue and the test case by Vasile Floroiu.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13450
2013-07-12 15:32:27 +00:00

37 lines
727 B
C

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "tests/sys_mman.h"
#include <errno.h>
#include <stdio.h>
#include <string.h>
/* Test case supplied by Vasile Floroiu. */
#define DO(cmd) printf(#cmd "; status: %s\n", strerror(errno))
#define SZ 48216 + 1024
int main()
{
int fd;
fd = shm_open("/hw_mngr.c", (O_CREAT | O_EXCL | O_RDWR),
(S_IREAD | S_IWRITE));
DO(shm_open());
{
void *ptr;
ftruncate(fd, SZ);
DO(ftruncate(fd, SZ));
ptr = mmap(0, SZ, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0);
DO(mmap());
munmap(ptr, SZ);
DO(munmap());
}
shm_unlink("/hw_mngr.c");
DO(shm_unlink());
return 0;
}