Linux 轮询系统调用超时
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13018981/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
poll system call timeout
提问by mahmood
Attaching strace
shows a lot of these messages:
附件strace
显示了很多这样的消息:
poll([{fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}], 6, 0) = 0 (Timeout)
poll([{fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}], 6, 0) = 0 (Timeout)
poll([{fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}], 6, 0) = 0 (Timeout)
poll([{fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}], 6, 0) = 0 (Timeout)
How can I find what file the program is trying to access that causes poll
system call to timeout?
如何找到程序试图访问导致poll
系统调用超时的文件?
strace
generates a lot of messages which make it hard to debug
strace
生成大量消息,使调试变得困难
回答by Maxim Egorushkin
How can I find what file the program is trying to access that causes poll system call to timeout?
如何找到程序试图访问导致轮询系统调用超时的文件?
Invoke:
调用:
lsof -p <pid>
And see what the file descriptors in question refer to.
并查看有问题的文件描述符指的是什么。
You can also take a look into proc
filesystem on Linux:
您还可以查看proc
Linux 上的文件系统:
ls -l /proc/<pid>/fd
回答by Kamel Haddad
ls -l /proc//fd/ -> You will get the corresponding node Id. ss -p | grep -> you will get the socket file path the fd belongs to.
ls -l /proc//fd/ -> 你会得到对应的节点Id。ss -p | grep -> 您将获得 fd 所属的套接字文件路径。