Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Use SB_ASYNC in struct sockbuf sb_flags field inste...



details:   https://anonhg.NetBSD.org/src/rev/01887cc1b043
branches:  trunk
changeset: 511290:01887cc1b043
user:      manu <manu%NetBSD.org@localhost>
date:      Sat Jun 16 21:29:32 2001 +0000

description:
Use SB_ASYNC in struct sockbuf sb_flags field instead of SS_ASYNC in
struct socket so_state field to decide if we need to send asynchronous
notifications. This makes possible to request notification on write but
not on read, and vice versa.

This is used in Linux emulation code, because when async I/O is requested,
Linux does not send SIGIO to write end of sockets, and it never send any
SIGIO to any end of pipes. Il Linux emulation code, we then set SB_ASYNC
only on the read end of sockets, and on no end for pipes.

diffstat:

 sys/kern/sys_socket.c   |  9 ++-------
 sys/kern/uipc_socket2.c |  6 +++---
 2 files changed, 5 insertions(+), 10 deletions(-)

diffs (50 lines):

diff -r 47475fd11b64 -r 01887cc1b043 sys/kern/sys_socket.c
--- a/sys/kern/sys_socket.c     Sat Jun 16 14:33:08 2001 +0000
+++ b/sys/kern/sys_socket.c     Sat Jun 16 21:29:32 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_socket.c,v 1.30 2001/05/19 17:28:33 manu Exp $     */
+/*     $NetBSD: sys_socket.c,v 1.31 2001/06/16 21:29:32 manu Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -100,12 +100,7 @@
                return (0);
 
        case FIOASYNC:
-               if (
-#ifndef __HAVE_MINIMAL_EMUL
-                   (!(so->so_state & SS_ISAPIPE) ||
-                   (!(p->p_emul->e_flags & EMUL_NO_BSD_ASYNCIO_PIPE))) &&
-#endif
-                   *(int *)data) {
+               if (*(int *)data) {
                        so->so_state |= SS_ASYNC;
                        so->so_rcv.sb_flags |= SB_ASYNC;
                        so->so_snd.sb_flags |= SB_ASYNC;
diff -r 47475fd11b64 -r 01887cc1b043 sys/kern/uipc_socket2.c
--- a/sys/kern/uipc_socket2.c   Sat Jun 16 14:33:08 2001 +0000
+++ b/sys/kern/uipc_socket2.c   Sat Jun 16 21:29:32 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_socket2.c,v 1.38 2001/04/30 03:32:56 kml Exp $    */
+/*     $NetBSD: uipc_socket2.c,v 1.39 2001/06/16 21:29:32 manu Exp $   */
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1990, 1993
@@ -290,7 +290,7 @@
 /*
  * Wakeup processes waiting on a socket buffer.
  * Do asynchronous notification via SIGIO
- * if the socket has the SS_ASYNC flag set.
+ * if the socket buffer has the SB_ASYNC flag set.
  */
 void
 sowakeup(struct socket *so, struct sockbuf *sb)
@@ -303,7 +303,7 @@
                sb->sb_flags &= ~SB_WAIT;
                wakeup((caddr_t)&sb->sb_cc);
        }
-       if (so->so_state & SS_ASYNC) {
+       if (sb->sb_flags & SB_ASYNC) {
                if (so->so_pgid < 0)
                        gsignal(-so->so_pgid, SIGIO);
                else if (so->so_pgid > 0 && (p = pfind(so->so_pgid)) != 0)



Home | Main Index | Thread Index | Old Index