Linux是否相当于VirtualProtectEx? [英] Linux equivalent for VirtualProtectEx?

查看:76
本文介绍了Linux是否相当于VirtualProtectEx?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一些简单的JITing,并使用 VirtualProtectEx 在Windows下将页面标记为可执行文件. 与Linux,最好还有其他类似POSIX/Unix的操作系统下的操作系统等效吗?

I am doing some simple JITing, and use VirtualProtectEx under Windows to mark pages as executable. What would be the equivalent of that under Linux, and preferably, other POSIX/Unix-like OSes too?

推荐答案

您正在寻找 mprotect ,也可能是 mmap .请注意,与Windows不同,进程A无法更改进程B的内存映射(缺少

You are looking for mprotect and probably also mmap. Note that, unlike with Windows, there is no way for process A to change process B's memory map (short of horrible tricks with ptrace).

这篇关于Linux是否相当于VirtualProtectEx?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆