Source-Changes-HG archive

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

[src/netbsd-8]: src Pull up following revision(s) (requested by hannken in ti...



details:   https://anonhg.NetBSD.org/src/rev/b07c5a88d245
branches:  netbsd-8
changeset: 852105:b07c5a88d245
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Nov 12 09:43:19 2018 +0000

description:
Pull up following revision(s) (requested by hannken in ticket #1089):

        external/bsd/nsd/include/config.h: revision 1.5
        sys/kern/uipc_syscalls.c: revision 1.198
        sys/kern/uipc_syscalls.c: revision 1.199
        sys/kern/uipc_socket.c: revision 1.267

Update getsockopt(SO_ERROR) to behave like soreceive() and
return and clear so->so_rerror if so->so_error is zero.

Ok: christos@

 -

Don't defer errors from sendmmsg().  This matches the linux manpage.

Defer errors from recvmmsg() through so_rerror and
tests and return a deferred error on entry.

Ok: christos@

 -

sys_recvmmsg: don't defer an error that already gets returned.

 -

Re-enable {send,recv}mmsg now they are working.

diffstat:

 external/bsd/nsd/include/config.h |   2 --
 sys/kern/uipc_socket.c            |   8 ++++++--
 sys/kern/uipc_syscalls.c          |  33 ++++++++++++++++++++-------------
 3 files changed, 26 insertions(+), 17 deletions(-)

diffs (122 lines):

diff -r 4c8db9c235b0 -r b07c5a88d245 external/bsd/nsd/include/config.h
--- a/external/bsd/nsd/include/config.h Mon Nov 12 08:57:23 2018 +0000
+++ b/external/bsd/nsd/include/config.h Mon Nov 12 09:43:19 2018 +0000
@@ -233,13 +233,11 @@
 /* Define to 1 if you have the `reallocarray' function. */
 #define HAVE_REALLOCARRAY 1
 
-#ifdef notyet
 /* Define if recvmmsg is implemented */
 #define HAVE_RECVMMSG 1
 
 /* Define if sendmmsg is implemented */
 #define HAVE_SENDMMSG 1
-#endif
 
 /* Define to 1 if you have the `setregid' function. */
 #define HAVE_SETREGID 1
diff -r 4c8db9c235b0 -r b07c5a88d245 sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c    Mon Nov 12 08:57:23 2018 +0000
+++ b/sys/kern/uipc_socket.c    Mon Nov 12 09:43:19 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_socket.c,v 1.255.2.3 2018/06/09 15:16:30 martin Exp $     */
+/*     $NetBSD: uipc_socket.c,v 1.255.2.4 2018/11/12 09:43:19 martin Exp $     */
 
 /*-
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.255.2.3 2018/06/09 15:16:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.255.2.4 2018/11/12 09:43:19 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1970,6 +1970,10 @@
                break;
 
        case SO_ERROR:
+               if (so->so_error == 0) {
+                       so->so_error = so->so_rerror;
+                       so->so_rerror = 0;
+               }
                error = sockopt_setint(sopt, so->so_error);
                so->so_error = 0;
                break;
diff -r 4c8db9c235b0 -r b07c5a88d245 sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c  Mon Nov 12 08:57:23 2018 +0000
+++ b/sys/kern/uipc_syscalls.c  Mon Nov 12 09:43:19 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls.c,v 1.186.6.1 2018/03/18 10:57:01 martin Exp $   */
+/*     $NetBSD: uipc_syscalls.c,v 1.186.6.2 2018/11/12 09:43:19 martin 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.186.6.1 2018/03/18 10:57:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.186.6.2 2018/11/12 09:43:19 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pipe.h"
@@ -809,14 +809,11 @@
        }
 
        *retval = dg;
-       if (error)
-               so->so_error = error;
 
        fd_putfile(s);
 
        /*
-        * If we succeeded at least once, return 0, hopefully so->so_error
-        * will catch it next time.
+        * If we succeeded at least once, return 0.
         */
        if (dg)
                return 0;
@@ -1062,6 +1059,16 @@
        if ((error = fd_getsock(s, &so)) != 0)
                return error;
 
+       /*
+        * If so->so_rerror holds a deferred error return it now.
+        */
+       if (so->so_rerror) {
+               error = so->so_rerror;
+               so->so_rerror = 0;
+               fd_putfile(s);
+               return error;
+       }
+
        vlen = SCARG(uap, vlen);
        if (vlen > 1024)
                vlen = 1024;
@@ -1126,17 +1133,17 @@
                m_free(from);
 
        *retval = dg;
-       if (error)
-               so->so_error = error;
-
-       fd_putfile(s);
 
        /*
-        * If we succeeded at least once, return 0, hopefully so->so_error
+        * If we succeeded at least once, return 0, hopefully so->so_rerror
         * will catch it next time.
         */
-       if (dg)
-               return 0;
+       if (error && dg > 0) {
+               so->so_rerror = error;
+               error = 0;
+       }
+
+       fd_putfile(s);
 
        return error;
 }



Home | Main Index | Thread Index | Old Index