Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_descrip.c
Context not available. | |||||
atomic_store_rel_ptr((volatile void *)&fdp->fd_files, (uintptr_t)ntable); | atomic_store_rel_ptr((volatile void *)&fdp->fd_files, (uintptr_t)ntable); | ||||
/* | /* | ||||
* Free the old file table when not shared by other threads or processes. | * Do not free the old file table, as some threads may still | ||||
* The old file table is considered to be shared when either are true: | * reference entries within it. Instead, place it on a freelist | ||||
* - The process has more than one thread. | |||||
* - The file descriptor table has been shared via fdshare(). | |||||
* | |||||
* When shared, the old file table will be placed on a freelist | |||||
* which will be processed when the struct filedesc is released. | * which will be processed when the struct filedesc is released. | ||||
* | * | ||||
* Note that if onfiles == NDFILE, we're dealing with the original | * Note that if onfiles == NDFILE, we're dealing with the original | ||||
Context not available. | |||||
* which must not be freed. | * which must not be freed. | ||||
*/ | */ | ||||
if (onfiles > NDFILE) { | if (onfiles > NDFILE) { | ||||
if (curproc->p_numthreads == 1 && fdp->fd_refcnt == 1) | ft = (struct freetable *)&otable->fdt_ofiles[onfiles]; | ||||
free(otable, M_FILEDESC); | fdp0 = (struct filedesc0 *)fdp; | ||||
else { | ft->ft_table = otable; | ||||
ft = (struct freetable *)&otable->fdt_ofiles[onfiles]; | SLIST_INSERT_HEAD(&fdp0->fd_free, ft, ft_next); | ||||
fdp0 = (struct filedesc0 *)fdp; | |||||
ft->ft_table = otable; | |||||
SLIST_INSERT_HEAD(&fdp0->fd_free, ft, ft_next); | |||||
} | |||||
} | } | ||||
/* | /* | ||||
* The map does not have the same possibility of threads still | * The map does not have the same possibility of threads still | ||||
Context not available. |