--- arch/sparc64/solaris/timod.c~	Thu Nov 26 18:49:34 1998
+++ arch/sparc64/solaris/timod.c	Thu Dec  3 14:41:43 1998
@@ -154,7 +154,7 @@
 	sock = &current->files->fd[fd]->f_dentry->d_inode->u.socket_i;
 	wake_up_interruptible(&sock->wait);
 	if (sock->fasync_list && !(sock->flags & SO_WAITDATA))
-		kill_fasync(sock->fasync_list, SIGIO);
+		kill_fasync(sock->fasync_list, SIGIO, 0);
 	SOLD("done");
 }
 
--- drivers/char/adbmouse.c~	Thu Nov 26 18:48:18 1998
+++ drivers/char/adbmouse.c	Thu Dec  3 14:47:09 1998
@@ -134,7 +134,7 @@
     mouse.ready = 1;
     wake_up_interruptible(&mouse.wait);
     if (mouse.fasyncptr)
-	kill_fasync(mouse.fasyncptr, SIGIO);
+	kill_fasync(mouse.fasyncptr, SIGIO, POLL_IN);
 }
 
 static int fasync_mouse(int fd, struct file *filp, int on)
--- drivers/char/amigamouse.c~	Mon Aug 24 21:02:43 1998
+++ drivers/char/amigamouse.c	Thu Dec  3 14:43:57 1998
@@ -154,7 +154,7 @@
 	      mouse.dy =  2048;
 
 	  if (mouse.fasyncptr)
-	      kill_fasync(mouse.fasyncptr, SIGIO);
+	      kill_fasync(mouse.fasyncptr, SIGIO, POLL_IN);
 	}
 	AMI_MSE_INT_ON();
 }
--- drivers/char/atarimouse.c~	Mon Aug 24 21:02:43 1998
+++ drivers/char/atarimouse.c	Thu Dec  3 14:44:03 1998
@@ -49,7 +49,7 @@
     mouse.ready = 1;
     wake_up_interruptible(&mouse.wait);
     if (mouse.fasyncptr)
-	kill_fasync(mouse.fasyncptr, SIGIO);
+	kill_fasync(mouse.fasyncptr, SIGIO, POLL_IN);
 
 /*    ikbd_mouse_rel_pos(); */
 }
--- drivers/char/atixlmouse.c~	Mon Aug 24 21:02:43 1998
+++ drivers/char/atixlmouse.c	Thu Dec  3 14:43:11 1998
@@ -90,7 +90,7 @@
 		mouse.ready = 1;
 		wake_up_interruptible(&mouse.wait);
 		if (mouse.fasync)
-			kill_fasync(mouse.fasync, SIGIO);
+			kill_fasync(mouse.fasync, SIGIO, POLL_IN);
 	}
 	ATIXL_MSE_ENABLE_UPDATE();
 }
--- drivers/char/busmouse.c~	Mon Aug 24 21:02:43 1998
+++ drivers/char/busmouse.c	Thu Dec  3 14:43:03 1998
@@ -101,7 +101,7 @@
 	      mouse.dy =  2048;
 
 	  if (mouse.fasyncptr)
-	      kill_fasync(mouse.fasyncptr, SIGIO);
+	      kill_fasync(mouse.fasyncptr, SIGIO, POLL_IN);
 	}
 	MSE_INT_ON();
 }
--- drivers/char/dn_keyb.c~	Mon Aug 24 21:02:44 1998
+++ drivers/char/dn_keyb.c	Thu Dec  3 14:47:17 1998
@@ -468,7 +468,7 @@
           		if (mouse_dy >  2048)
               		mouse_dy =  2048;
 				if (mouse_fasyncptr)
-              		kill_fasync(mouse_fasyncptr, SIGIO);
+              		kill_fasync(mouse_fasyncptr, SIGIO, POLL_IN);
 			}
 			mouse_byte_count=0;
 /*			printk("mouse: %d, %d, %x\n",mouse_x,mouse_y,buttons); */
--- drivers/char/macmouse.c~	Mon Aug 24 21:14:09 1998
+++ drivers/char/macmouse.c	Thu Dec  3 14:47:26 1998
@@ -146,7 +146,7 @@
     mouse.ready = 1;
     wake_up_interruptible(&mouse.wait);
     if (mouse.fasyncptr)
-	kill_fasync(mouse.fasyncptr, SIGIO);
+	kill_fasync(mouse.fasyncptr, SIGIO, POLL_IN);
 
 }
 
--- drivers/char/msbusmouse.c~	Mon Aug 24 21:14:09 1998
+++ drivers/char/msbusmouse.c	Thu Dec  3 14:43:22 1998
@@ -85,7 +85,7 @@
 		mouse.ready = 1;
 		wake_up_interruptible(&mouse.wait);
 		if (mouse.fasyncptr)
-			kill_fasync(mouse.fasyncptr, SIGIO);
+			kill_fasync(mouse.fasyncptr, SIGIO, POLL_IN);
 	}
 }
 
--- drivers/char/n_tty.c~	Thu Nov 26 18:47:52 1998
+++ drivers/char/n_tty.c	Thu Dec  3 14:43:46 1998
@@ -603,7 +603,7 @@
 			tty->canon_head = tty->read_head;
 			tty->canon_data++;
 			if (tty->fasync)
-				kill_fasync(tty->fasync, SIGIO);
+				kill_fasync(tty->fasync, SIGIO, POLL_IN);
 			if (tty->read_wait)
 				wake_up_interruptible(&tty->read_wait);
 			return;
@@ -705,7 +705,7 @@
 
 	if (!tty->icanon && (tty->read_cnt >= tty->minimum_to_wake)) {
 		if (tty->fasync)
-			kill_fasync(tty->fasync, SIGIO);
+			kill_fasync(tty->fasync, SIGIO, POLL_IN);
 		if (tty->read_wait)
 			wake_up_interruptible(&tty->read_wait);
 	}
--- drivers/char/pc110pad.c~	Sun Sep  6 01:01:45 1998
+++ drivers/char/pc110pad.c	Thu Dec  3 14:44:20 1998
@@ -75,7 +75,7 @@
 {
 	wake_up_interruptible(&queue);
 	if(asyncptr)
-		kill_fasync(asyncptr, SIGIO);
+		kill_fasync(asyncptr, SIGIO, POLL_IN);
 }
 
 
--- drivers/char/pc_keyb.c~	Thu Nov 26 18:47:52 1998
+++ drivers/char/pc_keyb.c	Thu Dec  3 14:44:10 1998
@@ -445,7 +445,7 @@
 				if (head != queue->tail) {
 					queue->head = head;
 					if (queue->fasync)
-						kill_fasync(queue->fasync, SIGIO);
+						kill_fasync(queue->fasync, SIGIO, POLL_IN);
 					wake_up_interruptible(&queue->proc_list);
 				}
 			}
--- drivers/char/qpmouse.c~	Thu Nov 26 18:47:52 1998
+++ drivers/char/qpmouse.c	Thu Dec  3 14:47:35 1998
@@ -134,7 +134,7 @@
 	}
 	queue->head = head;
 	if (queue->fasync)
-		kill_fasync(queue->fasync, SIGIO);
+		kill_fasync(queue->fasync, SIGIO, POLL_IN);
 	wake_up_interruptible(&queue->proc_list);
 }
 
--- drivers/net/ppp.c~	Thu Nov 26 18:47:54 1998
+++ drivers/net/ppp.c	Thu Dec  3 14:42:47 1998
@@ -2097,7 +2097,7 @@
 
 	wake_up_interruptible (&ppp->read_wait);
 	if (ppp->tty->fasync != NULL)
-		kill_fasync (ppp->tty->fasync, SIGIO);
+		kill_fasync (ppp->tty->fasync, SIGIO, POLL_IN);
 
 	return 1;
 }
--- drivers/sbus/char/pcikbd.c~	Thu Nov 26 18:48:21 1998
+++ drivers/sbus/char/pcikbd.c	Thu Dec  3 14:48:05 1998
@@ -782,7 +782,7 @@
 	queue->head = head;
 	aux_ready = 1;
 	if (queue->fasync)
-		kill_fasync(queue->fasync, SIGIO);
+		kill_fasync(queue->fasync, SIGIO, POLL_IN);
 	wake_up_interruptible(&queue->proc_list);
 }
 
--- drivers/sbus/char/sunkbd.c~	Sun Oct  4 18:22:44 1998
+++ drivers/sbus/char/sunkbd.c	Thu Dec  3 14:47:47 1998
@@ -1273,7 +1273,7 @@
 		kbd_head = next;
 	}
 	if (kb_fasync)
-		kill_fasync (kb_fasync, SIGIO);
+		kill_fasync (kb_fasync, SIGIO, POLL_IN);
 	wake_up_interruptible (&kbd_wait);
 }
 
--- drivers/sbus/char/sunmouse.c~	Sun Oct  4 18:22:44 1998
+++ drivers/sbus/char/sunmouse.c	Thu Dec  3 14:48:00 1998
@@ -135,7 +135,7 @@
 	}
 	sunmouse.ready = 1;
 	if (sunmouse.fasync)
-		kill_fasync (sunmouse.fasync, SIGIO);
+		kill_fasync (sunmouse.fasync, SIGIO, POLL_IN);
 	wake_up_interruptible (&sunmouse.proc_list);
 }
 
@@ -311,7 +311,7 @@
 	 */
 	sunmouse.ready = 1;
 	if (sunmouse.fasync)
-		kill_fasync (sunmouse.fasync, SIGIO);
+		kill_fasync (sunmouse.fasync, SIGIO, POLL_IN);
 	wake_up_interruptible(&sunmouse.proc_list);
 	return;
 }
--- drivers/sgi/char/shmiq.c~	Mon Aug 24 21:14:10 1998
+++ drivers/sgi/char/shmiq.c	Thu Dec  3 14:48:13 1998
@@ -116,7 +116,7 @@
 	s->tail = tail_next;
 	shmiqs [device].tail = tail_next;
 	if (shmiqs [device].fasync)
-		kill_fasync (shmiqs [device].fasync, SIGIO);
+		kill_fasync (shmiqs [device].fasync, SIGIO, POLL_IN);
 	wake_up_interruptible (&shmiqs [device].proc_list);
 }
 
--- fs/fcntl.c~	Thu Dec  3 14:36:17 1998
+++ fs/fcntl.c	Thu Dec  3 15:49:43 1998
@@ -276,7 +276,10 @@
 			return;
 		}
 		fown = &fa->fa_file->f_owner;
-		if (fown->pid)
+		/* Don't send SIGURG to processes which have not set a
+                   queued signum: SIGURG has its own default signalling
+                   mechanism. */
+		if (fown->pid && !(sig == SIGURG && fown->signum == 0))
 			send_sigio(fown, fa, band);
 		fa = fa->fa_next;
 	}
--- include/linux/fs.h~	Fri Nov 27 11:53:44 1998
+++ include/linux/fs.h	Thu Dec  3 15:50:00 1998
@@ -693,11 +693,7 @@
 extern char * getname(const char * filename);
 extern void putname(char * name);
 
-#if 1
-extern void kill_fasync(struct fasync_struct *fa, int sig);
-#else
 extern void kill_fasync(struct fasync_struct *fa, int sig, int band);
-#endif
 extern int register_blkdev(unsigned int, const char *, struct file_operations *);
 extern int unregister_blkdev(unsigned int major, const char * name);
 extern int blkdev_open(struct inode * inode, struct file * filp);
--- include/linux/net.h~	Thu Nov 26 18:56:45 1998
+++ include/linux/net.h	Thu Dec  3 15:19:58 1998
@@ -126,7 +126,7 @@
 };
 
 extern struct net_proto_family *net_families[];
-extern int	sock_wake_async(struct socket *sk, int how);
+extern int	sock_wake_async(struct socket *sk, int how, int band);
 extern int	sock_register(struct net_proto_family *fam);
 extern int	sock_unregister(int family);
 extern struct socket *sock_alloc(void);
--- net/core/sock.c~	Thu Nov 26 18:48:03 1998
+++ net/core/sock.c	Thu Dec  3 15:22:04 1998
@@ -971,7 +971,7 @@
 {
 	if (!sk->dead) {
 		wake_up_interruptible(sk->sleep);
-		sock_wake_async(sk->socket,0); 
+		sock_wake_async(sk->socket,0,POLL_ERR); 
 	}
 }
 
@@ -979,7 +979,7 @@
 {
 	if(!sk->dead) {
 		wake_up_interruptible(sk->sleep);
-		sock_wake_async(sk->socket,1);
+		sock_wake_async(sk->socket,1,POLL_IN);
 	}
 }
 
@@ -994,7 +994,7 @@
 
 		/* Should agree with poll, otherwise some programs break */
 		if (sock_writeable(sk))
-			sock_wake_async(sk->socket, 2);
+			sock_wake_async(sk->socket, 2, POLL_OUT);
 	}
 }
 
--- net/ipv4/tcp.c~	Thu Nov 26 18:48:28 1998
+++ net/ipv4/tcp.c	Thu Dec  3 15:22:20 1998
@@ -615,7 +615,7 @@
 	wake_up_interruptible(sk->sleep);
 	if (sock_wspace(sk) >=
 	    tcp_min_write_space(sk))
-		sock_wake_async(sk->socket, 2);
+		sock_wake_async(sk->socket, 2, POLL_OUT);
 }
 
 
--- net/ipv4/tcp_input.c~	Thu Nov 26 18:48:28 1998
+++ net/ipv4/tcp_input.c	Thu Dec  3 15:49:56 1998
@@ -1079,7 +1079,7 @@
 
 	if (!sk->dead) {
 		sk->state_change(sk);
-		sock_wake_async(sk->socket, 1);
+		sock_wake_async(sk->socket, 1, POLL_HUP);
 	}
 
 	switch(sk->state) {
@@ -1618,6 +1618,7 @@
 			kill_proc(sk->proc, SIGURG, 1);
 		else
 			kill_pg(-sk->proc, SIGURG, 1);
+		sock_wake_async(sk, 3, POLL_URG);
 	}
 
 	/* We may be adding urgent data when the last byte read was
@@ -2105,7 +2106,7 @@
 
 			if(!sk->dead) {
 				sk->state_change(sk);
-				sock_wake_async(sk->socket, 0);
+				sock_wake_async(sk->socket, 0, POLL_IN);
 			}
 		} else {
 			if(th->syn && !th->rst) {
--- net/socket.c~	Thu Nov 26 18:48:52 1998
+++ net/socket.c	Thu Dec  3 15:44:40 1998
@@ -543,7 +543,7 @@
 	return 0;
 }
 
-int sock_wake_async(struct socket *sock, int how)
+int sock_wake_async(struct socket *sock, int how, int band)
 {
 	if (!sock || !sock->fasync_list)
 		return -1;
@@ -560,9 +560,13 @@
 		/* fall through */
 	case 0:
 	call_kill:
-		kill_fasync(sock->fasync_list, SIGIO);
+		kill_fasync(sock->fasync_list, SIGIO, band);
+		break;
+	case 3:
+		kill_fasync(sock->fasync_list, SIGURG, band);
 		break;
 	}
+	
 	return 0;
 }
 
--- net/unix/af_unix.c~	Sun Oct  4 18:19:40 1998
+++ net/unix/af_unix.c	Thu Dec  3 15:21:38 1998
@@ -1412,7 +1412,7 @@
 		return;
 	wake_up_interruptible(sk->sleep);
 	if (sk->sndbuf - (int)atomic_read(&sk->wmem_alloc) >= MIN_WRITE_SPACE)
-		sock_wake_async(sk->socket, 2);
+		sock_wake_async(sk->socket, 2, POLL_OUT);
 }
 
 #ifdef CONFIG_PROC_FS
--- net/x25/x25_in.c~	Mon Jul 27 07:35:58 1998
+++ net/x25/x25_in.c	Thu Dec  3 15:45:01 1998
@@ -278,6 +278,7 @@
 					kill_proc(sk->proc, SIGURG, 1);
 				else
 					kill_pg(-sk->proc, SIGURG, 1);
+				sock_wake_async(sk, 3, POLL_URG);
 			}
 			x25_write_internal(sk, X25_INTERRUPT_CONFIRMATION);
 			break;
