git: 7c04ca1fad67 - main - sockets: for stat(2) on a socket don't report hiwat as block size
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 26 Aug 2022 15:16:47 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=7c04ca1fad673f085678faadd10342f82185e829 commit 7c04ca1fad673f085678faadd10342f82185e829 Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2022-08-26 15:16:15 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2022-08-26 15:16:15 +0000 sockets: for stat(2) on a socket don't report hiwat as block size The code appeared in d8392c6c39eb with not good explanation. It is very unlikely any software in the world needs that. Differential revision: https://reviews.freebsd.org/D36283 --- sys/kern/sys_socket.c | 3 ++- sys/kern/uipc_domain.c | 13 ------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 5b8aadc12e08..5c10e2217686 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -335,7 +335,8 @@ soo_stat(struct file *fp, struct stat *ub, struct ucred *active_cred) } ub->st_uid = so->so_cred->cr_uid; ub->st_gid = so->so_cred->cr_gid; - error = so->so_proto->pr_sense(so, ub); + if (so->so_proto->pr_sense) + error = so->so_proto->pr_sense(so, ub); SOCK_UNLOCK(so); return (error); } diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index d2b8d9095f13..a3401091bda4 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include <sys/rmlock.h> #include <sys/socketvar.h> #include <sys/systm.h> -#include <sys/stat.h> /* XXXGL: remove */ #include <machine/atomic.h> @@ -175,17 +174,6 @@ pr_ready_notsupp(struct socket *so, struct mbuf *m, int count) return (EOPNOTSUPP); } -/* - * This isn't really a ``null'' operation, but it's the default one and - * doesn't do anything destructive. - */ -static int -pr_sense_notsupp(struct socket *so, struct stat *sb) -{ - sb->st_blksize = so->so_snd.sb_hiwat; - return (0); -} - static int pr_shutdown_notsupp(struct socket *so) { @@ -246,7 +234,6 @@ pr_init(struct protosw *pr) NOTSUPP(pr_rcvd); NOTSUPP(pr_rcvoob); NOTSUPP(pr_send); - NOTSUPP(pr_sense); NOTSUPP(pr_shutdown); NOTSUPP(pr_sockaddr); NOTSUPP(pr_sosend);