vfs: advisory locking + flock syscall

This commit is contained in:
Matheus
2025-09-12 00:34:49 -03:00
parent 39ba23f572
commit b6e76f3d1f
14 changed files with 319 additions and 13 deletions
+8 -1
View File
@@ -20,6 +20,7 @@ static bool ctor(scache_t *cache, void *obj) {
file->offset = 0;
file->flags = 0;
file->mode = 0;
file->advlock = NULL;
file->refcount = 1;
return true;
}
@@ -39,12 +40,18 @@ static void cleanfile(file_t *file) {
VOP_RELEASE(file->vnode);
}
file->vnode = NULL;
file->refcount = 1;
file->offset = 0;
file->flags = 0;
file->mode = 0;
MUTEX_INIT(&file->mutex);
if (file->advlock) {
// try unlocking it if applicable
VOP_ADVLOCK(file->vnode, ADVLOCK_UNLOCK, file->advlock);
ADVLOCK_UNREF(file->advlock);
file->advlock = NULL;
}
file->vnode = NULL;
slab_free(filecache, file);
}