<!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 class="details" style="font-style: italic; color: #777;">
<a href="https://gitlab.com/robUx4">Steve Lhomme</a> created a merge request:
</p>
<p>
</p>
<div class="branch">
Project:Branches: robUx4/gnutls:macos-connectx to gnutls/gnutls:master
</div>
<div class="author">
Author: Steve Lhomme
</div>
<div class="assignee">
Assignees: 
</div>
<div class="approvers">

</div>

<div>
<p dir="auto">connectx is only available since macOS 10.11. So when compiling with a lower minimum SDK the compiler issues this error:</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">system/fastopen.c:134:9: error: 'connectx' is only available on macOS 10.11 or newer [-Werror,-Wunguarded-availability]</span>
<span id="LC2" class="line" lang="plaintext">                ret = connectx(fd, &endpoints, SAE_ASSOCID_ANY, CONNECT_RESUME_ON_READ_WRITE | CONNECT_DATA_IDEMPOTENT, NULL, 0, NULL, NULL);</span>
<span id="LC3" class="line" lang="plaintext">                      ^~~~~~~~</span>
<span id="LC4" class="line" lang="plaintext">/Applications/Xcode9.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/socket.h:713:5: note: 'connectx' has been marked as being introduced in macOS 10.11 here, but the deployment target is macOS 10.7.0</span></code></pre>
<p dir="auto">With macOS compilers it's possible to detect at runtime whether an API call is present or not using <code>__builtin_available()</code>. So we check at runtime for connectx and use it only when available. So the same code compiled running on 10.10 will not use it and fallback to the regular <code>connect()</code> call. The code running on 10.11+ will use <code>connectx</code> as expected.</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/-/merge_requests/1294">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/eacfe94234f76446c38fae40b322885b/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 Merge request","url":"https://gitlab.com/gnutls/gnutls/-/merge_requests/1294"}}</script>


</p>
</div>
</body>
</html>