centos怎样查看系统中有多少个select的fd
如题,select最多能起1024个fd,我现在连续调用select,起的多了,就是报出:filedescriptor out of range in select(),so我想监控一下系统实时起了多少个fd,做出相应的动作,
那问题来了,我想知道查看select实时起的fd该用啥方法
pwd
/proc/23917/fd这目录吗,这个目录下都是:
ls -lt
total 0
lrwx------ 1 root root 64 Sep 23 10:24 255 -> /dev/pts/8
lrwx------ 1 root root 64 Sep 23 10:03 0 -> /dev/pts/8
lrwx------ 1 root root 64 Sep 23 10:03 1 -> /dev/pts/8
lrwx------ 1 root root 64 Sep 23 10:03 2 -> /dev/pts/8
lr-x------ 1 root root 64 Sep 23 10:03 3 -> /var/run/utmp
【 在 iwannabe 的大作中提到: 】
: /proc/<pid>/fd
pexpect的spawn有参数use_poll:
The use_poll attribute enables using select.poll() over select.select() for
socket handling. This is handy if your system could have > 1024 fds
https://pexpect.readthedocs.io/en/stable/api/pexpect.html#pexpect.spawn.__in
it__
【 在 nokia0125 (二过头) 的大作中提到: 】
: 因为用了pexpect远程的方式登陆主机,管理多个socket 链接用的select, 现在问题是pexpect 链接到了一定的数目就再也登不上,提示select out of range,