Crate file_lock [−] [src]
File locking via POSIX advisory record locks.
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()
.
Examples
extern crate file_lock; use file_lock::*; use file_lock::Error::*; fn main() { let l = lock("/tmp/file-lock-test"); match l { Ok(_) => println!("Got lock"), Err(e) => match e { InvalidFilename => println!("Invalid filename"), Errno(i) => println!("Got filesystem error {}", i), } } }
Structs
Lock |
Represents a lock on a file. |
Enums
Error |
Represents the error that occured while trying to lock or unlock a file. |
Functions
lock |
Locks the specified file. |
lock_wait |
Locks the specified file. |
unlock |
Unlocks the file held by |