Skip to content

[PATCH] bootstrap: use fcntl locking on Solaris - #161357

Open
psumbera wants to merge 1 commit into
rust-lang:mainfrom
psumbera:solaris-bootstrap
Open

[PATCH] bootstrap: use fcntl locking on Solaris#161357
psumbera wants to merge 1 commit into
rust-lang:mainfrom
psumbera:solaris-bootstrap

Conversation

@psumbera

Copy link
Copy Markdown
Contributor

Solaris does not provide flock, so std::fs::File deliberately does not support its locking API there. Its earlier fcntl emulation was removed because fcntl locks are process-scoped rather than handle-scoped.

The bootstrap build lock only coordinates separate bootstrap processes and is held for the lifetime of the process, making fcntl locking suitable for this narrower use. Add a Solaris-specific backend while retaining std file locking on other platforms.

Note: LLM was used to generate it.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Aug 19, 2026
@rustbot

rustbot commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

r? @clubby789

rustbot has assigned @clubby789.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789, jieyouxu

@bjorn3

bjorn3 commented Aug 19, 2026

Copy link
Copy Markdown
Member

How hard would it be to add flock support to solaris? And how long would that take before we could depend on that support from the rust side?

Edit: Forgot Solaris is no longer open source.

@psumbera

Copy link
Copy Markdown
Contributor Author

How hard would it be to add flock support to solaris? And how long would that take before we could depend on that support from the rust side?

Edit: Forgot Solaris is no longer open source.

It would be pretty hard. Plus we would then need to wait for new Solaris 11.4 CBE release. Also Rust is expected to run/build on older Solaris 11.4 releases too...

@bjorn3

bjorn3 commented Aug 19, 2026

Copy link
Copy Markdown
Member

While it would be a while before rust can depend on it, adding flock support to Solaris now would fix other programs that use File::lock. And the fact that fcntl is process-scoped means I will likely have to complicate #159287 a fair bit by adding a second layer of locking to ensure multiple rustc sessions in the same process don't think they all have exclusive access to the same incr comp dir. The sooner Solaris (and whichever other Unix OSes supported by rustc are missing it) adds flock support, the sooner people can stop using unsafe fcntl based locking.

But if it is hard to implement, I can understand it not getting implemented any time soon.

@rust-log-analyzer

This comment has been minimized.

Solaris does not provide flock, so std::fs::File deliberately does not
support its locking API there. Its earlier fcntl emulation was removed
because fcntl locks are process-scoped rather than handle-scoped.

The bootstrap build lock only coordinates separate bootstrap processes and
is held for the lifetime of the process, making fcntl locking suitable for
this narrower use. Add a Solaris-specific backend while retaining std file
locking on other platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants