寻找mmap标志值 [英] Looking for mmap flag values

查看:77
本文介绍了寻找mmap标志值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在os x上哪里可以找到mmap标志值. mmap的手册页说使用MAP_PRIVATE,MAP _...等,但是如果要处理汇编,则必须知道进行syscall的实际值.我尝试查找定义这些常量的头文件,但找不到.有人可以链接吗?

I was wondering where I could find mmap flag values on os x. The manpages for mmap say to use MAP_PRIVATE, MAP_... and such, but if you are dealing with assembly you have to know the actual values to make the syscall. I tried looking for the header files that defined these constants but I could not find it. Could someone link it possibly?

推荐答案

在gcc中使用-E选项可让您在预处理器之后查看源文件的输出.在以下源文件上使用gcc -E test.c

Using the -E option with gcc allows you to see the output of a source file after the preprocessor. Using gcc -E test.c on the following source file

#include <sys/mman.h>

int main() {
        return MAP_PRIVATE;
}

输出

...
# 2 "asdf.c" 2

int main() {

 return 0x02;
}

这表明MAP_PRIVATE等于我的系统上的0x02.但是,并非在所有系统上都如此.

which shows that MAP_PRIVATE is equal to 0x02 on my system. This may not be true on all systems, however.

这篇关于寻找mmap标志值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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