← Back to Pull requests

apple: restore sockaddr_ctl and some others on iOS #5698

Open
dtolnay opened this pull request with 14 lines diff across 1 files
View on GitHub
dtolnay dtolnay commented on Nov 05, 2026 19:25 UTC
Author

Fixes rust-lang/libc#5693 and https://github.com/nix-rust/nix/pull/2821#issuecomment-6611689211.

Without this, all versions of nix from the past 6 years are incompatible with libc 0.2.190+ on iOS.

Diff: 14 lines (+9 / -5) across 1 files Reviewer: madsmtm Review duration: 41503m
All Vouch review confidence checks passed
Residual risk 0.02 = Change Risk (0.19) × (1 − Review Confidence (0.91)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.19 · 14 lines diff across 1 files
0.19
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.89 · 5 substantive comment(s)
0.89
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
90%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.162
Real PR Conversation Timeline
16 items
dtolnay dtolnay commented on Nov 05, 2026 19:26 UTC
Author

@rustbot label stable-nominated

JohnTitor JohnTitor commented on Nov 08, 2026 01:59 UTC
Contributor

Failed on aarch64-apple-ios: https://github.com/rust-lang/libc/actions/runs/42093787137/job/127481055761?pr=5698
Maybe CI uses old toolchian.

threeseed threeseed commented on Nov 08, 2026 04:19 UTC
Contributor

@dtolnay .. Have you confirmed whether these APIs are not available on watchOS, tvOS, visionOS etc ?
Because almost certainly they are and this PR should be allowing all Apple platforms.

madsmtm madsmtm commented on code on Nov 11, 2026 07:39 UTC
Code Review
src/unix/bsd/apple/mod.rs:1
@@ -775,7 +775,7 @@ s2! {
         pub sin_other: c_ushort,

Failed on aarch64-apple-ios: https://github.com/rust-lang/libc/actions/runs/42093787137/job/127481055761?pr=5698 Maybe CI uses old toolchian.

The APIs need to be skipped / special-cased in libc-test/build/main.rs IIRC.

madsmtm madsmtm commented on code on Nov 11, 2026 07:40 UTC
Code Review
src/unix/bsd/apple/mod.rs:1
@@ -775,7 +775,7 @@ s2! {
         pub sin_other: c_ushort,
     }
 
-    #[cfg(target_os = "macos")]
+    #[cfg(any(target_os = "macos", target_os = "ios"))]

Let's instead do:

    #[cfg_attr(not(target_os = "macos"), deprecated = "unavailable on iOS/tvOS/watchOS/visionOS")]

madsmtm madsmtm commented on Nov 11, 2026 07:42 UTC
Reviewer

I agree that we should do this, it's bad that we broke nix, though only for v0.2 (can you point your PR at that branch maybe?)

View changes since this review

xtqqczze xtqqczze commented on Nov 13, 2026 02:39 UTC
Contributor

Without this, all versions of nix from the past 6 years are incompatible with libc 0.2.190+ on iOS.

I fixed this in nix a few months ago (https://github.com/nix-rust/nix/pull/2821), we just need a new nix release.

cc: @SteveLauC @asomers

asomers asomers commented on Nov 14, 2026 19:29 UTC
Contributor

> Without this, all versions of nix from the past 6 years are incompatible with libc 0.2.190+ on iOS.

> I fixed this in nix a few months ago (nix-rust/nix#2821), we just need a new nix release.

> cc: @SteveLauC @asomers

Just released 0.32.0 . I'm going to do a 0.31.4 later today, too.

tgross35 tgross35 commented on Nov 16, 2026 10:55 UTC
Contributor

I agree that we should do this, it's bad that we broke nix, though only for v0.2 (can you point your PR at that branch maybe?)

Do these actually exist? Based on the CI failures it seem like they may not, at least on sim.

madsmtm madsmtm commented on Nov 16, 2026 20:00 UTC
Contributor

Do these actually exist? Based on the CI failures it seem like they may not, at least on sim.

They don't exist in the headers (which is why I removed them originally), but they are understood by the kernel (which is why I think it's fine to re-add them as deprecated in v0.2).

threeseed threeseed commented on Nov 16, 2026 21:11 UTC
Contributor

As per the discussion this should just be closed.

All of Apple's products share the same core kernel. I know because I worked at Apple and have seen the code.

So either (a) make all APIs deprecated/hidden on non macOS platforms or (b) just follow what the public API says. But don't re-enable individual APIs piece by piece.

tgross35 tgross35 commented on Nov 17, 2026 03:15 UTC
Contributor

None of these decisions have a clear "should", my answer at https://github.com/rust-lang/libc/issues/5726 was moreso regarding future changes than what to do about the unintentional breakage. Since this specific case showed up in the wild I still think it is fine to land if Mads (target maintainer) is on board, which he is. I wouldn't feel the same about adding back any API that we haven't gotten an issue for in the ~2 months since that release.

Honestly I think Apple could probably improve the status quo, i.e. make the API public but label it as possible app store rejection. But that's something for upstream to deal with, C users hit the same annoyances.

tgross35 tgross35 requested changes on Nov 17, 2026 03:16 UTC
Changes Requested Reviewer

As Mads mentioned, this needs a test skip update and should probably be deprecated

View changes since this review

tgross35 tgross35 commented on Nov 17, 2026 03:19 UTC
Contributor

though only for v0.2 (can you point your PR at that branch maybe?)

I don't mind having this (and pretty much any deprecation) on main, that means future patches are more likely to apply cleanly to both branches. It will be easy to clean up everything marked #[deprecated] if we get to a cutoff point for 1.0.

threeseed threeseed commented on Nov 17, 2026 04:44 UTC
Contributor

Apple could probably improve the status quo

Nothing has changed in 26 years.

You guys randomly woke up one morning, decided to ignore your own policies and throw semvar out the window, remove a ton of APIs and just break everything. And now instead of making it clear for developers you're just going to add them back in one by one. What ?

Anyway good luck with all of this. I'll just stick with my fork.

Reviewers
Assignees
dtolnay dtolnay
Labels
risk: low confidence: 90.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 19.2% (LOW) · Higher = larger blast radius
19.2%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 90.8% · Lower = rushed or shallow review
90.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 2% · Safe to merge
2%
Repository