简体   繁体   English

为什么不能在AIX中使用宏“ PVPROCPTR”?

[英]Why can't the macro “PVPROCPTR”be used in AIX?

The macro PVPROCPTR(pid) can convert PID to Process pointer. 宏PVPROCPTR(pid)可以将PID转换为过程指针。

so I use it. 所以我用 But there is a error when I make it. 但是当我做错了。

1>ld : 0711-317 error : Undefined symbol: pvproc
1>  ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

And the definition of this macro in AIX header file is as follow: 并且该宏在AIX头文件中的定义如下:

extern struct pvproc pvproc[NPROC];     /* the process table, itself      */

/* convert pid to proc pointer  */
#define PVPROCPTR(pid)  (&pvproc[PROCMASK(pid)])

So I want to know why can't it be used? 所以我想知道为什么不能使用它?

The question is "why". 问题是“为什么”。 So: 所以:

pvproc is an internal kernel structure. pvproc是内部内核结构。 If you are making a kernel extension, then what you have might be able to work. 如果您要进行内核扩展,那么您所拥有的可能会起作用。 I don't see it exported from any of the *exp files in /usr/lib so it is appears that it is not intended to work from anywhere but from within the kernel itself. 我看不到它是从/ usr / lib中的任何* exp文件导出的,因此看来它不是要在任何地方工作,而是要在内核内部工作。

I would expect AIX would provide a kernel service to do what you want rather than a macro. 我希望AIX将提供内核服务来执行您想要的操作,而不是宏。 A kernel service has more stability across different versions of AIX (but it can still change -- just not as often). 内核服务在不同版本的AIX上具有更高的稳定性(但仍可以更改-只是不那么频繁)。

Lets step back for a second and ask a bigger question: why do you want the pvproc structure? 让我们退后一步,问一个更大的问题:为什么要使用pvproc结构? (Well... first, answer: is this a kernel extension?) (嗯...首先,答案:这是内核扩展吗?)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM