 nfds = fdt->max_fdset; spin_unlock(&files->file_lock);  /* Expand to the max in easy steps */ do { if (nfds < (PAGE_SIZE * 8)) nfds = PAGE_SIZE * 8; else { nfds = nfds * 2; if (nfds > NR_OPEN) nfds = NR_OPEN; } } while (nfds <= nr);  error = -ENOMEM; new_openset = alloc_fdset(nfds); new_execset = alloc_fdset(nfds); spin_lock(&files->file_lock); if (!new_openset || !new_execset) goto out;  error = 0;  /* Copy the existing tables and install the new pointers */ fdt = files_fdtable(files); if (nfds > fdt->max_fdset) { int i = fdt->max_fdset / (sizeof(unsigned long) * 8); int count = (nfds - fdt->max_fdset) / 8;  /* * Don't copy the entire array if the current fdset is * not yet initialised. */ if (i) { memcpy (new_openset, fdt->open_fds, fdt->max_fdset/8); memcpy (new_execset, fdt->close_on_exec, fdt->max_fdset/8); memset (&new_openset->fds_bits[i], 0, count); memset (&new_execset->fds_bits[i], 0, count); }  nfds = xchg(&fdt->max_fdset, nfds); new_openset = xchg(&fdt->open_fds, new_openset); new_execset = xchg(&fdt->close_on_exec, new_execset); spin_unlock(&files->file_lock); free_fdset (new_openset, nfds); free_fdset (new_execset, nfds); spin_lock(&files->file_lock); return 0; } /* Somebody expanded the array while we slept ... */  
} rcu_assign_pointer(files->fdt, nfdt); free_fdtable(fdt); 
	__acquires(file->file_lock){	fd_set *new_openset = NULL, *new_execset = NULL;	int error, nfds = 0;	struct fdtable *fdt;	error = -EMFILE;	fdt = files_fdtable(files);	if (fdt->max_fdset >= NR_OPEN || nr >= NR_OPEN)		goto out;	nfds = fdt->max_fdset;	spin_unlock(&files->file_lock);	/* Expand to the max in easy steps */	do {		if (nfds < (PAGE_SIZE * 8))			nfds = PAGE_SIZE * 8;		else {			nfds = nfds * 2;			if (nfds > NR_OPEN)				nfds = NR_OPEN;		}	} while (nfds <= nr);	error = -ENOMEM;	new_openset = alloc_fdset(nfds);	new_execset = alloc_fdset(nfds);	spin_lock(&files->file_lock);	if (!new_openset || !new_execset)		goto out;	error = 0;		/* Copy the existing tables and install the new pointers */	fdt = files_fdtable(files);	if (nfds > fdt->max_fdset) {		int i = fdt->max_fdset / (sizeof(unsigned long) * 8);		int count = (nfds - fdt->max_fdset) / 8;				/* 		 * Don't copy the entire array if the current fdset is		 * not yet initialised.  		 */		if (i) {			memcpy (new_openset, fdt->open_fds, fdt->max_fdset/8);			memcpy (new_execset, fdt->close_on_exec, fdt->max_fdset/8);			memset (&new_openset->fds_bits[i], 0, count);			memset (&new_execset->fds_bits[i], 0, count);		}				nfds = xchg(&fdt->max_fdset, nfds);		new_openset = xchg(&fdt->open_fds, new_openset);		new_execset = xchg(&fdt->close_on_exec, new_execset);		spin_unlock(&files->file_lock);		free_fdset (new_openset, nfds);		free_fdset (new_execset, nfds);		spin_lock(&files->file_lock);		return 0;	} 	/* Somebody expanded the array while we slept ... */out:	spin_unlock(&files->file_lock);	if (new_openset)		free_fdset(new_openset, nfds);	if (new_execset)		free_fdset(new_execset, nfds);	spin_lock(&files->file_lock);	return error;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/ab2af1f5005069321c5d130f09cce577b03f43ef/file.c/clean/fs/file.c