kernel/fd: add inc_fd_open_count

Change-Id: I28a1b99a020cefb626dddca78cb7b7913cd1286c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9864
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Jérôme Duval
2025-11-15 22:30:45 +00:00
parent 8dcdf257f9
commit 431d197b7e
2 changed files with 8 additions and 0 deletions
+1
View File
@@ -84,6 +84,7 @@ extern status_t close_fd_index(struct io_context *context, int fd);
extern void put_fd(struct file_descriptor *descriptor); extern void put_fd(struct file_descriptor *descriptor);
extern void disconnect_fd(struct file_descriptor *descriptor); extern void disconnect_fd(struct file_descriptor *descriptor);
extern void inc_fd_ref_count(struct file_descriptor *descriptor); extern void inc_fd_ref_count(struct file_descriptor *descriptor);
extern void inc_fd_open_count(struct file_descriptor *descriptor);
extern int dup_foreign_fd(team_id fromTeam, int fd, bool kernel); extern int dup_foreign_fd(team_id fromTeam, int fd, bool kernel);
extern status_t select_fd(int32 fd, struct select_info *info, bool kernel); extern status_t select_fd(int32 fd, struct select_info *info, bool kernel);
extern status_t deselect_fd(int32 fd, struct select_info *info, bool kernel); extern status_t deselect_fd(int32 fd, struct select_info *info, bool kernel);
+7
View File
@@ -272,6 +272,13 @@ inc_fd_ref_count(struct file_descriptor* descriptor)
} }
void
inc_fd_open_count(struct file_descriptor* descriptor)
{
atomic_add(&descriptor->open_count, 1);
}
static struct file_descriptor* static struct file_descriptor*
get_fd_locked(const struct io_context* context, int fd) get_fd_locked(const struct io_context* context, int fd)
{ {