memshare
所属分类:网络
开发工具:Unix_Linux
文件大小:1KB
下载次数:37
上传日期:2006-04-18 20:07:55
上 传 者:
graph
说明: linux ipc
linux 下进程间通信
(linux IPS Inter Process Communication)
文件列表:
writemem.c (690, 2006-04-02)
/*readmem.c*/
#include
#include
#include
#include
#include "datastruct.h"
int main(int argc, char** argv) // map a normal file as shared mem:
{
int fd,i;
people *p_map;
fd=open( argv[1],O_CREAT|O_RDWR,00777 );
p_map = (people*)mmap(NULL,sizeof(people)*10,
PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);
for(i = 0;i<10;i++)
{
printf( "name: %s age %d;\n",(*(p_map+i)).name, (*(p_map+i)).age );
}
munmap( p_map, sizeof(people)*10 );
return 0;
}
近期下载者:
相关文件:
收藏者: