如果套接字 fd 大于 1024,chilkat lib 中的系统调用 'select' 可能导致崩溃
Potential crash caused by the syscall 'select' in chilkat lib, in case of socket fd larger than 1024
我们在 linux x64 上使用 chilkat 库从 internet.noticed 获取一些 Web 资源,chilkat 库函数调用 'select' 来监视套接字事件,从 gdb 到我的程序, 下面的函数称为 'select':
ChilkatSocket::waitWriteableMsHB(unsigned
int, bool, bool, SocketParams&,
LogBase&) ()
ChilkatSocket::waitReadableMsHB(unsigned
int, SocketParams&, LogBase&) ()
所以当socket fd大于FD_SETSIZE(1024 on linux)时会导致FD_SET溢出,导致程序崩溃?是否有必要改用现代系统调用 'poll' 或 'epoll'?
谢谢
当 fd 集小于 FD_SETSIZE 时,Chilkat 可能会使用 select 系统调用。如果 fd 集为 1024 或更大,它将始终使用轮询。不用担心 FD_SET 溢出,因为 Chilkat 会在所有重要的情况下选择使用 "poll"。
我们在 linux x64 上使用 chilkat 库从 internet.noticed 获取一些 Web 资源,chilkat 库函数调用 'select' 来监视套接字事件,从 gdb 到我的程序, 下面的函数称为 'select':
ChilkatSocket::waitWriteableMsHB(unsigned int, bool, bool, SocketParams&, LogBase&) () ChilkatSocket::waitReadableMsHB(unsigned int, SocketParams&, LogBase&) ()
所以当socket fd大于FD_SETSIZE(1024 on linux)时会导致FD_SET溢出,导致程序崩溃?是否有必要改用现代系统调用 'poll' 或 'epoll'?
谢谢
当 fd 集小于 FD_SETSIZE 时,Chilkat 可能会使用 select 系统调用。如果 fd 集为 1024 或更大,它将始终使用轮询。不用担心 FD_SET 溢出,因为 Chilkat 会在所有重要的情况下选择使用 "poll"。