max_fdset = current->files->max_fdset; 
fdt = files_fdtable(current->files); max_fdset = fdt->max_fdset; 
sys_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp){	fd_set_bits fds;	char *bits;	long timeout;	int ret, size, max_fdset;	timeout = MAX_SCHEDULE_TIMEOUT;	if (tvp) {		time_t sec, usec;		if (!access_ok(VERIFY_READ, tvp, sizeof(*tvp))		    || __get_user(sec, &tvp->tv_sec)		    || __get_user(usec, &tvp->tv_usec)) {			ret = -EFAULT;			goto out_nofds;		}		ret = -EINVAL;		if (sec < 0 || usec < 0)			goto out_nofds;		if ((unsigned long) sec < MAX_SELECT_SECONDS) {			timeout = ROUND_UP(usec, 1000000/HZ);			timeout += sec * (unsigned long) HZ;		}	}	ret = -EINVAL;	if (n < 0)		goto out_nofds;	/* max_fdset can increase, so grab it once to avoid race */	max_fdset = current->files->max_fdset;	if (n > max_fdset)		n = max_fdset;	/*	 * We need 6 bitmaps (in/out/ex for both incoming and outgoing),	 * since we used fdset we need to allocate memory in units of	 * long-words. 	 */	ret = -ENOMEM;	size = FDS_BYTES(n);	bits = select_bits_alloc(size);	if (!bits)		goto out_nofds;	fds.in      = (unsigned long *)  bits;	fds.out     = (unsigned long *) (bits +   size);	fds.ex      = (unsigned long *) (bits + 2*size);	fds.res_in  = (unsigned long *) (bits + 3*size);	fds.res_out = (unsigned long *) (bits + 4*size);	fds.res_ex  = (unsigned long *) (bits + 5*size);	if ((ret = get_fd_set(n, inp, fds.in)) ||	    (ret = get_fd_set(n, outp, fds.out)) ||	    (ret = get_fd_set(n, exp, fds.ex)))		goto out;	zero_fd_set(n, fds.res_in);	zero_fd_set(n, fds.res_out);	zero_fd_set(n, fds.res_ex);	ret = do_select(n, &fds, &timeout);	if (tvp && !(current->personality & STICKY_TIMEOUTS)) {		time_t sec = 0, usec = 0;		if (timeout) {			sec = timeout / HZ;			usec = timeout % HZ;			usec *= (1000000/HZ);		}		put_user(sec, &tvp->tv_sec);		put_user(usec, &tvp->tv_usec);	}	if (ret < 0)		goto out;	if (!ret) {		ret = -ERESTARTNOHAND;		if (signal_pending(current))			goto out;		ret = 0;	}	if (set_fd_set(n, inp, fds.res_in) ||	    set_fd_set(n, outp, fds.res_out) ||	    set_fd_set(n, exp, fds.res_ex))		ret = -EFAULT;out:	select_bits_free(bits, size);out_nofds:	return ret;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/badf16621c1f9d1ac753be056fce11b43d6e0be5/select.c/clean/fs/select.c