Subject: Re: New fdalloc -- bug?
To: None <tech-kern@netbsd.org>
From: Niels Provos <provos@citi.umich.edu>
List: tech-kern
Date: 11/01/2003 13:10:28
On Sat, Nov 01, 2003 at 06:49:26PM +0100, Juergen Hannken-Illjes wrote:
> sys/kern/kern_descrip.c contains this code (function fdcopy):
>
> /*
> * kq descriptors cannot be copied.
> */
> if (newfdp->fd_knlistsize != -1) {
> fpp = newfdp->fd_ofiles;
> for (i = newfdp->fd_lastfile; i-- >= 0; fpp++) {
> if (*fpp != NULL && (*fpp)->f_type == DTYPE_KQUEUE)
> *fpp = NULL;
> }
>
> Why is this brute-force close not done on the fd_XXmap?
Sigh. This code needs to use fdremove(). It needs to use something
like this:
for (i = newfdp->fd_lastfile; i-- >= 0; fpp++) {
if (*fpp != NULL && (*fpp)->f_type == DTYPE_KQUEUE)
fdremove(newfdp, i);
When looking at the code, it seemed that everything had been moved to
fdremove(). My bad.
Niels.