patch-2.4.0-test4 linux/arch/sparc64/solaris/timod.c

Next file: linux/drivers/acorn/net/ether1.c
Previous file: linux/arch/sparc64/solaris/socksys.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test3/linux/arch/sparc64/solaris/timod.c linux/arch/sparc64/solaris/timod.c
@@ -1,4 +1,4 @@
-/* $Id: timod.c,v 1.7 2000/06/09 07:35:30 davem Exp $
+/* $Id: timod.c,v 1.9 2000/07/12 23:21:02 davem Exp $
  * timod.c: timod emulation.
  *
  * Copyright (C) 1998 Patrik Rak (prak3264@ss1000.ms.mff.cuni.cz)
@@ -15,6 +15,7 @@
 #include <linux/smp_lock.h>
 #include <linux/ioctl.h>
 #include <linux/fs.h>
+#include <linux/file.h>
 #include <linux/netdevice.h>
 #include <linux/poll.h>
 
@@ -619,22 +620,6 @@
 	return -EINVAL;
 }
 
-/* copied directly from fs/select.c */
-
-static void free_wait(poll_table * p)
-{
-	struct poll_table_entry * entry = p->entry + p->nr;
-
-	SOLD("entry");
-	while (p->nr > 0) {
-		p->nr--;
-		entry--;
-		remove_wait_queue(entry->wait_address,&entry->wait);
-	}
-	SOLD("done");
-}
-
-
 int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len,
 			char *data_buf, int data_maxlen, s32 *data_len, int *flags_p)
 {
@@ -670,14 +655,8 @@
 	}
 	if (!(filp->f_flags & O_NONBLOCK)) {
 		poll_table wait_table, *wait;
-		struct poll_table_entry *entry;
-		SOLD("getting poll_table");
-		entry = (struct poll_table_entry *)__get_free_page(GFP_KERNEL);
-		if (!entry)
-			return -ENOMEM;
-		SOLD("got one");
-		wait_table.nr = 0;
-		wait_table.entry = entry;
+
+		poll_initwait(&wait_table);
 		wait = &wait_table;
 		for(;;) {
 			SOLD("loop");
@@ -705,13 +684,17 @@
 				SOLD("avoiding lockup");
 				break ;
 			}
+			if(wait_table.error) {
+				SOLD("wait-table error");
+				poll_freewait(&wait_table);
+				return wait_table.error;
+			}
 			SOLD("scheduling");
 			schedule();
 		}
 		SOLD("loop done");
 		current->state = TASK_RUNNING;
-		free_wait(&wait_table);
-		free_page((unsigned long)entry);
+		poll_freewait(&wait_table);
 		if (signal_pending(current)) {
 			SOLD("signal pending");
 			return -EINTR;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)