<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>
<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">
<p style="color: #777777;">
<a href="https://gitlab.com/Siguza">Siguza</a>
commented:
</p>
<div style="">
<p dir="auto">Running into the same issue. macOS 10.15.3, Xcode 11.4.1.<br>
It seems the Mono project ran into this as well not long ago: <a href="https://github.com/mono/mono/issues/19393" rel="nofollow noreferrer noopener" target="_blank">https://github.com/mono/mono/issues/19393</a></p>
<p dir="auto">The issue traces back to this declaration in <code>$SDK/usr/include/sys/_types/_fd_def.h</code>:</p>
<pre class="code highlight js-syntax-highlight c" lang="c" v-pre="true"><code><span id="LC1" class="line" lang="c"><span class="kt">int</span> <span class="nf">__darwin_check_fd_set_overflow</span><span class="p">(</span><span class="kt">int</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">)</span> <span class="n">__attribute__</span><span class="p">((</span><span class="n">__weak_import__</span><span class="p">));</span></span></code></pre>
<p dir="auto">And to provide some more context, from the same file:</p>
<pre class="code highlight js-syntax-highlight c" lang="c" v-pre="true"><code><span id="LC1" class="line" lang="c"><span class="n">__BEGIN_DECLS</span></span>
<span id="LC2" class="line" lang="c"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">fd_set</span> <span class="p">{</span></span>
<span id="LC3" class="line" lang="c"> <span class="n">__int32_t</span> <span class="n">fds_bits</span><span class="p">[</span><span class="n">__DARWIN_howmany</span><span class="p">(</span><span class="n">__DARWIN_FD_SETSIZE</span><span class="p">,</span> <span class="n">__DARWIN_NFDBITS</span><span class="p">)];</span></span>
<span id="LC4" class="line" lang="c"><span class="p">}</span> <span class="n">fd_set</span><span class="p">;</span></span>
<span id="LC5" class="line" lang="c"></span>
<span id="LC6" class="line" lang="c"><span class="kt">int</span> <span class="nf">__darwin_check_fd_set_overflow</span><span class="p">(</span><span class="kt">int</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">)</span> <span class="n">__attribute__</span><span class="p">((</span><span class="n">__weak_import__</span><span class="p">));</span></span>
<span id="LC7" class="line" lang="c"><span class="n">__END_DECLS</span></span>
<span id="LC8" class="line" lang="c"></span>
<span id="LC9" class="line" lang="c"><span class="n">__header_always_inline</span> <span class="kt">int</span></span>
<span id="LC10" class="line" lang="c"><span class="nf">__darwin_check_fd_set</span><span class="p">(</span><span class="kt">int</span> <span class="n">_a</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">_b</span><span class="p">)</span></span>
<span id="LC11" class="line" lang="c"><span class="p">{</span></span>
<span id="LC12" class="line" lang="c"> <span class="k">if</span> <span class="p">((</span><span class="kt">uintptr_t</span><span class="p">)</span><span class="o">&</span><span class="n">__darwin_check_fd_set_overflow</span> <span class="o">!=</span> <span class="p">(</span><span class="kt">uintptr_t</span><span class="p">)</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span></span>
<span id="LC13" class="line" lang="c"><span class="cp">#if defined(_DARWIN_UNLIMITED_SELECT) || defined(_DARWIN_C_SOURCE)</span></span>
<span id="LC14" class="line" lang="c"> <span class="k">return</span> <span class="n">__darwin_check_fd_set_overflow</span><span class="p">(</span><span class="n">_a</span><span class="p">,</span> <span class="n">_b</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span></span>
<span id="LC15" class="line" lang="c"><span class="cp">#else</span></span>
<span id="LC16" class="line" lang="c"> <span class="k">return</span> <span class="n">__darwin_check_fd_set_overflow</span><span class="p">(</span><span class="n">_a</span><span class="p">,</span> <span class="n">_b</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span></span>
<span id="LC17" class="line" lang="c"><span class="cp">#endif</span></span>
<span id="LC18" class="line" lang="c"> <span class="p">}</span> <span class="k">else</span> <span class="p">{</span></span>
<span id="LC19" class="line" lang="c"> <span class="k">return</span> <span class="mi">1</span><span class="p">;</span></span>
<span id="LC20" class="line" lang="c"> <span class="p">}</span></span>
<span id="LC21" class="line" lang="c"><span class="p">}</span></span>
<span id="LC22" class="line" lang="c"></span>
<span id="LC23" class="line" lang="c"><span class="cm">/* This inline avoids argument side-effect issues with FD_ISSET() */</span></span>
<span id="LC24" class="line" lang="c"><span class="n">__header_always_inline</span> <span class="kt">int</span></span>
<span id="LC25" class="line" lang="c"><span class="nf">__darwin_fd_isset</span><span class="p">(</span><span class="kt">int</span> <span class="n">_fd</span><span class="p">,</span> <span class="k">const</span> <span class="k">struct</span> <span class="n">fd_set</span> <span class="o">*</span><span class="n">_p</span><span class="p">)</span></span>
<span id="LC26" class="line" lang="c"><span class="p">{</span></span>
<span id="LC27" class="line" lang="c"> <span class="k">if</span> <span class="p">(</span><span class="n">__darwin_check_fd_set</span><span class="p">(</span><span class="n">_fd</span><span class="p">,</span> <span class="p">(</span><span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="p">)</span> <span class="n">_p</span><span class="p">))</span> <span class="p">{</span></span>
<span id="LC28" class="line" lang="c"> <span class="k">return</span> <span class="n">_p</span><span class="o">-></span><span class="n">fds_bits</span><span class="p">[(</span><span class="kt">unsigned</span> <span class="kt">long</span><span class="p">)</span><span class="n">_fd</span> <span class="o">/</span> <span class="n">__DARWIN_NFDBITS</span><span class="p">]</span> <span class="o">&</span> <span class="p">((</span><span class="n">__int32_t</span><span class="p">)(((</span><span class="kt">unsigned</span> <span class="kt">long</span><span class="p">)</span><span class="mi">1</span><span class="p">)</span> <span class="o"><<</span> <span class="p">((</span><span class="kt">unsigned</span> <span class="kt">long</span><span class="p">)</span><span class="n">_fd</span> <span class="o">%</span> <span class="n">__DARWIN_NFDBITS</span><span class="p">)));</span></span>
<span id="LC29" class="line" lang="c"> <span class="p">}</span></span>
<span id="LC30" class="line" lang="c"></span>
<span id="LC31" class="line" lang="c"> <span class="k">return</span> <span class="mi">0</span><span class="p">;</span></span>
<span id="LC32" class="line" lang="c"><span class="p">}</span></span>
<span id="LC33" class="line" lang="c"></span>
<span id="LC34" class="line" lang="c"><span class="n">__header_always_inline</span> <span class="kt">void</span></span>
<span id="LC35" class="line" lang="c"><span class="nf">__darwin_fd_set</span><span class="p">(</span><span class="kt">int</span> <span class="n">_fd</span><span class="p">,</span> <span class="k">struct</span> <span class="n">fd_set</span> <span class="o">*</span><span class="k">const</span> <span class="n">_p</span><span class="p">)</span></span>
<span id="LC36" class="line" lang="c"><span class="p">{</span></span>
<span id="LC37" class="line" lang="c"> <span class="k">if</span> <span class="p">(</span><span class="n">__darwin_check_fd_set</span><span class="p">(</span><span class="n">_fd</span><span class="p">,</span> <span class="p">(</span><span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="p">)</span> <span class="n">_p</span><span class="p">))</span> <span class="p">{</span></span>
<span id="LC38" class="line" lang="c"> <span class="p">(</span><span class="n">_p</span><span class="o">-></span><span class="n">fds_bits</span><span class="p">[(</span><span class="kt">unsigned</span> <span class="kt">long</span><span class="p">)</span><span class="n">_fd</span> <span class="o">/</span> <span class="n">__DARWIN_NFDBITS</span><span class="p">]</span> <span class="o">|=</span> <span class="p">((</span><span class="n">__int32_t</span><span class="p">)(((</span><span class="kt">unsigned</span> <span class="kt">long</span><span class="p">)</span><span class="mi">1</span><span class="p">)</span> <span class="o"><<</span> <span class="p">((</span><span class="kt">unsigned</span> <span class="kt">long</span><span class="p">)</span><span class="n">_fd</span> <span class="o">%</span> <span class="n">__DARWIN_NFDBITS</span><span class="p">))));</span></span>
<span id="LC39" class="line" lang="c"> <span class="p">}</span></span>
<span id="LC40" class="line" lang="c"><span class="p">}</span></span>
<span id="LC41" class="line" lang="c"></span>
<span id="LC42" class="line" lang="c"><span class="n">__header_always_inline</span> <span class="kt">void</span></span>
<span id="LC43" class="line" lang="c"><span class="nf">__darwin_fd_clr</span><span class="p">(</span><span class="kt">int</span> <span class="n">_fd</span><span class="p">,</span> <span class="k">struct</span> <span class="n">fd_set</span> <span class="o">*</span><span class="k">const</span> <span class="n">_p</span><span class="p">)</span></span>
<span id="LC44" class="line" lang="c"><span class="p">{</span></span>
<span id="LC45" class="line" lang="c"> <span class="k">if</span> <span class="p">(</span><span class="n">__darwin_check_fd_set</span><span class="p">(</span><span class="n">_fd</span><span class="p">,</span> <span class="p">(</span><span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="p">)</span> <span class="n">_p</span><span class="p">))</span> <span class="p">{</span></span>
<span id="LC46" class="line" lang="c"> <span class="p">(</span><span class="n">_p</span><span class="o">-></span><span class="n">fds_bits</span><span class="p">[(</span><span class="kt">unsigned</span> <span class="kt">long</span><span class="p">)</span><span class="n">_fd</span> <span class="o">/</span> <span class="n">__DARWIN_NFDBITS</span><span class="p">]</span> <span class="o">&=</span> <span class="o">~</span><span class="p">((</span><span class="n">__int32_t</span><span class="p">)(((</span><span class="kt">unsigned</span> <span class="kt">long</span><span class="p">)</span><span class="mi">1</span><span class="p">)</span> <span class="o"><<</span> <span class="p">((</span><span class="kt">unsigned</span> <span class="kt">long</span><span class="p">)</span><span class="n">_fd</span> <span class="o">%</span> <span class="n">__DARWIN_NFDBITS</span><span class="p">))));</span></span>
<span id="LC47" class="line" lang="c"> <span class="p">}</span></span>
<span id="LC48" class="line" lang="c"><span class="p">}</span></span>
<span id="LC49" class="line" lang="c"></span>
<span id="LC50" class="line" lang="c"></span>
<span id="LC51" class="line" lang="c"><span class="cp">#define __DARWIN_FD_SET(n, p) __darwin_fd_set((n), (p))</span></span>
<span id="LC52" class="line" lang="c"><span class="cp">#define __DARWIN_FD_CLR(n, p) __darwin_fd_clr((n), (p))</span></span>
<span id="LC53" class="line" lang="c"><span class="cp">#define __DARWIN_FD_ISSET(n, p) __darwin_fd_isset((n), (p))</span></span></code></pre>
<p dir="auto">And then from <code>$SDK/usr/include/sys/_types/_fd_set.h</code>:</p>
<pre class="code highlight js-syntax-highlight c" lang="c" v-pre="true"><code><span id="LC1" class="line" lang="c"><span class="cp">#define FD_SET(n, p) __DARWIN_FD_SET(n, p)</span></span></code></pre>
<p dir="auto">And if you grep through gnutls source, you'll find plenty of instances where <code>FD_SET</code> is used.</p>
<p dir="auto">There's a changelog entry dated to <code>Thu Jun 14 12:36:10 2018 +0300</code> that seems to have introduced this behaviour, but I'm assuming that doesn't matter, as it looks like it was a change on the Xcode/SDK side that broke this.</p>
</div>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #777;">
—
<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/issues/966#note_343664684">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/51428cb40ce1d896b44e5e3c11a7441e/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/-/issues/966#note_343664684"}}</script>
</p>
</div>
</body>
</html>