Source-Changes-HG archive

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

[src/trunk]: src/sys * have pr_stat return EOPNOTSUPP consistently for all pr...



details:   https://anonhg.NetBSD.org/src/rev/7b9256458f24
branches:  trunk
changeset: 797155:7b9256458f24
user:      rtr <rtr%NetBSD.org@localhost>
date:      Mon Jul 07 07:09:58 2014 +0000

description:
* have pr_stat return EOPNOTSUPP consistently for all protocols that do
  not fill in struct stat instead of returning success.

* in pr_stat remove all checks for non-NULL so->so_pcb except where the
  pcb is actually used (i.e. cases where we don't return EOPNOTSUPP).

proposed on tech-net@

diffstat:

 sys/netatalk/ddp_usrreq.c           |  13 +++----------
 sys/netbt/hci_socket.c              |  11 +++--------
 sys/netbt/l2cap_socket.c            |  11 +++--------
 sys/netbt/rfcomm_socket.c           |  11 +++--------
 sys/netbt/sco_socket.c              |  11 +++--------
 sys/netinet/raw_ip.c                |  13 +++----------
 sys/netinet/tcp_usrreq.c            |   7 +++----
 sys/netinet/udp_usrreq.c            |  13 +++----------
 sys/netinet6/raw_ip6.c              |   7 +++----
 sys/netinet6/udp6_usrreq.c          |  12 +++---------
 sys/netipsec/keysock.c              |   6 +++---
 sys/netnatm/natm.c                  |  13 +++----------
 sys/rump/net/lib/libsockin/sockin.c |   6 +++---
 13 files changed, 39 insertions(+), 95 deletions(-)

diffs (truncated from 407 to 300 lines):

diff -r 12ce0e257dc2 -r 7b9256458f24 sys/netatalk/ddp_usrreq.c
--- a/sys/netatalk/ddp_usrreq.c Sun Jul 06 21:14:43 2014 +0000
+++ b/sys/netatalk/ddp_usrreq.c Mon Jul 07 07:09:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ddp_usrreq.c,v 1.48 2014/07/06 03:33:33 rtr Exp $       */
+/*     $NetBSD: ddp_usrreq.c,v 1.49 2014/07/07 07:09:58 rtr Exp $       */
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.48 2014/07/06 03:33:33 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.49 2014/07/07 07:09:58 rtr Exp $");
 
 #include "opt_mbuftrace.h"
 
@@ -481,14 +481,7 @@
 static int
 ddp_stat(struct socket *so, struct stat *ub)
 {
-       struct ddpcb   *ddp;
-
-       ddp = sotoddpcb(so);
-       if (ddp == NULL)
-               return EINVAL;
-
-       /* Don't return block size. */
-       return 0;
+       return EOPNOTSUPP;
 }
 
 /*
diff -r 12ce0e257dc2 -r 7b9256458f24 sys/netbt/hci_socket.c
--- a/sys/netbt/hci_socket.c    Sun Jul 06 21:14:43 2014 +0000
+++ b/sys/netbt/hci_socket.c    Mon Jul 07 07:09:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hci_socket.c,v 1.27 2014/07/06 03:33:33 rtr Exp $      */
+/*     $NetBSD: hci_socket.c,v 1.28 2014/07/07 07:09:58 rtr Exp $      */
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hci_socket.c,v 1.27 2014/07/06 03:33:33 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_socket.c,v 1.28 2014/07/07 07:09:58 rtr Exp $");
 
 /* load symbolic names */
 #ifdef BLUETOOTH_DEBUG
@@ -496,12 +496,7 @@
 static int
 hci_stat(struct socket *so, struct stat *ub)
 {
-       struct hci_pcb *pcb = (struct hci_pcb *)so->so_pcb;
-
-       if (pcb == NULL)
-               return EINVAL;
-
-       return 0;
+       return EOPNOTSUPP;
 }
 
 /*
diff -r 12ce0e257dc2 -r 7b9256458f24 sys/netbt/l2cap_socket.c
--- a/sys/netbt/l2cap_socket.c  Sun Jul 06 21:14:43 2014 +0000
+++ b/sys/netbt/l2cap_socket.c  Mon Jul 07 07:09:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: l2cap_socket.c,v 1.18 2014/07/06 03:33:33 rtr Exp $    */
+/*     $NetBSD: l2cap_socket.c,v 1.19 2014/07/07 07:09:58 rtr Exp $    */
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: l2cap_socket.c,v 1.18 2014/07/06 03:33:33 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: l2cap_socket.c,v 1.19 2014/07/07 07:09:58 rtr Exp $");
 
 /* load symbolic names */
 #ifdef BLUETOOTH_DEBUG
@@ -125,12 +125,7 @@
 static int
 l2cap_stat(struct socket *so, struct stat *ub)
 {
-       struct l2cap_channel *pcb = so->so_pcb;
-
-       if (pcb == NULL)
-               return EINVAL;
-
-       return 0;
+       return EOPNOTSUPP;
 }
 
 /*
diff -r 12ce0e257dc2 -r 7b9256458f24 sys/netbt/rfcomm_socket.c
--- a/sys/netbt/rfcomm_socket.c Sun Jul 06 21:14:43 2014 +0000
+++ b/sys/netbt/rfcomm_socket.c Mon Jul 07 07:09:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rfcomm_socket.c,v 1.19 2014/07/06 03:33:33 rtr Exp $   */
+/*     $NetBSD: rfcomm_socket.c,v 1.20 2014/07/07 07:09:58 rtr Exp $   */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rfcomm_socket.c,v 1.19 2014/07/06 03:33:33 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rfcomm_socket.c,v 1.20 2014/07/07 07:09:58 rtr Exp $");
 
 /* load symbolic names */
 #ifdef BLUETOOTH_DEBUG
@@ -133,12 +133,7 @@
 static int
 rfcomm_stat(struct socket *so, struct stat *ub)
 {
-       struct rfcomm_dlc *pcb = so->so_pcb;
-
-       if (pcb == NULL)
-               return EINVAL;
-
-       return 0;
+       return EOPNOTSUPP;
 }
 
 /*
diff -r 12ce0e257dc2 -r 7b9256458f24 sys/netbt/sco_socket.c
--- a/sys/netbt/sco_socket.c    Sun Jul 06 21:14:43 2014 +0000
+++ b/sys/netbt/sco_socket.c    Mon Jul 07 07:09:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sco_socket.c,v 1.20 2014/07/06 03:33:33 rtr Exp $      */
+/*     $NetBSD: sco_socket.c,v 1.21 2014/07/07 07:09:58 rtr Exp $      */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sco_socket.c,v 1.20 2014/07/06 03:33:33 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sco_socket.c,v 1.21 2014/07/07 07:09:58 rtr Exp $");
 
 /* load symbolic names */
 #ifdef BLUETOOTH_DEBUG
@@ -116,12 +116,7 @@
 static int
 sco_stat(struct socket *so, struct stat *ub)
 {
-       struct sco_pcb *pcb = (struct sco_pcb *)so->so_pcb;
-
-       if (pcb == NULL)
-               return EINVAL;
-
-       return 0;
+       return EOPNOTSUPP;
 }
 
 /*
diff -r 12ce0e257dc2 -r 7b9256458f24 sys/netinet/raw_ip.c
--- a/sys/netinet/raw_ip.c      Sun Jul 06 21:14:43 2014 +0000
+++ b/sys/netinet/raw_ip.c      Mon Jul 07 07:09:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: raw_ip.c,v 1.128 2014/07/06 03:33:33 rtr Exp $ */
+/*     $NetBSD: raw_ip.c,v 1.129 2014/07/07 07:09:58 rtr Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.128 2014/07/06 03:33:33 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.129 2014/07/07 07:09:58 rtr Exp $");
 
 #include "opt_inet.h"
 #include "opt_compat_netbsd.h"
@@ -575,14 +575,7 @@
 static int
 rip_stat(struct socket *so, struct stat *ub)
 {
-       struct inpcb *inp;
-
-       inp = sotoinpcb(so);
-       if (inp == NULL)
-               return EINVAL;
-
-       /* stat: don't bother with a blocksize. */
-       return 0;
+       return EOPNOTSUPP;
 }
 
 int
diff -r 12ce0e257dc2 -r 7b9256458f24 sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c  Sun Jul 06 21:14:43 2014 +0000
+++ b/sys/netinet/tcp_usrreq.c  Mon Jul 07 07:09:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_usrreq.c,v 1.181 2014/07/06 03:33:33 rtr Exp $     */
+/*     $NetBSD: tcp_usrreq.c,v 1.182 2014/07/07 07:09:58 rtr Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -99,7 +99,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.181 2014/07/06 03:33:33 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.182 2014/07/07 07:09:58 rtr Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -956,8 +956,7 @@
 static int
 tcp_stat(struct socket *so, struct stat *ub)
 {
-       /* stat: don't bother with a blocksize.  */
-       return 0;
+       return EOPNOTSUPP;
 }
 
 /*
diff -r 12ce0e257dc2 -r 7b9256458f24 sys/netinet/udp_usrreq.c
--- a/sys/netinet/udp_usrreq.c  Sun Jul 06 21:14:43 2014 +0000
+++ b/sys/netinet/udp_usrreq.c  Mon Jul 07 07:09:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: udp_usrreq.c,v 1.203 2014/07/06 03:33:33 rtr Exp $     */
+/*     $NetBSD: udp_usrreq.c,v 1.204 2014/07/07 07:09:58 rtr Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.203 2014/07/06 03:33:33 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.204 2014/07/07 07:09:58 rtr Exp $");
 
 #include "opt_inet.h"
 #include "opt_compat_netbsd.h"
@@ -903,14 +903,7 @@
 static int
 udp_stat(struct socket *so, struct stat *ub)
 {
-       struct inpcb *inp;
-
-       inp = sotoinpcb(so);
-       if (inp == NULL)
-               return EINVAL;
-
-       /* stat: don't bother with a blocksize. */
-       return 0;
+       return EOPNOTSUPP;
 }
 
 static int
diff -r 12ce0e257dc2 -r 7b9256458f24 sys/netinet6/raw_ip6.c
--- a/sys/netinet6/raw_ip6.c    Sun Jul 06 21:14:43 2014 +0000
+++ b/sys/netinet6/raw_ip6.c    Mon Jul 07 07:09:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: raw_ip6.c,v 1.122 2014/07/06 03:33:33 rtr Exp $        */
+/*     $NetBSD: raw_ip6.c,v 1.123 2014/07/07 07:09:59 rtr Exp $        */
 /*     $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $        */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.122 2014/07/06 03:33:33 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.123 2014/07/07 07:09:59 rtr Exp $");
 
 #include "opt_ipsec.h"
 
@@ -653,8 +653,7 @@
 static int
 rip6_stat(struct socket *so, struct stat *ub)
 {
-       /* stat: don't bother with a blocksize */
-       return 0;
+       return EOPNOTSUPP;
 }
 
 int
diff -r 12ce0e257dc2 -r 7b9256458f24 sys/netinet6/udp6_usrreq.c
--- a/sys/netinet6/udp6_usrreq.c        Sun Jul 06 21:14:43 2014 +0000
+++ b/sys/netinet6/udp6_usrreq.c        Mon Jul 07 07:09:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: udp6_usrreq.c,v 1.102 2014/07/06 03:33:33 rtr Exp $    */
+/*     $NetBSD: udp6_usrreq.c,v 1.103 2014/07/07 07:09:59 rtr Exp $    */
 /*     $KAME: udp6_usrreq.c,v 1.86 2001/05/27 17:33:00 itojun Exp $    */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.102 2014/07/06 03:33:33 rtr Exp $");



Home | Main Index | Thread Index | Old Index