上の256の以上の記述子のためにEINVALを返します。興味深いのは、Xcodeでこのコードを実行すると正常に実行されますが、バイナリを自分で実行するとクラッシュすることになります。poll()はここではクラッシュのコード例があるのMacOS
10240
poll error: Invalid argument
poll(2)
によると::
出力は次のようであるあなたが見ることができるように
[EINVAL] The nfds argument is greater than OPEN_MAX or the
timeout argument is less than -1.
、POLL_SIZE
は制限より多くの小さく、タイムアウトは正確である-1、まだそれは墜落した。私は手動建物に使用
マイ打ち鳴らすバージョン:Unixシステム
Configured with: prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.41)
Target: x86_64-apple-darwin16.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
[マニュアルページ](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man2/poll.2.html)を読んでいますか? 'EINVAL'について何を言いますか? 'OPEN_MAX'の値は? –
も参照してください[getrlimit](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man2/getrlimit.2.html) –
実際には、 'poll'をあまりにも大きくないファイル記述子のセットであり、 'poll 'に渡された配列で何度も言及すると、*同じ*ファイル記述子(例えば0)は悪い味です。実際には問題ではなく、確かにシステム管理の問題です。しかし、[C10Kの問題について](https://en.wikipedia.org/wiki/C10k_problem) –