fsautoproc
Basic file transformation automation management utility
|
Basic file lock implementation. More...
#include "fl.h"
#include <assert.h>
#include <fcntl.h>
#include <stddef.h>
#include <sys/file.h>
#include <unistd.h>
Functions | |
static int | flopen (struct flock_s *fl) |
Opens the file at the given path and updates the file lock structure with the file descriptor. If the file is already open, the file descriptor is not updated and the function will return successfully. If the file cannot be opened, the error code is returned via the file lock structure. | |
int | fllock (struct flock_s *fl) |
Locks the file at the given path. If a file descriptor cannot be obtained, or the file cannot be locked, an error code is returned. | |
int | flunlock (struct flock_s *fl) |
Unlocks the file at the given path. If the file is not open, or the file cannot be unlocked, an error code is returned. | |
Basic file lock implementation.
int fllock | ( | struct flock_s * | fl | ) |
Locks the file at the given path. If a file descriptor cannot be obtained, or the file cannot be locked, an error code is returned.
flinit()
before calling fllock
. fl | The file lock structure. |
|
static |
Opens the file at the given path and updates the file lock structure with the file descriptor. If the file is already open, the file descriptor is not updated and the function will return successfully. If the file cannot be opened, the error code is returned via the file lock structure.
fl | The file lock structure to update. |
int flunlock | ( | struct flock_s * | fl | ) |
Unlocks the file at the given path. If the file is not open, or the file cannot be unlocked, an error code is returned.
fl | The file lock structure. |