git: dbb47e9264da - main - freebsd32: remove freebsd32_recvfrom

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Wed, 17 Nov 2021 20:22:34 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=dbb47e9264da2e11d60cea466a77cf008a387428

commit dbb47e9264da2e11d60cea466a77cf008a387428
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2021-11-17 20:12:24 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2021-11-17 20:12:24 +0000

    freebsd32: remove freebsd32_recvfrom
    
    The freebsd32_recvfrom() serves no purpose as no arguments require
    translation.  The prototype was mis-declared and the implementation
    contained (relatively harmless) errors.
    
    Reviewed by:    kevans
---
 sys/compat/freebsd32/freebsd32_misc.c          | 31 --------------------------
 sys/compat/freebsd32/freebsd32_proto.h         | 10 ---------
 sys/compat/freebsd32/freebsd32_syscall.h       |  2 +-
 sys/compat/freebsd32/freebsd32_syscalls.c      |  2 +-
 sys/compat/freebsd32/freebsd32_sysent.c        |  2 +-
 sys/compat/freebsd32/freebsd32_systrace_args.c | 12 +++++-----
 sys/compat/freebsd32/syscalls.master           |  4 ++--
 7 files changed, 11 insertions(+), 52 deletions(-)

diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index a0a7f1936fc9..08abd7ac26c8 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -1603,37 +1603,6 @@ out:
 	return (error);
 }
 
-int
-freebsd32_recvfrom(struct thread *td,
-		   struct freebsd32_recvfrom_args *uap)
-{
-	struct msghdr msg;
-	struct iovec aiov;
-	int error;
-
-	if (uap->fromlenaddr) {
-		error = copyin(PTRIN(uap->fromlenaddr), &msg.msg_namelen,
-		    sizeof(msg.msg_namelen));
-		if (error)
-			return (error);
-	} else {
-		msg.msg_namelen = 0;
-	}
-
-	msg.msg_name = PTRIN(uap->from);
-	msg.msg_iov = &aiov;
-	msg.msg_iovlen = 1;
-	aiov.iov_base = PTRIN(uap->buf);
-	aiov.iov_len = uap->len;
-	msg.msg_control = NULL;
-	msg.msg_flags = uap->flags;
-	error = kern_recvit(td, uap->s, &msg, UIO_USERSPACE, NULL);
-	if (error == 0 && uap->fromlenaddr)
-		error = copyout(&msg.msg_namelen, PTRIN(uap->fromlenaddr),
-		    sizeof (msg.msg_namelen));
-	return (error);
-}
-
 int
 freebsd32_settimeofday(struct thread *td,
 		       struct freebsd32_settimeofday_args *uap)
diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h
index 02a199acf1df..74410d1d0698 100644
--- a/sys/compat/freebsd32/freebsd32_proto.h
+++ b/sys/compat/freebsd32/freebsd32_proto.h
@@ -59,14 +59,6 @@ struct freebsd32_sendmsg_args {
 	char msg_l_[PADL_(const struct msghdr32 *)]; const struct msghdr32 * msg; char msg_r_[PADR_(const struct msghdr32 *)];
 	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
 };
-struct freebsd32_recvfrom_args {
-	char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
-	char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];
-	char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];
-	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
-	char from_l_[PADL_(struct sockaddr *)]; struct sockaddr * from; char from_r_[PADR_(struct sockaddr *)];
-	char fromlenaddr_l_[PADL_(uint32_t)]; uint32_t fromlenaddr; char fromlenaddr_r_[PADR_(uint32_t)];
-};
 struct freebsd32_sigaltstack_args {
 	char ss_l_[PADL_(const struct sigaltstack32 *)]; const struct sigaltstack32 * ss; char ss_r_[PADR_(const struct sigaltstack32 *)];
 	char oss_l_[PADL_(struct sigaltstack32 *)]; struct sigaltstack32 * oss; char oss_r_[PADR_(struct sigaltstack32 *)];
@@ -759,7 +751,6 @@ int	freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *);
 int	freebsd32_ptrace(struct thread *, struct freebsd32_ptrace_args *);
 int	freebsd32_recvmsg(struct thread *, struct freebsd32_recvmsg_args *);
 int	freebsd32_sendmsg(struct thread *, struct freebsd32_sendmsg_args *);
-int	freebsd32_recvfrom(struct thread *, struct freebsd32_recvfrom_args *);
 int	freebsd32_sigaltstack(struct thread *, struct freebsd32_sigaltstack_args *);
 int	freebsd32_ioctl(struct thread *, struct freebsd32_ioctl_args *);
 int	freebsd32_execve(struct thread *, struct freebsd32_execve_args *);
@@ -1328,7 +1319,6 @@ int	freebsd11_freebsd32_fstatat(struct thread *, struct freebsd11_freebsd32_fsta
 #define	FREEBSD32_SYS_AUE_freebsd32_ptrace	AUE_PTRACE
 #define	FREEBSD32_SYS_AUE_freebsd32_recvmsg	AUE_RECVMSG
 #define	FREEBSD32_SYS_AUE_freebsd32_sendmsg	AUE_SENDMSG
-#define	FREEBSD32_SYS_AUE_freebsd32_recvfrom	AUE_RECVFROM
 #define	FREEBSD32_SYS_AUE_ofreebsd32_stat	AUE_STAT
 #define	FREEBSD32_SYS_AUE_ofreebsd32_lstat	AUE_LSTAT
 #define	FREEBSD32_SYS_AUE_ofreebsd32_sigaction	AUE_SIGACTION
diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h
index a52565f6803d..316d3bfd5857 100644
--- a/sys/compat/freebsd32/freebsd32_syscall.h
+++ b/sys/compat/freebsd32/freebsd32_syscall.h
@@ -34,7 +34,7 @@
 #define	FREEBSD32_SYS_freebsd32_ptrace	26
 #define	FREEBSD32_SYS_freebsd32_recvmsg	27
 #define	FREEBSD32_SYS_freebsd32_sendmsg	28
-#define	FREEBSD32_SYS_freebsd32_recvfrom	29
+#define	FREEBSD32_SYS_recvfrom	29
 #define	FREEBSD32_SYS_accept	30
 #define	FREEBSD32_SYS_getpeername	31
 #define	FREEBSD32_SYS_getsockname	32
diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c
index 4a7fa66babb0..cd990811c0da 100644
--- a/sys/compat/freebsd32/freebsd32_syscalls.c
+++ b/sys/compat/freebsd32/freebsd32_syscalls.c
@@ -38,7 +38,7 @@ const char *freebsd32_syscallnames[] = {
 	"freebsd32_ptrace",			/* 26 = freebsd32_ptrace */
 	"freebsd32_recvmsg",			/* 27 = freebsd32_recvmsg */
 	"freebsd32_sendmsg",			/* 28 = freebsd32_sendmsg */
-	"freebsd32_recvfrom",			/* 29 = freebsd32_recvfrom */
+	"recvfrom",			/* 29 = recvfrom */
 	"accept",			/* 30 = accept */
 	"getpeername",			/* 31 = getpeername */
 	"getsockname",			/* 32 = getsockname */
diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c
index 1eff33290dbb..20c6d7a3e8a7 100644
--- a/sys/compat/freebsd32/freebsd32_sysent.c
+++ b/sys/compat/freebsd32/freebsd32_sysent.c
@@ -91,7 +91,7 @@ struct sysent freebsd32_sysent[] = {
 	{ .sy_narg = AS(freebsd32_ptrace_args), .sy_call = (sy_call_t *)freebsd32_ptrace, .sy_auevent = AUE_PTRACE, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC },	/* 26 = freebsd32_ptrace */
 	{ .sy_narg = AS(freebsd32_recvmsg_args), .sy_call = (sy_call_t *)freebsd32_recvmsg, .sy_auevent = AUE_RECVMSG, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC },	/* 27 = freebsd32_recvmsg */
 	{ .sy_narg = AS(freebsd32_sendmsg_args), .sy_call = (sy_call_t *)freebsd32_sendmsg, .sy_auevent = AUE_SENDMSG, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC },	/* 28 = freebsd32_sendmsg */
-	{ .sy_narg = AS(freebsd32_recvfrom_args), .sy_call = (sy_call_t *)freebsd32_recvfrom, .sy_auevent = AUE_RECVFROM, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC },	/* 29 = freebsd32_recvfrom */
+	{ .sy_narg = AS(recvfrom_args), .sy_call = (sy_call_t *)sys_recvfrom, .sy_auevent = AUE_RECVFROM, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC },	/* 29 = recvfrom */
 	{ .sy_narg = AS(accept_args), .sy_call = (sy_call_t *)sys_accept, .sy_auevent = AUE_ACCEPT, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC },	/* 30 = accept */
 	{ .sy_narg = AS(getpeername_args), .sy_call = (sy_call_t *)sys_getpeername, .sy_auevent = AUE_GETPEERNAME, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC },	/* 31 = getpeername */
 	{ .sy_narg = AS(getsockname_args), .sy_call = (sy_call_t *)sys_getsockname, .sy_auevent = AUE_GETSOCKNAME, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC },	/* 32 = getsockname */
diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c
index 7544c55bd499..e06efa75b025 100644
--- a/sys/compat/freebsd32/freebsd32_systrace_args.c
+++ b/sys/compat/freebsd32/freebsd32_systrace_args.c
@@ -196,15 +196,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
 		*n_args = 3;
 		break;
 	}
-	/* freebsd32_recvfrom */
+	/* recvfrom */
 	case 29: {
-		struct freebsd32_recvfrom_args *p = params;
+		struct recvfrom_args *p = params;
 		iarg[0] = p->s; /* int */
 		uarg[1] = (intptr_t)p->buf; /* void * */
 		uarg[2] = p->len; /* size_t */
 		iarg[3] = p->flags; /* int */
 		uarg[4] = (intptr_t)p->from; /* struct sockaddr * */
-		uarg[5] = p->fromlenaddr; /* uint32_t */
+		uarg[5] = (intptr_t)p->fromlenaddr; /* __socklen_t * */
 		*n_args = 6;
 		break;
 	}
@@ -3720,7 +3720,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
 			break;
 		};
 		break;
-	/* freebsd32_recvfrom */
+	/* recvfrom */
 	case 29:
 		switch (ndx) {
 		case 0:
@@ -3739,7 +3739,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
 			p = "userland struct sockaddr *";
 			break;
 		case 5:
-			p = "uint32_t";
+			p = "userland __socklen_t *";
 			break;
 		default:
 			break;
@@ -9360,7 +9360,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
 		if (ndx == 0 || ndx == 1)
 			p = "int";
 		break;
-	/* freebsd32_recvfrom */
+	/* recvfrom */
 	case 29:
 		if (ndx == 0 || ndx == 1)
 			p = "int";
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index 88aad1d180a5..f3c506e856b5 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -109,10 +109,10 @@
 				    int flags); }
 28	AUE_SENDMSG	STD	{ int freebsd32_sendmsg(int s, \
 				    const struct msghdr32 *msg, int flags); }
-29	AUE_RECVFROM	STD	{ int freebsd32_recvfrom(int s, void *buf, \
+29	AUE_RECVFROM	NOPROTO	{ int recvfrom(int s, void *buf, \
 				    size_t len, int flags, \
 				    struct sockaddr *from, \
-				    uint32_t fromlenaddr); }
+				    __socklen_t *fromlenaddr); }
 30	AUE_ACCEPT	NOPROTO	{ int accept(int s, struct sockaddr *name, \
 				    int *anamelen); }
 31	AUE_GETPEERNAME	NOPROTO	{ int getpeername(int fdes, \