Skip to content

Conversation

@psumbera
Copy link
Contributor

This should resolve problem with Rust build:
rust-lang/rust#103630

This should resolve problem with Rust build:
rust-lang/rust#103630
@sunfishcode
Copy link
Member

Unfortunately, fcntl-style locks have different semantics than flock-style locks. fcntl-style locks have the old process-associated behavior, which means that they don't work if multiple threads use a lock to synchronize access between themselves. Rustix aims to be transparent with respect to significant system call semantics, so it shouldn't silently provide fcntl locking semantics to users expecting flock semantics.

Is the fd-lock crate the best place to implement this emulation? It might be. I wonder if it would make sense on Solaris to have fd-lock keep a static set of which files it has locked, so that a thread could check whether any other thread has a particular file locked before trying to acquire an fcntl-style lock. In any case, I think the fd-lock repo is the best place to discuss it.

@sunfishcode
Copy link
Member

Unfortunately I think this isn't the right approach for rustix; please file an issue in the fd-lock repo to discuss options there.

@sunfishcode sunfishcode closed this Mar 2, 2023
@sunfishcode
Copy link
Member

I submitted a PR adding an fcntl_lock function to rustix in #555, which an fd-lock PR could be built on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants