Repository navigation
Support file locking on Solaris - #5167
Open
ChrisDenton wants to merge 1 commit into
Open
ChrisDenton wants to merge 1 commit into
ChrisDenton wants to merge 1 commit into
Conversation
ChrisDenton
force-pushed
the
flock-sloaris
branch
4 times, most recently
from
October 25, 2026 16:37
ea63892 to
b54a614
Compare
djc
reviewed
Oct 26, 2026
Contributor
|
(Also, why is this related to #5151 ?) |
Member
Author
Oh I originally had a thing to ignore unimplemented errors so it doesn't crash (but you get the old concurrency issues). Then I thought that might be going too far. |
rami3l
approved these changes
Oct 27, 2026
djc
reviewed
Oct 27, 2026
| fn fcntl_lock_raw(file: &File, lock_type: libc::c_short, cmd: libc::c_int) -> io::Result<()> { | ||
| let mut lock = flock_for_whole_file(lock_type); | ||
| loop { | ||
| let result = unsafe { libc::fcntl(file.as_raw_fd(), cmd, &mut lock) }; |
Contributor
There was a problem hiding this comment.
Should we have some safety comments for the unsafe blocks at least?
(We should probably enable the clippy lint for this.)
Member
Author
There was a problem hiding this comment.
I've added safety comments. I also added an FcntlCmd enum to help contain the fcntl unsafety to one place since the function takes a variable number and type of arguments based on the command.
ChrisDenton
force-pushed
the
flock-sloaris
branch
from
October 27, 2026 19:17
b54a614 to
5991f78
Compare
djc
approved these changes
Oct 28, 2026
djc
reviewed
Oct 28, 2026
ChrisDenton
force-pushed
the
flock-sloaris
branch
from
October 29, 2026 06:26
5991f78 to
e9dc02a
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #5164
This is mostly a copy/paste from Cargo's implementation. I also added a clippy restriction lint to prevent us accidentally using
File::lockdirectly.