num_used_fds counting was broken for dup2() and vfs_new_io_context() when it was

used with a parent context.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14311 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-10-06 08:53:17 +00:00
parent e8d4a05d8b
commit 1670b8f596
2 changed files with 4 additions and 0 deletions

View File

@ -242,6 +242,9 @@ dup2_fd(int oldfd, int newfd, bool kernel)
atomic_add(&context->fds[oldfd]->ref_count, 1);
atomic_add(&context->fds[oldfd]->open_count, 1);
context->fds[newfd] = context->fds[oldfd];
if (evicted == NULL)
context->num_used_fds++;
}
mutex_unlock(&context->io_mutex);

View File

@ -2903,6 +2903,7 @@ vfs_new_io_context(void *_parentContext)
if (descriptor != NULL && (descriptor->open_mode & O_CLOEXEC) == 0) {
context->fds[i] = descriptor;
context->num_used_fds++;
atomic_add(&descriptor->ref_count, 1);
atomic_add(&descriptor->open_count, 1);
}