The socket() function shall fail if: EAFNOSUPPORT The implementation does not support the specified address family. EMFILE All file descriptors available to the process are currently open. ENFILE No more file descriptors are available for the system. EPROTONOSUPPORT The protocol is not supported by the address family, or the protocol is not supported by the implementation. EPROTOTYPE The socket type is not supported by the protocol. The socket() function may fail if: EACCES The process does not have appropriate privileges. ENOBUFS Insufficient resources were available in the system to perform the operation. ENOMEM Insufficient memory was available to fulfill the request.
(男士3插座)
我最近遇到socket()
返回非负fd的情况,而所有操作(accept()
,connect()
等)都会失败。 valgrind --track-fds=yes -v
找到了此错误。
这是否意味着即使socket()
返回非负fd
,fd
仍可能无效?