0

例如 unistd_64.h 中有一些宏

...

#define __NR_semget 64

#define __NR_semop 65

#define __NR_semctl 66

#define __NR_shmdt 67

#define __NR_msgget 68

#define __NR_msgsnd 69

...

当我输入一个数字

64

,它将输出

__NR_semget 或 semget

c/cpp源代码好多了,谢谢!

4

2 回答 2

0

一种方法是定义一个表示这些定义名称的字符串数组。不幸的是,没有捷径可走……

const char *name[] = {

    ...,

    /* this is now the 64th string... */
    "__NR_semget",
    "__NR_semop",

    ...
};

printf("name: %s\n", name[64]);
于 2014-07-24T02:58:22.367 回答
0

系统调用名称和号码映射很大程度上取决于您使用的架构。

ausyscall - 提供给定系统调用号的映射。也许您可以执行以下操作:

system("ausyscall 64 x86_64")

这应该返回semget

于 2014-07-24T06:05:11.740 回答