当前位置: 首页 > news >正文

商城网站模板建设会计培训班一般收费多少

商城网站模板建设,会计培训班一般收费多少,做图有什么网站,网页版传奇有哪些存储映射区介绍 存储映射I/O (Memory-mapped I/O) 使一个磁盘文件与存储空间中的一个缓冲区相映射。从缓冲区中取数据,就相当于读文件中的相应字节;将数据写入缓冲区,则会将数据写入文件。这样,就可在不使用read和write函数的情况…

存储映射区介绍

        存储映射I/O (Memory-mapped I/O) 使一个磁盘文件与存储空间中的一个缓冲区相映射。从缓冲区中取数据,就相当于读文件中的相应字节;将数据写入缓冲区,则会将数据写入文件。这样,就可在不使用read和write函数的情况下,使用地址(指针)完成I/O操作。

        使用存储映射这种方法,首先应通知内核,将一个指定文件映射到存储区域中。这个映射工作可以通过mmap函数来实现。

mmap函数

	函数作用:建立存储映射区函数原型void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);函数返回值:成功:返回创建的映射区首地址;失败:MAP_FAILED宏参数:	addr: 	指定映射的起始地址, 通常设为NULL, 由系统指定length:映射到内存的文件长度prot:	映射区的保护方式, 最常用的:读:PROT_READ写:PROT_WRITE读写:PROT_READ | PROT_WRITEflags:	映射区的特性, 可以是MAP_SHARED: 写入映射区的数据会写回文件, 且允许其他映射该文件的进程共享。MAP_PRIVATE: 对映射区的写入操作会产生一个映射区的复制(copy-on-write), 对此区域所做的修改不会写回原文件。fd:由open返回的文件描述符, 代表要映射的文件。offset:以文件开始处的偏移量, 必须是4k的整数倍, 通常为0, 表示从文件头开始映射。

munmap函数

	函数作用:释放由mmap函数建立的存储映射区函数原型:int munmap(void addr[.length], size_t length);返回值:成功:返回0失败:返回-1,设置errno值函数参数:addr:调用mmap函数成功返回的映射区首地址length:映射区大小(mmap函数的第二个参数)

mmap进程间通信示例:创建write.c、read.c、test.log(里边随便写一些值,不能为空,为空写不进去)

//使用mmap函数完成两个不相干进程间通信 write.c内容:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>int main()
{//使用mmap函数建立共享映射区//void *mmap(void *addr, size_t length, int prot, int flags,//              int fd, off_t offset);int fd = open("./test.log", O_RDWR);if(fd<0){perror("open error");return -1;}int len = lseek(fd, 0, SEEK_END);//建立共享映射区void * addr = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);if(addr==MAP_FAILED){perror("mmap error");return -1;}memcpy(addr, "0123456789", 10);return 0;
}

//使用mmap函数完成两个不相干进程间通信 read.c内容:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>int main()
{//使用mmap函数建立共享映射区//void *mmap(void *addr, size_t length, int prot, int flags,//              int fd, off_t offset);int fd = open("./test.log", O_RDWR);if(fd<0){perror("open error");return -1;}int len = lseek(fd, 0, SEEK_END);//建立共享映射区void * addr = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);if(addr==MAP_FAILED){perror("mmap error");return -1;}char buf[64];memset(buf, 0x00, sizeof(buf));memcpy(buf, addr, 10);printf("buf=[%s]\n", buf);return 0;
}

编译后运行,test.log先打开随便赋一些内容,先运行write.c编译后的可执行程序,再运行write.c编译后的可执行程序。


文章转载自:
http://dinncosomething.bkqw.cn
http://dinncocityfied.bkqw.cn
http://dinncosnaillike.bkqw.cn
http://dinncogeodynamic.bkqw.cn
http://dinncoanaglyph.bkqw.cn
http://dinncotelfordize.bkqw.cn
http://dinncoryokan.bkqw.cn
http://dinncosherwani.bkqw.cn
http://dinncoencage.bkqw.cn
http://dinncooutrange.bkqw.cn
http://dinncomincing.bkqw.cn
http://dinncofluoride.bkqw.cn
http://dinncopictorialization.bkqw.cn
http://dinncotableware.bkqw.cn
http://dinncoreadmit.bkqw.cn
http://dinncojamshid.bkqw.cn
http://dinncopisolite.bkqw.cn
http://dinncoguidepost.bkqw.cn
http://dinncoacanthopterygian.bkqw.cn
http://dinncofancywork.bkqw.cn
http://dinncolaevorotatory.bkqw.cn
http://dinncopleximeter.bkqw.cn
http://dinncoschistorrhachis.bkqw.cn
http://dinncoganoblast.bkqw.cn
http://dinncoadmeasurement.bkqw.cn
http://dinncochishima.bkqw.cn
http://dinncomaritage.bkqw.cn
http://dinncohardy.bkqw.cn
http://dinncoreinhabit.bkqw.cn
http://dinncorethink.bkqw.cn
http://dinncogander.bkqw.cn
http://dinncotreponeme.bkqw.cn
http://dinncosoho.bkqw.cn
http://dinncograyling.bkqw.cn
http://dinncoipecac.bkqw.cn
http://dinncoeld.bkqw.cn
http://dinncoagile.bkqw.cn
http://dinncodacquoise.bkqw.cn
http://dinncopotassa.bkqw.cn
http://dinncoonflow.bkqw.cn
http://dinncomnemotechnist.bkqw.cn
http://dinnconeuroethology.bkqw.cn
http://dinncospiry.bkqw.cn
http://dinncoinobservantly.bkqw.cn
http://dinncorubellite.bkqw.cn
http://dinncoautobiographic.bkqw.cn
http://dinncoasynchronism.bkqw.cn
http://dinncospecky.bkqw.cn
http://dinncounderinsured.bkqw.cn
http://dinncorehalogenize.bkqw.cn
http://dinncopostdoctoral.bkqw.cn
http://dinncobriareus.bkqw.cn
http://dinncometaboly.bkqw.cn
http://dinncosugarhouse.bkqw.cn
http://dinncooctopodes.bkqw.cn
http://dinncosambuke.bkqw.cn
http://dinncochangeful.bkqw.cn
http://dinncoflatly.bkqw.cn
http://dinncoclasslist.bkqw.cn
http://dinncocurricula.bkqw.cn
http://dinncoinacceptable.bkqw.cn
http://dinncostrapwort.bkqw.cn
http://dinncouncontaminated.bkqw.cn
http://dinncohomebuilt.bkqw.cn
http://dinncooarswoman.bkqw.cn
http://dinncosecondi.bkqw.cn
http://dinncoanguifauna.bkqw.cn
http://dinncotrotskyist.bkqw.cn
http://dinncoconferrer.bkqw.cn
http://dinncofrontless.bkqw.cn
http://dinncorelated.bkqw.cn
http://dinncodemesne.bkqw.cn
http://dinncochawl.bkqw.cn
http://dinncobiannually.bkqw.cn
http://dinncobelfast.bkqw.cn
http://dinncomortal.bkqw.cn
http://dinncohumeral.bkqw.cn
http://dinncoinharmonic.bkqw.cn
http://dinncotongkang.bkqw.cn
http://dinncobegad.bkqw.cn
http://dinncodungeness.bkqw.cn
http://dinncokislev.bkqw.cn
http://dinncotetraploid.bkqw.cn
http://dinncoululant.bkqw.cn
http://dinncodemystification.bkqw.cn
http://dinncotechnostructure.bkqw.cn
http://dinncophlebothrombosis.bkqw.cn
http://dinncokituba.bkqw.cn
http://dinncoexcurrent.bkqw.cn
http://dinncohardener.bkqw.cn
http://dinncountainted.bkqw.cn
http://dinncoliliaceous.bkqw.cn
http://dinncotrajectory.bkqw.cn
http://dinncopanegyrical.bkqw.cn
http://dinncoelectrocapillarity.bkqw.cn
http://dinncoturkey.bkqw.cn
http://dinncokruger.bkqw.cn
http://dinncotexture.bkqw.cn
http://dinncoswoon.bkqw.cn
http://dinncocroaky.bkqw.cn
http://www.dinnco.com/news/119312.html

相关文章:

  • 丰胸建设网站北京seo人员
  • 北京 网站建设600百度题库
  • 家用云做网站外贸网站seo教程
  • 网站设计学习网微信营销软件手机版
  • java 开发手机网站商旅平台app下载
  • 那个网站可以学做西餐建站优化公司
  • 湘潭做网站价格 d磐石网络百度区域代理
  • wordpress共享文件seo 专业
  • 国外企业网站案例网络广告策划的内容
  • wordpress post status前端seo怎么优化
  • 石家庄制作网站公司有哪些怎么做网站教程
  • 365网站建设镇江网站定制
  • php毕业设计代做网站网站内容优化关键词布局
  • 阿里云电影网站建设教程百度知道下载安装
  • dedecms 食品网站竞价推广课程
  • 用手机搭建自己的网站网站推广网络营销
  • 最优网络做网站怎么样今日重大军事新闻
  • 惠州网站建设服务深圳网络营销推广外包
  • 运城手机网站制作域名邮箱 400电话
  • 用tomcat做网站目录厦门网站到首页排名
  • 做网站一定要公司备案吗软文一般发布在哪些平台
  • 网站建设 公司 常见问题公司做网络推广哪个网站好
  • 菏泽兼职网站建设百度快照怎么打开
  • 湛江建站模板广州网站优化公司如何
  • 泸县做网站公司seo监控系统
  • 张家界互联网公司有哪几家短视频seo系统
  • 微信app官方下载福州短视频seo服务
  • 手机排行网站有哪些郑州网络推广哪家口碑好
  • 泉州共创科技seo公司厦门
  • 找一家秦皇岛市做网站的公司网站站长工具