git: ddae7b9aaa6c - main - freebsd32: use size_t where the default ABI does

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

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

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

    freebsd32: use size_t where the default ABI does
    
    While the caller will never pass a larger value, we can use size_t
    due to it being unsigned.
    
    Reviewed by:    kevans
---
 sys/compat/freebsd32/freebsd32_proto.h         |  4 ++--
 sys/compat/freebsd32/freebsd32_systrace_args.c | 16 ++++++++--------
 sys/compat/freebsd32/syscalls.master           |  8 ++++----
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h
index 22b60cfc51bf..def4391848b2 100644
--- a/sys/compat/freebsd32/freebsd32_proto.h
+++ b/sys/compat/freebsd32/freebsd32_proto.h
@@ -62,7 +62,7 @@ struct freebsd32_sendmsg_args {
 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_(uint32_t)]; uint32_t len; char len_r_[PADR_(uint32_t)];
+	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)];
@@ -177,7 +177,7 @@ struct freebsd32___sysctl_args {
 	char old_l_[PADL_(void *)]; void * old; char old_r_[PADR_(void *)];
 	char oldlenp_l_[PADL_(uint32_t *)]; uint32_t * oldlenp; char oldlenp_r_[PADR_(uint32_t *)];
 	char new_l_[PADL_(const void *)]; const void * new; char new_r_[PADR_(const void *)];
-	char newlen_l_[PADL_(uint32_t)]; uint32_t newlen; char newlen_r_[PADR_(uint32_t)];
+	char newlen_l_[PADL_(size_t)]; size_t newlen; char newlen_r_[PADR_(size_t)];
 };
 struct freebsd32_futimes_args {
 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c
index 6b3178f755e9..61a8e2e82a57 100644
--- a/sys/compat/freebsd32/freebsd32_systrace_args.c
+++ b/sys/compat/freebsd32/freebsd32_systrace_args.c
@@ -201,7 +201,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
 		struct freebsd32_recvfrom_args *p = params;
 		iarg[0] = p->s; /* int */
 		uarg[1] = (intptr_t)p->buf; /* void * */
-		uarg[2] = p->len; /* uint32_t */
+		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 */
@@ -943,7 +943,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
 		uarg[2] = (intptr_t)p->old; /* void * */
 		uarg[3] = (intptr_t)p->oldlenp; /* uint32_t * */
 		uarg[4] = (intptr_t)p->new; /* const void * */
-		uarg[5] = p->newlen; /* uint32_t */
+		uarg[5] = p->newlen; /* size_t */
 		*n_args = 6;
 		break;
 	}
@@ -1058,7 +1058,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
 		struct semop_args *p = params;
 		iarg[0] = p->semid; /* int */
 		uarg[1] = (intptr_t)p->sops; /* struct sembuf * */
-		uarg[2] = p->nsops; /* u_int */
+		uarg[2] = p->nsops; /* size_t */
 		*n_args = 3;
 		break;
 	}
@@ -1111,7 +1111,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
 	case 231: {
 		struct shmget_args *p = params;
 		iarg[0] = p->key; /* key_t */
-		iarg[1] = p->size; /* int */
+		uarg[1] = p->size; /* size_t */
 		iarg[2] = p->shmflg; /* int */
 		*n_args = 3;
 		break;
@@ -3730,7 +3730,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
 			p = "userland void *";
 			break;
 		case 2:
-			p = "uint32_t";
+			p = "size_t";
 			break;
 		case 3:
 			p = "int";
@@ -4946,7 +4946,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
 			p = "userland const void *";
 			break;
 		case 5:
-			p = "uint32_t";
+			p = "size_t";
 			break;
 		default:
 			break;
@@ -5083,7 +5083,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
 			p = "userland struct sembuf *";
 			break;
 		case 2:
-			p = "u_int";
+			p = "size_t";
 			break;
 		default:
 			break;
@@ -5176,7 +5176,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
 			p = "key_t";
 			break;
 		case 1:
-			p = "int";
+			p = "size_t";
 			break;
 		case 2:
 			p = "int";
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index 3fd815f62127..de85234343c1 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -110,7 +110,7 @@
 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, \
-				    uint32_t len, int flags, \
+				    size_t len, int flags, \
 				    struct sockaddr *from, \
 				    uint32_t fromlenaddr); }
 30	AUE_ACCEPT	NOPROTO	{ int accept(int s, struct sockaddr *name, \
@@ -391,7 +391,7 @@
 202	AUE_SYSCTL	STD	{ int freebsd32___sysctl(int *name, \
 				    u_int namelen, void *old, \
 				    uint32_t *oldlenp, const void *new, \
-				    uint32_t newlen); }
+				    size_t newlen); }
 203	AUE_MLOCK	NOPROTO	{ int mlock(const void *addr, \
 				    size_t len); }
 204	AUE_MUNLOCK	NOPROTO	{ int munlock(const void *addr, \
@@ -424,7 +424,7 @@
 221	AUE_SEMGET	NOSTD|NOPROTO	{ int semget(key_t key, int nsems, \
 				    int semflg); }
 222	AUE_SEMOP	NOSTD|NOPROTO	{ int semop(int semid, \
-				    struct sembuf *sops, u_int nsops); }
+				    struct sembuf *sops, size_t nsops); }
 223	AUE_NULL	OBSOL	semconfig
 224	AUE_MSGCTL	COMPAT7|NOSTD	{ int freebsd32_msgctl( \
 				    int msqid, int cmd, \
@@ -440,7 +440,7 @@
 				    int shmid, int cmd, \
 				    struct shmid_ds32_old *buf); }
 230	AUE_SHMDT	NOSTD|NOPROTO	{ int shmdt(const void *shmaddr); }
-231	AUE_SHMGET	NOSTD|NOPROTO	{ int shmget(key_t key, int size, \
+231	AUE_SHMGET	NOSTD|NOPROTO	{ int shmget(key_t key, size_t size, \
 				    int shmflg); }
 ;
 232	AUE_NULL	STD 	{ int freebsd32_clock_gettime(clockid_t clock_id, \