patch-2.1.65 linux/fs/select.c

Next file: linux/include/asm-alpha/softirq.h
Previous file: linux/fs/nfsd/vfs.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.64/linux/fs/select.c linux/fs/select.c
@@ -328,6 +328,17 @@
 	zero_fd_set(n, &fds->res_out);
 	zero_fd_set(n, &fds->res_ex);
 	error = do_select(n, fds, wait);
+	if (tvp && !(current->personality & STICKY_TIMEOUTS)) {
+		unsigned long timeout = current->timeout - jiffies - 1;
+		unsigned long sec = 0, usec = 0;
+		if ((long) timeout > 0) {
+			sec = timeout / HZ;
+			usec = timeout % HZ;
+			usec *= (1000000/HZ);
+		}
+		put_user(sec, &tvp->tv_sec);
+		put_user(usec, &tvp->tv_usec);
+	}
 	current->timeout = 0;
 	if (error < 0)
 		goto out;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov