c - glibc 标准库中的 libc_hidden_​​proto 是做什么的?

标签 c glibc unistd.h

我试图查找 getpgrp() 的原型(prototype)unistd.h中的函数但找不到它。该文件中唯一包含 getpgrp 的行是 libc_hidden_proto (tcgetpgrp) 行。我假设这是一个宏,但我不知道它的作用。

我用谷歌搜索,但在网上找不到任何关于 libc_hidden_proto 的解释实际上确实如此。任何关于该宏在 glibc 中的用途的解释都将不胜感激。

最佳答案

您不小心查看了内部副本 ( include/unistd.h ) 而不是公共(public)副本 ( posix/unistd.h )。不,我也不明白 glibc 的源代码是如何组织的。

来自 include/libc-symbols.h :

   The following macros are used for PLT bypassing within libc.so
   (and if needed other libraries similarly).
   First of all, you need to have the function prototyped somewhere,
   say in foo/foo.h:
   int foo (int __bar);
   If calls to foo within libc.so should always go to foo defined in libc.so,
   then in include/foo.h you add:
   libc_hidden_proto (foo)

关于c - glibc 标准库中的 libc_hidden_​​proto 是做什么的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37290230/

相关文章:

c - 为什么使用 C 套接字程序发送和接收时文件大小不同?

c - 试图弄清楚如何通过 c 中的 lib curl 发送 json 数据

c - 我在哪里可以找到在 c 标准头文件(如 stdlib.h)中声明的函数的定义?

c++ - glibc 版本早于 gcc 版本和 -Wl,-rpath 不起作用

c - 如何根据文件unistd_64.h或unistd_32.h中的编号输出系统调用的名称?

c - 如何从c中的sock结构中获取ip地址?

c++ - 如何在 C/C++ 中关闭特定客户端的套接字?

c - glibc 检测到 free() : invalid next size (fast)

c - fsync 和 syncfs 有什么区别?

C:无法从文件打印