Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emulate flock() on Solaris via fcntl(). #545

Closed
wants to merge 1 commit into from

Conversation

psumbera
Copy link

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