Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Filesystems 在C/C+中确定运行时的文件系统+;_Filesystems_Nfs_Lustre - Fatal编程技术网

Filesystems 在C/C+中确定运行时的文件系统+;

Filesystems 在C/C+中确定运行时的文件系统+;,filesystems,nfs,lustre,Filesystems,Nfs,Lustre,如何在运行时从C/C++代码中确定代码正在读取或写入的文件是否装载在Lustre、GPFS或NFS之上的路径上 编辑:工作代码: #include <sys/vfs.h> #include <iostream> int main(int argc, char** argv) { struct statfs sf; statfs(argv[0], &sf); std::cout << "f_type =" << std::h

如何在运行时从C/C++代码中确定代码正在读取或写入的文件是否装载在Lustre、GPFS或NFS之上的路径上

编辑:工作代码:

#include <sys/vfs.h>
#include <iostream>

int main(int argc, char** argv) {
  struct statfs sf;
  statfs(argv[0], &sf);

  std::cout << "f_type =" <<  std::hex << sf.f_type << "\n";
}
#包括
#包括
int main(int argc,字符**argv){
结构statfs sf;
statfs(argv[0],&sf);

std::cout您可以使用
statfs()
系统调用并查看
f_type
字段。对于Lustre,
LL_SUPER_-MAGIC
是0x0BD00BD0(基于对象的磁盘)。
NFS_SUPER_-MAGIC
statfs(2)
手册页中以0x6969的形式列出,对其含义没有任何评论。:-)