Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Separate receive socket errors from general socket errors.
details: https://anonhg.NetBSD.org/src/rev/6793fc9377c4
branches: trunk
changeset: 362369:6793fc9377c4
user: roy <roy%NetBSD.org@localhost>
date: Wed Jun 06 09:46:46 2018 +0000
description:
Separate receive socket errors from general socket errors.
diffstat:
sys/kern/uipc_socket.c | 20 +++++++++++++-------
sys/kern/uipc_socket2.c | 6 +++---
sys/sys/socketvar.h | 3 ++-
3 files changed, 18 insertions(+), 11 deletions(-)
diffs (101 lines):
diff -r 6b715bcd0c0a -r 6793fc9377c4 sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c Wed Jun 06 03:09:12 2018 +0000
+++ b/sys/kern/uipc_socket.c Wed Jun 06 09:46:46 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_socket.c,v 1.263 2018/04/26 19:50:09 maxv Exp $ */
+/* $NetBSD: uipc_socket.c,v 1.264 2018/06/06 09:46:46 roy 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.263 2018/04/26 19:50:09 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.264 2018/06/06 09:46:46 roy Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -1240,11 +1240,16 @@
if (m == NULL && so->so_rcv.sb_cc)
panic("receive 1");
#endif
- if (so->so_error) {
+ if (so->so_error || so->so_rerror) {
if (m != NULL)
goto dontblock;
- error = so->so_error;
- so->so_error = 0;
+ if (so->so_error) {
+ error = so->so_error;
+ so->so_error = 0;
+ } else {
+ error = so->so_rerror;
+ so->so_rerror = 0;
+ }
goto release;
}
if (so->so_state & SS_CANTRCVMORE) {
@@ -1564,7 +1569,8 @@
*/
while (flags & MSG_WAITALL && m == NULL && uio->uio_resid > 0 &&
!sosendallatonce(so) && !nextrecord) {
- if (so->so_error || so->so_state & SS_CANTRCVMORE)
+ if (so->so_error || so->so_rerror ||
+ so->so_state & SS_CANTRCVMORE)
break;
/*
* If we are peeking and the socket receive buffer is
@@ -2250,7 +2256,7 @@
kn->kn_flags |= EV_EOF;
kn->kn_fflags = so->so_error;
rv = 1;
- } else if (so->so_error)
+ } else if (so->so_error || so->so_rerror)
rv = 1;
else if (kn->kn_sfflags & NOTE_LOWAT)
rv = (kn->kn_data >= kn->kn_sdata);
diff -r 6b715bcd0c0a -r 6793fc9377c4 sys/kern/uipc_socket2.c
--- a/sys/kern/uipc_socket2.c Wed Jun 06 03:09:12 2018 +0000
+++ b/sys/kern/uipc_socket2.c Wed Jun 06 09:46:46 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_socket2.c,v 1.129 2018/04/29 07:13:10 maxv Exp $ */
+/* $NetBSD: uipc_socket2.c,v 1.130 2018/06/06 09:46:46 roy Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.129 2018/04/29 07:13:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.130 2018/06/06 09:46:46 roy Exp $");
#ifdef _KERNEL_OPT
#include "opt_mbuftrace.h"
@@ -504,7 +504,7 @@
KASSERT(solocked(so));
so->so_rcv.sb_overflowed++;
- so->so_error = ENOBUFS;
+ so->so_rerror = ENOBUFS;
sorwakeup(so);
}
diff -r 6b715bcd0c0a -r 6793fc9377c4 sys/sys/socketvar.h
--- a/sys/sys/socketvar.h Wed Jun 06 03:09:12 2018 +0000
+++ b/sys/sys/socketvar.h Wed Jun 06 09:46:46 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: socketvar.h,v 1.155 2018/05/04 08:35:07 christos Exp $ */
+/* $NetBSD: socketvar.h,v 1.156 2018/06/06 09:46:46 roy Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -160,6 +160,7 @@
short so_qlimit; /* max number queued connections */
short so_timeo; /* connection timeout */
u_short so_error; /* error affecting connection */
+ u_short so_rerror; /* error affecting receiving */
u_short so_aborting; /* references from soabort() */
pid_t so_pgid; /* pgid for signals */
u_long so_oobmark; /* chars to oob mark */
Home |
Main Index |
Thread Index |
Old Index