Lines Matching refs:newf
438 struct files_struct *oldf, *newf; in copy_files() local
461 newf = kmem_cache_alloc(files_cachep, SLAB_KERNEL); in copy_files()
462 if (!newf) in copy_files()
465 atomic_set(&newf->count, 1); in copy_files()
467 newf->file_lock = RW_LOCK_UNLOCKED; in copy_files()
468 newf->next_fd = 0; in copy_files()
469 newf->max_fds = NR_OPEN_DEFAULT; in copy_files()
470 newf->max_fdset = __FD_SETSIZE; in copy_files()
471 newf->close_on_exec = &newf->close_on_exec_init; in copy_files()
472 newf->open_fds = &newf->open_fds_init; in copy_files()
473 newf->fd = &newf->fd_array[0]; in copy_files()
479 newf->max_fdset = 0; in copy_files()
480 write_lock(&newf->file_lock); in copy_files()
481 error = expand_fdset(newf, size-1); in copy_files()
482 write_unlock(&newf->file_lock); in copy_files()
498 newf->max_fds = 0; in copy_files()
499 write_lock(&newf->file_lock); in copy_files()
500 error = expand_fd_array(newf, open_files-1); in copy_files()
501 write_unlock(&newf->file_lock); in copy_files()
504 nfds = newf->max_fds; in copy_files()
509 new_fds = newf->fd; in copy_files()
511 memcpy(newf->open_fds->fds_bits, oldf->open_fds->fds_bits, open_files/8); in copy_files()
512 memcpy(newf->close_on_exec->fds_bits, oldf->close_on_exec->fds_bits, open_files/8); in copy_files()
525 FD_CLR(open_files - i, newf->open_fds); in copy_files()
532 size = (newf->max_fds - open_files) * sizeof(struct file *); in copy_files()
537 if (newf->max_fdset > open_files) { in copy_files()
538 int left = (newf->max_fdset-open_files)/8; in copy_files()
541 memset(&newf->open_fds->fds_bits[start], 0, left); in copy_files()
542 memset(&newf->close_on_exec->fds_bits[start], 0, left); in copy_files()
545 tsk->files = newf; in copy_files()
551 free_fdset (newf->close_on_exec, newf->max_fdset); in copy_files()
552 free_fdset (newf->open_fds, newf->max_fdset); in copy_files()
553 kmem_cache_free(files_cachep, newf); in copy_files()