Added get_open_fd() function which gets the descriptor and also

increments its open count.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25317 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-05-05 00:24:14 +00:00
parent 1571aa7ff9
commit cb734beeee
2 changed files with 16 additions and 0 deletions
+15
View File
@@ -303,6 +303,21 @@ get_fd(struct io_context *context, int fd)
}
struct file_descriptor *
get_open_fd(struct io_context *context, int fd)
{
MutexLocker(context->io_mutex);
file_descriptor *descriptor = get_fd_locked(context, fd);
if (descriptor == NULL)
return NULL;
atomic_add(&descriptor->open_count, 1);
return descriptor;
}
/** Removes the file descriptor from the specified slot.
*/