ref: 6fac632ca2de1a66c23aae32ec7acaf0bf168fd2 file-locker/README.md -rw-r--r-- 1.7 KiB
6fac632cSashanoraa Fix name in README 7 months ago


File locking via POSIX advisory record locks (fork of file-lock)

This crate provides the facility to lock and unlock a file following the advisory record lock scheme as specified by UNIX IEEE Std 1003.1-2001 (POSIX.1) via fcntl().

This crate currently supports Linux and FreeBSD.


use file_lock::FileLock;
use std::io::prelude::*;
use std::io::Result;

fn main() -> Result<()> {
    let filelock = FileLock::new("myfile.txt")

    filelock.file.write_all(b"Hello, World!")?;

    // Manually unlocking is optional as we unlock on Drop



Please report any bugs at:

Or by email at:


Sashanoraa <sasha@noraa.gay>

Alfie John <alfie@alfie.wtf>

Sebastian Thiel <byronimo@gmail.com>


Contribution welcome!

Please send any patches to ~zethra/public-inbox@lists.sr.ht

If you need help sending a patch over email please see this guide

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed under the MIT license, without any additional terms or conditions.