Skip to content

Your small yet useful swiss army knife for the `fcntl` system call, specifically for acquiring and testing file locks, but not limited to those.

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE-APACHE
Unknown
LICENSE-MIT
Notifications You must be signed in to change notification settings

phip1611/fcntl-tool

Repository files navigation

fcntl-tool

Your small yet useful swiss army knife for the fcntl system call, specifically for acquiring and testing file locks, but not limited to those.

This tool only works on UNIX or POSIX-like systems. Please find more information in the following resources:

🔍 What Problem Does It Solve?

This is for example useful for testing during development. Imagine you want to check how your program behaves, when a lock is already held. Using fcntl-tool, you can acquire these locks!

Supported Platforms

This crate works on all platforms that Rust code can be compiled to. It, however, only makes sense on UNIX or POSIX-like systems.

Supported fcntl Operations

operation supported
F_GETLK
F_SETLK
F_OFD_GETLK
F_OFD_SETLK
... Not yet

CLI Usage

Type fcntl-tool --help to get guidance.

Example

$ fcntl-tool --help

# Terminal 1
$ fcntl-tool write-lock --file ./foo.txt
Please press enter to release the Write lock ...


# Terminal 2
$ fcntl-tool test-lock --file ./foo.txt
state: ExclusiveWrite

You can also take a look onto the integration test in the repository.

MSRV

The MSRV of the binary is 1.85.0 stable.

About

Your small yet useful swiss army knife for the `fcntl` system call, specifically for acquiring and testing file locks, but not limited to those.

Topics

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE-APACHE
Unknown
LICENSE-MIT

Stars

Watchers

Forks