Source-Changes-HG archive

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

[src/trunk]: src/sys/kern PR/47569: Valery Ushakov: SOCK_NONBLOCK does not wo...



details:   https://anonhg.NetBSD.org/src/rev/dcc73020365e
branches:  trunk
changeset: 784947:dcc73020365e
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Feb 14 21:57:58 2013 +0000

description:
PR/47569: Valery Ushakov: SOCK_NONBLOCK does not work because it does not
set SS_NBIO.
XXX: there are too many flags that mean the same thing in too many places,
and too many flags that mean the same thing and are different.

diffstat:

 sys/kern/uipc_socket.c   |  6 ++++--
 sys/kern/uipc_syscalls.c |  8 ++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diffs (63 lines):

diff -r 6b1d3e2860ca -r dcc73020365e sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c    Thu Feb 14 21:29:35 2013 +0000
+++ b/sys/kern/uipc_socket.c    Thu Feb 14 21:57:58 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_socket.c,v 1.212 2012/10/08 19:20:45 pooka Exp $  */
+/*     $NetBSD: uipc_socket.c,v 1.213 2013/02/14 21:57:58 christos Exp $       */
 
 /*-
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.212 2012/10/08 19:20:45 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.213 2013/02/14 21:57:58 christos Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_sock_counters.h"
@@ -585,6 +585,8 @@
                fp->f_data = so;
                fd_affix(curproc, fp, fd);
                *fdout = fd;
+               if (flags & SOCK_NONBLOCK)
+                       so->so_state |= SS_NBIO;
        }
        return error;
 }
diff -r 6b1d3e2860ca -r dcc73020365e sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c  Thu Feb 14 21:29:35 2013 +0000
+++ b/sys/kern/uipc_syscalls.c  Thu Feb 14 21:57:58 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls.c,v 1.159 2013/02/14 01:00:07 riastradh Exp $    */
+/*     $NetBSD: uipc_syscalls.c,v 1.160 2013/02/14 21:57:59 christos Exp $     */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.159 2013/02/14 01:00:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.160 2013/02/14 21:57:59 christos Exp $");
 
 #include "opt_pipe.h"
 
@@ -234,6 +234,8 @@
            ((flags & SOCK_NOSIGPIPE) ? FNOSIGPIPE : 0);
        fp2->f_ops = &socketops;
        fp2->f_data = so2;
+       if (flags & SOCK_NONBLOCK)
+               so2->so_state |= SS_NBIO;
        error = soaccept(so2, nam);
        so2->so_cred = kauth_cred_dup(so->so_cred);
        sounlock(so);
@@ -424,6 +426,8 @@
        (*fp)->f_type = DTYPE_SOCKET;
        (*fp)->f_ops = &socketops;
        (*fp)->f_data = so;
+       if (flags & SOCK_NONBLOCK)
+               so->so_state |= SS_NBIO;
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index