有没有办法更改符号链接/proc/self/exe 的目标?
大家好: 最近我正在 Linux 进程上进行检查点并遇到了一个问题,看起来当我将可执行文件的内存映射到当前进程时,符号链接 /proc/self/exe 已死。我想要的是使这个符号链接指向另一个可执行文件(我恢复的进程的那个),这可能吗?我尝试删除它并重新创建,但权限被拒绝。英语不是我的母语,我希望我已经表达了我的观点,谢谢
hi all:
recently i'm working on make checkpoint on linux process and encountered a problem,it looks like that when i munmap memory map of the executable to current process,the symlink /proc/self/exe is dead.what i want is to make this symlink pointing to a other executable(the one for my resumed processs),is that possible?i tried delete it and recreate, permission denied. english is not my native language, i hope i've made my point,thanx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
prctl(PR_SET_MM_EXE_FILE, ...)
使用指向 arg3 参数中提供的文件描述符标识的新可执行文件的新符号链接取代 /proc/pid/exe 符号链接。文件描述符应该通过常规的 open(2) 调用来获取。
prctl(PR_SET_MM_EXE_FILE, ...)
Supersede the /proc/pid/exe symbolic link with a new one pointing to a new executable file identified by the file descriptor provided in arg3 argument. The file descriptor should be obtained with a regular open(2) call.
不可以。
/proc
完全由内核管理,不允许进行这样的更改。但是您也许可以启动一个新进程(也许使用
fork()
)并将内存快照映射到该进程中。No.
/proc
is completely managed by the kernel and does not allow changes like that.But you may be able to start a new process (with
fork()
perhaps) and map your memory snapshot into that.