⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmap_user2.c

📁 fsmlabs的real time linux的内核
💻 C
字号:
/* * Written by Der Herr Hofrat, der.herr@hofr.at * (C) 2002 FSMLabs * License: GPL Version 2 */#include <stdio.h>#include <unistd.h>#include <sys/mman.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include "device_common.h"int main(void){	int fd;	unsigned int *addr;	if((fd=open(SIMPLE_DEV, O_RDWR|O_SYNC))<0)	{		perror("open");		exit(-1);	}	addr = mmap(0, LEN, PROT_READ, MAP_SHARED, fd, 0);  	if(!addr)	{		perror("mmap");		exit(-1);	}	else	{		printf("Found: %s\n",addr);	}	munmap(addr,LEN);  	close(fd);	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -