vfs: refcount file structs used in fdescs
This commit is contained in:
parent
744c3b266f
commit
02c0a70a30
5 changed files with 22 additions and 4 deletions
|
|
@ -126,6 +126,10 @@ int sys_open(const char *pathname, int flags)
|
|||
fdesc->pos = 0;
|
||||
fdesc->flags = flags;
|
||||
|
||||
spinlock_acquire(&file->ref_lock);
|
||||
file->refcount++;
|
||||
spinlock_release(&file->ref_lock);
|
||||
|
||||
struct rbnode *node = rbt_insert(&proc->fd_map, fdno);
|
||||
node->value = (uintptr_t)fdesc;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue