Source-Changes-HG archive

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

[src/trunk]: src/sys/compat Apply the recent fixes to {send, recv}mmsg() to th...



details:   https://anonhg.NetBSD.org/src/rev/a0bd98262f5e
branches:  trunk
changeset: 445836:a0bd98262f5e
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed Nov 14 17:51:37 2018 +0000

description:
Apply the recent fixes to {send,recv}mmsg() to their compat variants.

diffstat:

 sys/compat/linux/common/linux_socket.c |  37 ++++++++++++++++++++-------------
 sys/compat/netbsd32/netbsd32_socket.c  |  33 ++++++++++++++++++-----------
 2 files changed, 42 insertions(+), 28 deletions(-)

diffs (154 lines):

diff -r 2bc5a76031b7 -r a0bd98262f5e sys/compat/linux/common/linux_socket.c
--- a/sys/compat/linux/common/linux_socket.c    Wed Nov 14 17:09:08 2018 +0000
+++ b/sys/compat/linux/common/linux_socket.c    Wed Nov 14 17:51:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_socket.c,v 1.142 2018/05/10 01:32:24 ozaki-r Exp $       */
+/*     $NetBSD: linux_socket.c,v 1.143 2018/11/14 17:51:37 hannken Exp $       */
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.142 2018/05/10 01:32:24 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.143 2018/11/14 17:51:37 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1801,14 +1801,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;
@@ -1849,6 +1846,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;
@@ -1919,17 +1926,17 @@
                m_free(from);
 
        *retval = dg;
-       if (error)
-               so->so_error = error;
+
+       /*
+        * If we succeeded at least once, return 0, hopefully so->so_rerror
+        * will catch it next time.
+        */
+       if (error && dg > 0) {
+               so->so_rerror = error;
+               error = 0;
+       }
 
        fd_putfile(s);
 
-       /*
-        * If we succeeded at least once, return 0, hopefully so->so_error
-        * will catch it next time.
-        */
-       if (dg)
-               return 0;
-
        return error;
 }
diff -r 2bc5a76031b7 -r a0bd98262f5e sys/compat/netbsd32/netbsd32_socket.c
--- a/sys/compat/netbsd32/netbsd32_socket.c     Wed Nov 14 17:09:08 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32_socket.c     Wed Nov 14 17:51:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_socket.c,v 1.48 2018/11/12 06:53:43 maxv Exp $        */
+/*     $NetBSD: netbsd32_socket.c,v 1.49 2018/11/14 17:51:37 hannken Exp $     */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.48 2018/11/12 06:53:43 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.49 2018/11/14 17:51:37 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -289,6 +289,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;
@@ -350,17 +360,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;
 }
@@ -597,14 +607,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;



Home | Main Index | Thread Index | Old Index