<div dir="ltr"><a href="https://developer.apple.com/library/content/releasenotes/General/CarbonCoreDeprecations/index.html#//apple_ref/doc/uid/TP40012224-CH1-SW16">https://developer.apple.com/library/content/releasenotes/General/CarbonCoreDeprecations/index.html#//apple_ref/doc/uid/TP40012224-CH1-SW16</a> explicitly suggests sysctl as replacement when targeting 10.8+, which strongly suggests that it'll work.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 16, 2016 at 4:37 PM, Erik Pilkington via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">erik.pilkington added a comment.<br>
<br>
I seem to remember that mapping from kernel versions to marketing versions was tossed around as a potential alternative to Gestalt. I think that the problem was Apple sometimes introduces (or reserves the right to introduce) new SDKs in a patch release (ie, Z in X.Y.Z), which wouldn't necessary imply a new kernel version, and would still need to be queried by @available. This makes it impossible to use kernel version in the general case (Or at least I think, it would be nice if someone internal to Apple could confirm this?). This rules out using `sysctl()` and the like.<br>
<br>
AFAIK this just leaves `Gestalt()` and Objective-C's `NSProcessInfo`, the latter would mean pulling in the Objective-C runtime, which would be unfortunate for C users (using the `__builtin_available` spelling). I don't think `Gestalt()` is in any danger of actually being removed, so we might as well use it. The only alternative I know of to those would be manually parsing the `SystemVersion.plist` XML file, but I think that might cause problems with sandboxed processes (right?). Any thoughts here would be much appreciated, `Gestalt()` is by no means a perfect solution.<br>
<br>
Compiler-rt does seem like a good place it put this, should I move the runtime code there instead?<br>
<br>
Thanks for taking a look!<br>
Erik<br>
<br>
<br>
<a href="https://reviews.llvm.org/D27827" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D27827</a><br>
<br>
<br>
<br>
</blockquote></div><br></div>