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:
@@ -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.
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user