added sowakeup() function for ASYNC notification via SIGIO
authorEric Cooper <cooper@ucbvax.Berkeley.EDU>
Thu, 12 Jan 1984 07:57:52 +0000 (23:57 -0800)
committerEric Cooper <cooper@ucbvax.Berkeley.EDU>
Thu, 12 Jan 1984 07:57:52 +0000 (23:57 -0800)
SCCS-vsn: sys/kern/uipc_socket2.c 6.2

usr/src/sys/kern/uipc_socket2.c

index 9e6aa33..b7faa64 100644 (file)
@@ -1,4 +1,4 @@
-/*     uipc_socket2.c  6.1     83/07/29        */
+/*     uipc_socket2.c  6.2     84/01/11        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -254,6 +254,28 @@ sbwakeup(sb)
        }
 }
 
        }
 }
 
+/*
+ * Wakeup socket readers and writers.
+ * Do asynchronous notification via SIGIO
+ * if the socket has the SS_ASYNC flag set.
+ */
+sowakeup(so, sb)
+       register struct socket *so;
+       struct sockbuf *sb;
+{
+       register struct proc *p;
+
+       sbwakeup(sb);
+       if (so->so_state & SS_ASYNC) {
+               if (so->so_pgrp == 0)
+                       return;
+               else if (so->so_pgrp > 0)
+                       gsignal(so->so_pgrp, SIGIO);
+               else if ((p = pfind(-so->so_pgrp)) != 0)
+                       psignal(p, SIGIO);
+       }
+}
+
 /*
  * Socket buffer (struct sockbuf) utility routines.
  *
 /*
  * Socket buffer (struct sockbuf) utility routines.
  *