我尝试在我的Linux X86计算机上使用cacheflush功能。
然而,虽然手册页指出可以在“.h”文件
我能做什么?即,如何在我的程序中包含该函数以便 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/