summaryrefslogtreecommitdiff
path: root/Kernel/UnixTypes.h
diff options
context:
space:
mode:
authorPeter Elliott <pelliott@ualberta.ca>2021-07-18 23:29:56 -0600
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-07-20 17:44:30 +0430
commit3fa28166428c41ca4a608d7c5c7090c69e55353e (patch)
tree7a89b0f55d05f5351b5dfa569e28e0d31f8e7403 /Kernel/UnixTypes.h
parentfbc56461da66f7dbb4eb8f8c0ec03a190127a060 (diff)
downloadserenity-3fa28166428c41ca4a608d7c5c7090c69e55353e.zip
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.
Diffstat (limited to 'Kernel/UnixTypes.h')
-rw-r--r--Kernel/UnixTypes.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/Kernel/UnixTypes.h b/Kernel/UnixTypes.h
index f9429eb529..4ca23090fe 100644
--- a/Kernel/UnixTypes.h
+++ b/Kernel/UnixTypes.h
@@ -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;
+};