patch-1.3.2 linux/fs/select.c

Next file: linux/include/asm-alpha/a.out.h
Previous file: linux/fs/proc/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.1/linux/fs/select.c linux/fs/select.c
@@ -154,9 +154,10 @@
  * We do a VERIFY_WRITE here even though we are only reading this time:
  * we'll write to it eventually..
  */
-static int __get_fd_set(int nr, unsigned long * fs_pointer, unsigned long * fdset)
+static int __get_fd_set(int nr, unsigned long * fs_pointer, fd_set * fdset)
 {
-	int error;
+	int error, i;
+	unsigned long * tmp;
 
 	FD_ZERO(fdset);
 	if (!fs_pointer)
@@ -164,9 +165,12 @@
 	error = verify_area(VERIFY_WRITE,fs_pointer,sizeof(fd_set));
 	if (error)
 		return error;
-	while (nr > 0) {
-		*fdset = get_user(fs_pointer);
-		fdset++;
+	tmp = fdset->fds_bits;
+	for (i = __FDSET_LONGS; i > 0; i--) {
+		if (nr <= 0)
+			break;
+		*tmp = get_user(fs_pointer);
+		tmp++;
 		fs_pointer++;
 		nr -= 8 * sizeof(unsigned long);
 	}
@@ -175,9 +179,13 @@
 
 static void __set_fd_set(int nr, unsigned long * fs_pointer, unsigned long * fdset)
 {
+	int i;
+
 	if (!fs_pointer)
 		return;
-	while (nr > 0) {
+	for (i = __FDSET_LONGS; i > 0; i--) {
+		if (nr <= 0)
+			break;
 		put_user(*fdset, fs_pointer);
 		fdset++;
 		fs_pointer++;
@@ -186,7 +194,7 @@
 }
 
 #define get_fd_set(nr,fsp,fdp) \
-__get_fd_set(nr, (unsigned long *) (fsp), (unsigned long *) (fdp))
+__get_fd_set(nr, (unsigned long *) (fsp), fdp)
 
 #define set_fd_set(nr,fsp,fdp) \
 __set_fd_set(nr, (unsigned long *) (fsp), (unsigned long *) (fdp))
@@ -244,29 +252,4 @@
 	set_fd_set(n, outp, &res_out);
 	set_fd_set(n, exp, &res_ex);
 	return i;
-}
-
-/*
- * Perform the select(nd, in, out, ex, tv) system call.
- * Linux/i386 didn't use to be able to handle 5 system call
- * parameters, so the old select used a memory block for
- * parameter passing..
- */
-asmlinkage int old_select(unsigned long *buffer)
-{
-	int n;
-	fd_set *inp;
-	fd_set *outp;
-	fd_set *exp;
-	struct timeval *tvp;
-
-	n = verify_area(VERIFY_READ, buffer, 5*sizeof(unsigned long));
-	if (n)
-		return n;
-	n = get_user(buffer);
-	inp = (fd_set *) get_user(buffer+1);
-	outp = (fd_set *) get_user(buffer+2);
-	exp = (fd_set *) get_user(buffer+3);
-	tvp = (struct timeval *) get_user(buffer+4);
-	return sys_select(n, inp, outp, exp, tvp);
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this