c - 如何找到包含 "cacheflush"函数的相应 .h 文件?

标签 c linux

我尝试在我的Linux X86计算机上使用cacheflush功能。 然而,虽然手册页指出可以在“.h”文件 中找到该函数,但我的 GCC 编译器找不到这些文件。

我能做什么?即,如何在我的程序中包含该函数以便 GCC 能够识别它?

最佳答案

我不确定,但是阅读man cacheflush,我认为你不能。

Note: On some architectures, there is no glibc wrapper for this system call; see NOTES.

Architecture-specific variants Glibc provides a wrapper for this system call, with the prototype shown in SYNOPSIS, for the following architectures: ARC, CSKY, MIPS, and NIOS2.

On some other architectures, Linux provides this system call, with different arguments:

M68K:

  int cacheflush(unsigned long addr, int scope, int cache,
                 unsigned long len);

SH:

  int cacheflush(unsigned long addr, unsigned long len, int op);

NDS32:

  int cacheflush(unsigned int start, unsigned int end, int cache);

On the above architectures, glibc does not provide a wrapper for this system call; call it using syscall(2).

如果我理解得好的话,glic 只为 4 种架构提供 cacheflush


如果你真的想调用这个函数,gcc专门提供了__builtin___clear_cache()(在手册页中查找它),但同样,这不会是可移植的到其他编译器。

关于c - 如何找到包含 "cacheflush"函数的相应 .h 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70009523/

相关文章:

linux - 如何在 Linux 中打印处理器的一个特定核心上列出的所有进程?

linux - 将服务器置于重负载以进行测试

c++ - 从 GetQueuedCompletionStatus 解除阻止

c - 如何根据操作数的顺序进行 C 赋值

C:什么时候考虑使用变量或值?

linux - 网络统计 : How to know if it's Human or Bot/Spider/DDOS

c - printk 格式中 %pa[p] 中 p 的含义

c - 在 C 中遍历堆栈

内存复制功能

linux - Ubuntu 上 Firefox 的 VRML 插件