Source-Changes-HG archive

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

[src/trunk]: src/sys implement the recently introduced EMUL_BSD_ASYNCIO_PIPE ...



details:   https://anonhg.NetBSD.org/src/rev/98dd2ead9aa3
branches:  trunk
changeset: 509531:98dd2ead9aa3
user:      manu <manu%NetBSD.org@localhost>
date:      Sun May 06 19:22:32 2001 +0000

description:
implement the recently introduced EMUL_BSD_ASYNCIO_PIPE emulation package
flag.

EMUL_BSD_ASYNCIO_PIPE notes that the emulated binaries expect the original
BSD pipe behavior for asynchronous I/O, which is to fire SIGIO on read() and
write(). OSes without this flag do not expect any SIGIO to be fired on
read() and write() for pipes, even when async I/O was requested. As far as
we know, the OSes that need EMUL_BSD_ASYNCIO_PIPE are NetBSD, OSF/1 and
Darwin.

diffstat:

 sys/kern/sys_socket.c    |  23 +++++++++++++----------
 sys/kern/uipc_syscalls.c |   5 ++++-
 sys/sys/socketvar.h      |   3 ++-
 3 files changed, 19 insertions(+), 12 deletions(-)

diffs (80 lines):

diff -r f659c413b5a6 -r 98dd2ead9aa3 sys/kern/sys_socket.c
--- a/sys/kern/sys_socket.c     Sun May 06 19:09:52 2001 +0000
+++ b/sys/kern/sys_socket.c     Sun May 06 19:22:32 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_socket.c,v 1.24 2001/04/09 10:22:02 jdolecek Exp $ */
+/*     $NetBSD: sys_socket.c,v 1.25 2001/05/06 19:22:32 manu Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -45,6 +45,7 @@
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/poll.h>
+#include <sys/proc.h>
 
 #include <net/if.h>
 #include <net/route.h>
@@ -99,15 +100,17 @@
                return (0);
 
        case FIOASYNC:
-               if (*(int *)data) {
-                       so->so_state |= SS_ASYNC;
-                       so->so_rcv.sb_flags |= SB_ASYNC;
-                       so->so_snd.sb_flags |= SB_ASYNC;
-               } else {
-                       so->so_state &= ~SS_ASYNC;
-                       so->so_rcv.sb_flags &= ~SB_ASYNC;
-                       so->so_snd.sb_flags &= ~SB_ASYNC;
-               }
+               if ((!(so->so_state & SS_ISAPIPE) ||
+                   (p->p_emul->e_flags & EMUL_BSD_ASYNCIO_PIPE)) &&
+                        (*(int *)data)) {
+                               so->so_state |= SS_ASYNC;
+                               so->so_rcv.sb_flags |= SB_ASYNC;
+                               so->so_snd.sb_flags |= SB_ASYNC;
+                       } else {
+                               so->so_state &= ~SS_ASYNC;
+                               so->so_rcv.sb_flags &= ~SB_ASYNC;
+                               so->so_snd.sb_flags &= ~SB_ASYNC;
+                       }
                return (0);
 
        case FIONREAD:
diff -r f659c413b5a6 -r 98dd2ead9aa3 sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c  Sun May 06 19:09:52 2001 +0000
+++ b/sys/kern/uipc_syscalls.c  Sun May 06 19:22:32 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls.c,v 1.57 2001/02/27 05:19:15 lukem Exp $ */
+/*     $NetBSD: uipc_syscalls.c,v 1.58 2001/05/06 19:22:33 manu Exp $  */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -922,6 +922,9 @@
                return (error);
        if ((error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0)) != 0)
                goto free1;
+       /* remember this socket pair implements a pipe */
+       wso->so_state |= SS_ISAPIPE;
+       rso->so_state |= SS_ISAPIPE;
        /* falloc() will use the descriptor for us */
        if ((error = falloc(p, &rf, &fd)) != 0)
                goto free2;
diff -r f659c413b5a6 -r 98dd2ead9aa3 sys/sys/socketvar.h
--- a/sys/sys/socketvar.h       Sun May 06 19:09:52 2001 +0000
+++ b/sys/sys/socketvar.h       Sun May 06 19:22:32 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: socketvar.h,v 1.45 2001/04/30 01:13:21 lukem Exp $     */
+/*     $NetBSD: socketvar.h,v 1.46 2001/05/06 19:22:33 manu Exp $      */
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -143,6 +143,7 @@
                                         * hint from sosend to lower layer;
                                         * more data coming
                                         */
+#define        SS_ISAPIPE              0x800 /* socket is implementing a pipe */
 
 
 /*



Home | Main Index | Thread Index | Old Index