sk_err_soft和 sk_err有什么区别?

下面是注释,这两个域是struct sock中的。
  1. *        @sk_err: last error
  2.   *        @sk_err_soft: errors that don't cause failure but are the cause of a
  3.   *                      persistent failure not just 'timed out'
复制代码
这里注释没太看懂, 不知道这两个错误有什么区别?为什么需要sk_err_soft?

我看了内核的代码基本上是在tcp_v4_err中调用的,而这个是被ICMP模块使用的。

接下来是延伸出来的一个问题。

主要是非阻塞的句柄,我们connect的问题,下面是man手册里面的:


QUOTE:
EINPROGRESS
              The socket is nonblocking and the connection cannot be completed immediately.  It is possible to select(2) or  poll(2)  for  completion  by
              selecting the socket for writing.  After select(2) indicates writability, use getsockopt(2) to read the SO_ERROR option at level SOL_SOCKET
              to determine whether connect() completed successfully (SO_ERROR is zero) or unsuccessfully (SO_ERROR is one of the usual error codes listed
              here, explaining the reason for the failure).



可以看到要使用getsockopt进行检测,在内核中getsockopt就会检测sk_err以及sk_err_soft,而这里来说肯定是检测到sk_err_soft了,因为如果有sk_err则一定会上报一个err事件的,我这里就有问题了,就是为什么不在tcp_poll(它只会检测sk_err) 里面设置错误标记位?还有就是什么时候会出现返回可写(没有出错事件),而getsockopt又能检测到错误的。我自己模拟,可是怎么都无法模拟到这种情况,不知道谁知道如何来模拟这种情况。

谢谢!

作者: simohayha_cu   发布时间: 2011-02-15

好问题。没有相关研究,帮顶。

这个是合适的提问地方吗?
如果不合适,还有其他地方吗?
算合适,难道是没有牛人?

作者: asweisun_shan   发布时间: 2011-02-18