【发布时间】:2015-01-25 13:51:53
【问题描述】:
当我尝试通过命令行挂载目录'test_mount'时,操作成功:
mount -t nfs4 remote_server_ip:/ local_dir
但无法以编程方式挂载同一目录:
int ret_val = mount("remote_server_ip:/", "local_dir", "nfs4", MS_SYNCHRONOUS, "");
if (ret_val < 0) {
perror("Mount failed");
return 1;
}
此 C 函数失败并显示 Mount failed: Invalid argument。如何以编程方式挂载目标目录?我正在以超级用户权限运行可执行文件。
平台:
Linux ip-10-1-19-46 3.10.42-52.145.amzn1.x86_64 #1 SMP Tue Jun 10 23:46:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
【问题讨论】:
-
解决方案在此副本中:stackoverflow.com/questions/28350912/…
标签: c linux filesystems mount nfs