1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:54:58 +00:00

Kernel+LibC: Implement fcntl(2) advisory locks

Advisory locks don't actually prevent other processes from writing to
the file, but they do prevent other processes looking to acquire and
advisory lock on the file.

This implementation currently only adds non-blocking locks, which are
all I need for now.
This commit is contained in:
Peter Elliott 2021-07-18 23:29:56 -06:00 committed by Ali Mohammad Pur
parent fbc56461da
commit 3fa2816642
8 changed files with 186 additions and 7 deletions

View file

@ -108,6 +108,9 @@ enum {
#define F_GETFL 3
#define F_SETFL 4
#define F_ISTTY 5
#define F_GETLK 6
#define F_SETLK 7
#define F_SETLKW 8
#define FD_CLOEXEC 1
@ -746,3 +749,15 @@ struct statvfs {
unsigned long f_flag;
unsigned long f_namemax;
};
#define F_RDLCK ((short)0)
#define F_WRLCK ((short)1)
#define F_UNLCK ((short)2)
struct flock {
short l_type;
short l_whence;
off_t l_start;
off_t l_len;
pid_t l_pid;
};