#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>

int main(int argc, char **argv)
{
	char buf[128]={0};
	void *pMemory;
	int fd = shm_open("mymemory", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG);
	ftruncate(fd, 1024);
	pMemory = mmap(0, 1024, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
	close(fd);
	memset(pMemory,0x41,16);
	do
	{
		sleep(5);
	}while(getchar()!=0x61);
	munmap(pMemory,1024);
	shm_unlink("mymemory");
	exit(0);
}
