What is the best(fastest) way to determine if a Samba mount point is dead on Linux? I need to do it in C. System calls like statfs(), statvfs() block for 30-40 sec when called on a stale mount, and they don't even return an error in this case. stat() seems to fail faster then others (about 10 sec) and returns an error. Mount point may go stale because the other host went down or Samba daemon there was killed. Any advice is appreciated..

确定Samba挂载点在Linux上是否已死的最佳(最快的)方法是什么?我需要在C. System调用(如statfs()、statvfs()块中进行30-40秒的调用,在这种情况下,它们甚至不会返回错误。stat()似乎比其他人(大约10秒)失败得更快,并返回一个错误。挂载点可能会失效,因为另一个主机宕机或那里的Samba守护进程被杀死。任何建议都是欣赏. .

3 个解决方案

#1


1

You could set an alarm (see alarm() and setitimer()) that times out after a few seconds.

您可以设置一个警报(参见警报()和setitimer()),在几秒钟之后超时。

更多相关文章

  1. 我如何理解这个编译器错误:“...的多重定义”
  2. 升级到linux-image-3.13.0-46后安装vmware-tools 9.9出现错误
  3. 铯:使用自己的OpenStreetMap服务器。:“未能获得图像块”错误
  4. OCaml编译错误:/ usr / bin / ld:找不到-lstr
  5. Linux 2.6.x 内核模块加载错误 “Invalid module format” 解决
  6. 在用apt源安装mysql-server时出现如下错误,需要安装mysql-server-
  7. 存储过程放在sql脚本里,命令行导入总是提示错误
  8. 解决缺少sql头文件编译错误
  9. “已有打开的与此命令相关联的 DataReader,必须首先将它关闭 ”错

随机推荐

  1. 解决CAS机制中ABA问题的AtomicStampedRef
  2. Java基础系列:线程同步和线程池
  3. ConcurrentHashMap.computeIfAbsent 死循
  4. java多线程(6)sleep和wait的4大区别
  5. SSL 证书选择指南
  6. 一文带你理解java中的同步工具类CountDow
  7. 你应该要理解的java并发关键字volatile
  8. android通过服务实现消息推送
  9. 一个同步工具类CyclicBarrier的详解(干货
  10. java中一个重要的原子类AtomicInteger详