Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Don't defer errors from sendmmsg(). This matches t...



details:   https://anonhg.NetBSD.org/src/rev/9a6983855522
branches:  trunk
changeset: 445645:9a6983855522
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed Nov 07 09:59:12 2018 +0000

description:
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@

diffstat:

 sys/kern/uipc_syscalls.c |  24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diffs (68 lines):

diff -r 6fa050fd460f -r 9a6983855522 sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c  Wed Nov 07 09:58:19 2018 +0000
+++ b/sys/kern/uipc_syscalls.c  Wed Nov 07 09:59:12 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls.c,v 1.197 2018/09/03 16:29:35 riastradh Exp $    */
+/*     $NetBSD: uipc_syscalls.c,v 1.198 2018/11/07 09:59:12 hannken 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.197 2018/09/03 16:29:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.198 2018/11/07 09:59:12 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pipe.h"
@@ -806,14 +806,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;
@@ -1052,6 +1049,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;
@@ -1116,13 +1123,14 @@
                m_free(from);
 
        *retval = dg;
+
        if (error)
-               so->so_error = error;
+               so->so_rerror = 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)



Home | Main Index | Thread Index | Old Index