实现页面卷曲功能(Implementing page curl feature)
我正在创建一个类似于iphone地图应用程序的地图应用程序。 我需要具有页面卷曲功能,与地图应用程序中的相同。 在这种情况下需要帮助。
I am creating a map application similar to the iphone map app. I need to have the page curl feature, same as that in the map app. Need help in this case.
原文:https://stackoverflow.com/questions/8443280
满意答案
在Linux上,该进程使用内存映射将可执行文件的文本部分和共享库直接映射到正在运行的进程内存。 所以如果你可以覆盖可执行文件,它会影响正在运行的进程。 但是,禁止写入映射为执行的文件 - 您会收到“文本文件忙”错误。
但是,您仍然可以重新编译该程序。 如果编译器(实际上是链接器)出现此错误,它将删除旧的可执行文件并创建一个新文件。 在Unix上,如果删除正在使用的文件,则文件内容实际上并未从磁盘中删除,只删除目录条目中的引用; 在所有对它的引用(目录项,文件描述符和内存映射)消失之前,该文件并未完全删除。 因此,正在运行的进程将继续映射到旧的无名文件。 您可以通过以下演示来看到这一点:
barmar@dev:~$ ls -li testsleep 229774 -rwxr-xr-x 1 barmar adm 4584 Apr 24 04:30 testsleep barmar@dev:~$ ./testsleep & [1] 17538 barmar@dev:~$ touch testsleep.c barmar@dev:~$ make testsleep cc testsleep.c -o testsleep barmar@dev:~$ ls -li testsleep 229779 -rwxr-xr-x 1 barmar adm 4584 Apr 24 04:32 testsleep
当我在程序运行时重新编译程序时,inode号从
229774
改为229779
,表示创建了一个新文件。On Linux, the process uses memory mapping to map the text section of the executable file and shared libraries directly into the running process memory. So if you could overwrite the executable file, it would affect the running process. However, writing into a file that's mapped for execution is prohibited -- you get a "Text file busy" error.
However, you can still recompile the program. If the compiler (actually the linker) gets this error, it removes the old executable file and creates a new one. On Unix, if you remove a file that's in use, the file contents are not actually removed from the disk, only the reference from the directory entry is removed; the file isn't fully deleted until all references to it (directory entries, file descriptors and memory mappings) go away. So the running process continues to be mapped to the old, nameless file. You can see this with the following demonstration:
barmar@dev:~$ ls -li testsleep 229774 -rwxr-xr-x 1 barmar adm 4584 Apr 24 04:30 testsleep barmar@dev:~$ ./testsleep & [1] 17538 barmar@dev:~$ touch testsleep.c barmar@dev:~$ make testsleep cc testsleep.c -o testsleep barmar@dev:~$ ls -li testsleep 229779 -rwxr-xr-x 1 barmar adm 4584 Apr 24 04:32 testsleep
The inode number changed from
229774
to229779
when I recompiled the program while it was running, indicating that a new file was created.
相关问答
更多Spring批处理:有条件地执行步骤(Spring batch: conditional execution of steps)
AWS Elastic MapReduce中的Python程序在步骤执行中失败(Python program in AWS Elastic MapReduce fails in step execution)
是否可以计算代码执行步骤?(Is it possible to count code execution steps?)
如何防止在InstallShield中记录自定义操作的执行步骤?(How to prevent to log execution steps of Custom Action in InstallShield?)
程序执行步骤(Program execution steps)
Spring批处理:在java配置文件中执行并行步骤(Spring Batch : parallel steps execution in java configuration file)
javascript和执行步骤中的范围(scope in javascript and execution steps)
如何使有状态的JBehave步骤对于多线程执行是安全的(How to make stateful JBehave steps safe for multithreaded execution)
如何跳过具体的执行计划步骤?(How to skip specific Execution Plan Steps?)
案例陈述执行步骤(Case statement execution steps)
相关文章
更多linux命令 Curl
Feature分支-git入门教程
PHP中CURL技术模拟登陆抓取网站信息,用与微信公众平台成绩查询
page-taglib分页问题
asp.net 模拟CURL调用微信公共平台API 上传下载多媒体文
shell通过curl发送get请求,做一些很烦琐的事
Scaling Pinterest - From 0 To 10s Of Billions Of Page Views A Month In Two Years
sharepoint 2010 页面添加footer方法 custom footer for sharepoint 2010 master page
ArcGIS Basics[转载]
Stack Overflow Architecture Update - Now At 95 Million Page Views A Month
最新问答
更多如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
linux的常用命令干什么用的
由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
如何交换返回集中的行?(How to swap rows in a return set?)
在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
Java中的不可变类(Immutable class in Java)
WordPress发布查询(WordPress post query)
如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!