aboutsummaryrefslogtreecommitdiff
path: root/crates/fslock-guard/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* add_warning: add reference to arti#2556Jim Newsome2026-07-151-1/+1
|
* Removed unnecessary lintpryty262026-07-151-1/+1
| | | | Removed unnecessary lint
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+2
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* fslock-guard: Provide specialized android impls.Nick Mathewson2026-05-281-0/+61
| | | | | | | | | | | | | We need these because `File::lock()` and `File::try_lock()` claim not to work on Android, and have to be emulated with flock. For more information, see <https://github.com/rust-lang/rust/issues/148325>. Closes #2544. Based on code by @syphyr. Co-Authored-By: syphyr <[email protected]>
* fslock-guard: Extract calls to {try_,}lockNick Mathewson2026-05-281-2/+18
| | | | We're about to provide android-only versions of these.
* fslock-guard: Use windows-sys and GetFileInformationByHandleEx.Nick Mathewson2026-05-121-21/+44
| | | | | | | | | | | | Unlike winapi, windows-sys is maintained (by microsoft), and supports more APIs. We use it elsewhere in our tree, but this was our largest usae of winapi. The GetFileInformationByHandleEx variant includes an explicit buffer size to make errors harder, and enables us to get a 128-bit file identifier, which is (supposedly) even more unique than the 64-bit identifiers we were looking at before.
* fslock-guard: Fix up documentation a bit.Nick Mathewson2026-05-061-5/+14
| | | | | This mainly amounts to clarifying some of our windows desiderata, and removing the final refrences to fslock.
* fslock-guard: Compile on wasm.Nick Mathewson2026-05-061-0/+16
| | | | | | We can't actually open a file on wasm-unknown-unknown, but it's more convenient for us if we don't have to conditionally compile this crate every place that uses it.
* fslock-guard: Remove fslock dependency.Nick Mathewson2026-05-061-24/+39
| | | | | We can do this since our msrv is now 1.89.0, where File::lock is supported.
* Allow clippy::collapsible_if to triggerGabriela Moldovan2026-02-161-0/+1
| | | | | | | | | `clippy::collapsible_if` started triggering after bumping the MSRV to 1.88. Since this triggers from a lot of places, and since there even are a couple of instances where we explicitly allow `clippy::collapsible_ifs`, I've opened #2342 for deciding what to do about it.
* maint/add_warning: Run script to add new warningGabriela Moldovan2026-01-271-0/+1
| | | | This adds the lint to all our crates.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-2/+2
| | | | Run maint/add_warning
* Remove "doc_auto_cfg" incantation from all crates.Nick Mathewson2025-09-291-1/+1
| | | | This feature has been removed from nightly, in favor of doc_cfg.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-1/+1
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* Temporarily suppress mismatched_lifetime_syntaxes.Gabriela Moldovan2025-07-071-0/+1
| | | | See #2060.
* *: use std::io::Error::other in many placesNick Mathewson2025-05-151-4/+1
| | | | | | | The `IoError::other` function is an easier way to say `IoError::new(IoErrorKind::Other, ...)`. It's been around since 1.74, but clippy started warning about the more verbose version in 1.87.
* clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* fslock-guard: Use Path::try_exists() instead of Path::exists().Gabriela Moldovan2024-07-301-4/+4
|
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* Merge branch 'fslock_test' into 'main'Ian Jackson2024-03-051-0/+41
|\ | | | | | | | | fslock-guard: Add unit tests See merge request tpo/core/arti!2013
| * fslock-guard: Add unit testsTobias Stoeckmann2024-03-011-0/+41
| | | | | | | | | | This requires reordering of workspace members due to new internal dev-dependency.
* | Merge branch 'windows_comments' into 'main'Ian Jackson2024-03-051-12/+2
|\ \ | | | | | | | | | | | | Fix Windows documentation See merge request tpo/core/arti!2011
| * | fslock-guard: Update Windows commentsTobias Stoeckmann2024-03-011-12/+2
| |/ | | | | | | | | The implementation changed in bd52d43779ed3a61d000bf16e96ed09ad924e141 but comments have not been updated.
* | Merge branch 'deny-unchecked-duration-substraction' into 'main'Ian Jackson2024-03-051-0/+1
|\ \ | | | | | | | | | | | | | | | | | | deny clippy::unchecked_duration_subtraction Closes #1304 See merge request tpo/core/arti!2008
| * | deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
| |/
* / fslock-guard: Fix Windows compilationTobias Stoeckmann2024-03-011-2/+2
|/ | | | | Cast argument to GetFileInformationByHandle, because types do not match. Output is: expected `winapi::ctypes::c_void`, found `std::ffi::c_void`
* fslock-guard: Add links to documentation about windows approachNick Mathewson2024-01-241-0/+7
|
* fslock-guard: use winapi to test file-equivalency on windowsNick Mathewson2024-01-231-6/+19
|
* fslockguard: try to document windows assumptionsNick Mathewson2024-01-231-0/+41
| | | | | These are necessarily a bit hand-wavey, but I think they summarize what we are assuming.
* Remove an XXX: fslock does indeed use O_CLOEXEC.Nick Mathewson2024-01-231-1/+0
|
* fslockguard: implement a delete_lock_file function.Nick Mathewson2024-01-231-3/+29
|
* Use fslock-arti-forkNick Mathewson2024-01-231-19/+6
|
* fslock-guard: Write down the locking protocol on UnixIan Jackson2024-01-231-0/+65
| | | | | | Text from here https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1900#note_2986683 with a few minor fixes.
* fslock-guard: Rename os modulesIan Jackson2024-01-231-2/+2
| | | | | | | | | | | These two modules are key to the implementation of the locking protocols. We must define the locking protocol in terms of underlying OS semantics (since Unix and Windows have different fs concepts and different concurrency semantics) and therefore, although we are sharing some code between the implementations, these modules are what defines the two protocols.
* Give a formal semantics for the fslock operations.Ian Jackson2024-01-221-0/+15
|
* fslock-guard: sketch implementationNick Mathewson2024-01-211-0/+149
This is not yet "correct", since it will rely on https://github.com/brunoczim/fslock/pull/15 (Conceivably, it might be better to make the `fslock` crate rm-safe.)