在文件上使用mmap(Using mmap over a file)
我试图让两个不同的进程通过使用内存映射相同的文件进行通信。 不过,我在这方面遇到了一些问题。 我有一种感觉,这与我使用open()调用并将文件描述符传递给mmap的方式有关。
这是我的代码,你能看到它有什么问题吗?
对象1的代码:
16 FILE* temp = fopen(theSharedFileName, "w"); 17 fseek(temp, fileSize-1, SEEK_SET); 18 fprintf(temp, "0"); // make the file a certain size 19 fseek(temp, 0, SEEK_CUR); 20 21 int sharedFileName = fileno(temp); ... 31 sharedArea = (MyStruct*)mmap(0, fileSize, 32 PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED, sharedFileName, 0);
我使用“w”文件模式,因为对象1只能制作一次,我希望它重置以前存在的任何数据。
对象2的代码:
130 FILE* tempFile = fopen(sharedFileName, "a"); 131 int theFile = fileno(tempFile); ... 135 sharedArea = (MyStruct*)mmap(NULL, fileSize, 136 PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED, theFile, 0);
I'm trying to allow two different processes to communicate by using memory mapping the same file. However, I'm having some problems with this. I have a feeling this has to do with the way I'm using the open() call and passing my file descriptor to mmap.
Here is my code, can you see anything wrong with it?
Object 1's code:
16 FILE* temp = fopen(theSharedFileName, "w"); 17 fseek(temp, fileSize-1, SEEK_SET); 18 fprintf(temp, "0"); // make the file a certain size 19 fseek(temp, 0, SEEK_CUR); 20 21 int sharedFileName = fileno(temp); ... 31 sharedArea = (MyStruct*)mmap(0, fileSize, 32 PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED, sharedFileName, 0);
I use the "w" file mode since Object 1 will only ever be made once and I want it to reset any previously existing data.
Object 2's Code:
130 FILE* tempFile = fopen(sharedFileName, "a"); 131 int theFile = fileno(tempFile); ... 135 sharedArea = (MyStruct*)mmap(NULL, fileSize, 136 PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED, theFile, 0);
原文:https://stackoverflow.com/questions/742564
最满意答案
首先使用
setup.exe /a
压缩设置。 正确回答对话框,您需要设置提取位置。 检查此答案以获取有关提取setup.exe的更多详细信息: 从EXE中提取MSI完成提取后,找到并打开MSI文件,并检查属性表中的升级代码和产品代码 。 您需要Installshield , Orca或任何其他能够打开MSI文件的工具。
右键单击MSI文件本身并选择“属性”即可找到的包代码。
一些链接:
Ok, I was managed to get GUID for InstallShield's single file installer. Here are the steps:
Unpack it with
isunpack.exe
utility (source: http://www.compdigitec.com/labs/files/isxunpack.exe):Syntax:
C:\> isunpack.exe setup.exe
- It creates a
Disk1
folder with unpacked installer.Open
setup.ini
and readProductGUID
property:[Startup] AppName=MY_PRODUCT ProductGUID=ca96f3a1-f350-11d3-b354-002035c150e5 ...
相关问答
更多-
好的,我找到了答案: create-project composer create-project name/package public_html --stability="dev" 这将创建public_html目录并下载所有依赖项。 完善。 Ok I found the answer: create-project composer create-project name/package public_html --stability="dev" This will create the publ ...
-
看起来你已经有了运行时包。 应该有一个单独的设计时包,这就是你要安装的包。 Looks like you've got the runtime package. There should be a separate design-time package, and that's the one you want to install.
-
从另一个应用程序中自动安装/卸载应用程序(Automatically install/uninstall an application from within another application)[2024-04-08]
不。实际上,Android旨在防止您描述的场景。 将你的几个要点集中在一起: *应用程序安装时没有用户交互 *这些应用程序不是由设备用户选择的,而是由远程“管理员” *用户无法卸载上述应用程序 *用户无法安装任何其他应用程序 这和恶意软件没有技术上的区别。 但是,有一种替代方法称为Google Apps Device Policy for Android ,它允许管理员(从该页面): 要求您在设备上拥有PIN或密码。 在您的设备上需要一个复杂的密码。 在您的移动设备上需要屏幕锁定才能进行空闲超时。 擦掉丢失 ... -
可能存在不同的问题,但试试这个:转到gradle并更改applicationId ,另一个原因可能是应用程序中的权威冲突,请参考以下内容: 安装在控制台中显示错误:INSTALL FAILED CONFICTING PROVIDER Android中的INSTALL_FAILED_CONFLICTING_PROVIDER http://gradlewhy.ghost.io/overcoming-install-failed-conflicting-provider/ There may be differe ...
-
msiexec / I {ProductCode}不会启动卸载,它会启动维护安装事务(更改,修复,删除) 您可能需要msiexec /x {ProductCode} /qb msiexec /I {ProductCode} won't initiate an uninstall, it will initiate a maintenance installation transaction (change, repair, remove) You likely want msiexec /x {Produc ...
-
安装Web应用程序IIS(Installing Web application IIS)[2022-10-02]
该错误消息表示用于写入IIS配置的IIS7 COM对象未在计算机上正确注册。 不确定解决问题的最佳方法,但您可以尝试修复(或卸载/安装)IIS。 That error message means the IIS7 COM object for writing to the IIS configuration is not properly registered on the machine. Not sure the best way to fix the issue, but you might try ... -
您可以在应用程序中使用多个构建包 。 简述: 将requirements.txt文件(或Pipfile和Pipfile.lock )添加到包含Python依赖关系的根目录中 显式设置你的Ruby buildpack: heroku buildpacks:set heroku/ruby 在Ruby buildpack之前添加官方的Python buildpack(你的主buildpack应该是最后一个): heroku buildpacks:add --index 1 heroku/python 现在,重 ...
-
首先使用setup.exe /a压缩设置。 正确回答对话框,您需要设置提取位置。 检查此答案以获取有关提取setup.exe的更多详细信息: 从EXE中提取MSI 完成提取后,找到并打开MSI文件,并检查属性表中的升级代码和产品代码 。 您需要Installshield , Orca或任何其他能够打开MSI文件的工具。 右键单击MSI文件本身并选择“属性”即可找到的包代码。 一些链接: setup.exe pdf参考表 Setup.exe和Update.exe命令行参数 在不使用msiexec的情况下从命令 ...
-
安装2年的应用程序(Installing 2 year old application)[2022-06-26]
如果你有一个2岁项目的package.json文件(你应该),那么你应该找到每个依赖项的版本号。 Putting all my files in the package.json to the specified version an not just compatible with changed the error to Syntax error parsing, I was able to fix that with removing a translate application. -
尝试运行到Meego的应用程序时安装包失败(Installing package failed when trying to run to application to Meego)[2022-03-31]
你更新了你的Qt Creator吗? (2.3.1如果我没错的话)更新带来了更新的SDK for meego harmattan。 在这种情况下,你也应该更新你的meego手机,因为最新的图书馆有一些依赖。 (阅读错误, 依赖问题 ) 点击此处查看更新包 http://www.developer.nokia.com/search/search.xhtml?view=ebs&hv=fn:type%3DfnType:Terminal&s=ft&tl=0&ob=best&me=false&l=20&expandD ...