diff options
| author | rtr <rtr@NetBSD.org> | 2014-07-07 07:09:58 +0000 |
|---|---|---|
| committer | rtr <rtr@NetBSD.org> | 2014-07-07 07:09:58 +0000 |
| commit | 302da5ea96433beb2e2c1b1e36d34dc01eeec0b0 (patch) | |
| tree | a2599318c5ddd5f6ff5e7aef45f25d0fb2e04ee6 | |
| parent | 65876e3759ee13c1269128ba04cc1e81aa6899b1 (diff) | |
* 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@
| -rw-r--r-- | sys/netatalk/ddp_usrreq.c | 13 | ||||
| -rw-r--r-- | sys/netbt/hci_socket.c | 11 | ||||
| -rw-r--r-- | sys/netbt/l2cap_socket.c | 11 | ||||
| -rw-r--r-- | sys/netbt/rfcomm_socket.c | 11 | ||||
| -rw-r--r-- | sys/netbt/sco_socket.c | 11 | ||||
| -rw-r--r-- | sys/netinet/raw_ip.c | 13 | ||||
| -rw-r--r-- | sys/netinet/tcp_usrreq.c | 7 | ||||
| -rw-r--r-- | sys/netinet/udp_usrreq.c | 13 | ||||
| -rw-r--r-- | sys/netinet6/raw_ip6.c | 7 | ||||
| -rw-r--r-- | sys/netinet6/udp6_usrreq.c | 12 | ||||
| -rw-r--r-- | sys/netipsec/keysock.c | 6 | ||||
| -rw-r--r-- | sys/netnatm/natm.c | 13 | ||||
| -rw-r--r-- | sys/rump/net/lib/libsockin/sockin.c | 6 |
13 files changed, 39 insertions, 95 deletions
diff --git a/sys/netatalk/ddp_usrreq.c b/sys/netatalk/ddp_usrreq.c index 8b1ca425899..0c361d3af5d 100644 --- a/sys/netatalk/ddp_usrreq.c +++ b/sys/netatalk/ddp_usrreq.c @@ -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 @@ ddp_ioctl(struct socket *so, u_long cmd, void *addr, struct ifnet *ifp) 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 --git a/sys/netbt/hci_socket.c b/sys/netbt/hci_socket.c index 75155702087..e164a047320 100644 --- a/sys/netbt/hci_socket.c +++ b/sys/netbt/hci_socket.c @@ -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 @@ hci_ioctl(struct socket *up, u_long cmd, void *nam, struct ifnet *ifp) 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 --git a/sys/netbt/l2cap_socket.c b/sys/netbt/l2cap_socket.c index 6fe146c04e2..874e55b1cd6 100644 --- a/sys/netbt/l2cap_socket.c +++ b/sys/netbt/l2cap_socket.c @@ -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 @@ l2cap_ioctl(struct socket *up, u_long cmd, void *nam, struct ifnet *ifp) 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 --git a/sys/netbt/rfcomm_socket.c b/sys/netbt/rfcomm_socket.c index 442a0079bac..31416ad1963 100644 --- a/sys/netbt/rfcomm_socket.c +++ b/sys/netbt/rfcomm_socket.c @@ -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 @@ rfcomm_ioctl(struct socket *up, u_long cmd, void *nam, struct ifnet *ifp) 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 --git a/sys/netbt/sco_socket.c b/sys/netbt/sco_socket.c index 501f0b05158..5972d06f9e4 100644 --- a/sys/netbt/sco_socket.c +++ b/sys/netbt/sco_socket.c @@ -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 @@ sco_ioctl(struct socket *up, u_long cmd, void *nam, struct ifnet *ifp) 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 --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 6adae90a1cb..d8560ea0f7c 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -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 @@ rip_ioctl(struct socket *so, u_long cmd, void *nam, struct ifnet *ifp) 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 --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 75e7343f2b7..da157adb2cd 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -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 @@ tcp_ioctl(struct socket *so, u_long cmd, void *nam, struct ifnet *ifp) static int tcp_stat(struct socket *so, struct stat *ub) { - /* stat: don't bother with a blocksize. */ - return 0; + return EOPNOTSUPP; } /* diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 25db2582bf2..9b0ef56ee49 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -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 @@ udp_ioctl(struct socket *so, u_long cmd, void *nam, struct ifnet *ifp) 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 --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 89532848be5..689ff650383 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -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 @@ rip6_ioctl(struct socket *so, u_long cmd, void *nam, struct ifnet *ifp) static int rip6_stat(struct socket *so, struct stat *ub) { - /* stat: don't bother with a blocksize */ - return 0; + return EOPNOTSUPP; } int diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 9fd65c417c4..63bcf74567a 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -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 $"); +__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.103 2014/07/07 07:09:59 rtr Exp $"); #include "opt_inet.h" #include "opt_inet_csum.h" @@ -696,13 +696,7 @@ udp6_ioctl(struct socket *so, u_long cmd, void *addr6, struct ifnet *ifp) static int udp6_stat(struct socket *so, struct stat *ub) { - struct in6pcb *in6p = sotoin6pcb(so); - - if (in6p == NULL) - return EINVAL; - - /* stat: don't bother with a blocksize */ - return 0; + return EOPNOTSUPP; } int diff --git a/sys/netipsec/keysock.c b/sys/netipsec/keysock.c index 80c816a3e34..6890bd007a7 100644 --- a/sys/netipsec/keysock.c +++ b/sys/netipsec/keysock.c @@ -1,4 +1,4 @@ -/* $NetBSD: keysock.c,v 1.30 2014/07/06 03:33:33 rtr Exp $ */ +/* $NetBSD: keysock.c,v 1.31 2014/07/07 07:09:59 rtr Exp $ */ /* $FreeBSD: src/sys/netipsec/keysock.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */ /* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $ */ @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.30 2014/07/06 03:33:33 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.31 2014/07/07 07:09:59 rtr Exp $"); #include "opt_ipsec.h" @@ -493,7 +493,7 @@ key_ioctl(struct socket *so, u_long cmd, void *nam, struct ifnet *ifp) static int key_stat(struct socket *so, struct stat *ub) { - return 0; + return EOPNOTSUPP; } /* diff --git a/sys/netnatm/natm.c b/sys/netnatm/natm.c index f31a9d0e3fc..a25f993f1e9 100644 --- a/sys/netnatm/natm.c +++ b/sys/netnatm/natm.c @@ -1,4 +1,4 @@ -/* $NetBSD: natm.c,v 1.32 2014/07/06 15:49:14 rtr Exp $ */ +/* $NetBSD: natm.c,v 1.33 2014/07/07 07:09:59 rtr Exp $ */ /* * Copyright (c) 1996 Charles D. Cranor and Washington University. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: natm.c,v 1.32 2014/07/06 15:49:14 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: natm.c,v 1.33 2014/07/07 07:09:59 rtr Exp $"); #include <sys/param.h> #include <sys/kmem.h> @@ -140,14 +140,7 @@ done: static int natm_stat(struct socket *so, struct stat *ub) { - struct natmpcb *npcb; - - npcb = (struct natmpcb *) so->so_pcb; - - if (npcb == NULL) - return EINVAL; - - return 0; + return EOPNOTSUPP; } /* diff --git a/sys/rump/net/lib/libsockin/sockin.c b/sys/rump/net/lib/libsockin/sockin.c index b65dee93867..7cc9be52408 100644 --- a/sys/rump/net/lib/libsockin/sockin.c +++ b/sys/rump/net/lib/libsockin/sockin.c @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.43 2014/07/06 16:18:46 rtr Exp $ */ +/* $NetBSD: sockin.c,v 1.44 2014/07/07 07:09:59 rtr Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sockin.c,v 1.43 2014/07/06 16:18:46 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sockin.c,v 1.44 2014/07/07 07:09:59 rtr Exp $"); #include <sys/param.h> #include <sys/condvar.h> @@ -462,7 +462,7 @@ sockin_ioctl(struct socket *so, u_long cmd, void *nam, struct ifnet *ifp) static int sockin_stat(struct socket *so, struct stat *ub) { - return 0; + return EOPNOTSUPP; } static int |
