git: adb12675055f - main - syscall_args: remove MAXARGS define
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 08 Dec 2021 18:47:26 UTC
The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=adb12675055fb7114f50f8e809f68ed316fb8ec4 commit adb12675055fb7114f50f8e809f68ed316fb8ec4 Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2021-12-08 18:45:15 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2021-12-08 18:45:41 +0000 syscall_args: remove MAXARGS define Use nitems instead and just use a magic `8` for the size of the args array. MAXARGS was rarely used (only in arm64 code) and is an overly generic name to polute the namespace with. Requested by: kib in D33308 --- sys/arm64/arm64/trap.c | 2 +- sys/arm64/linux/linux_sysvec.c | 7 ++++--- sys/sys/proc.h | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 891f1024232a..2b357d723e15 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -159,7 +159,7 @@ cpu_fetch_syscall_args(struct thread *td) KASSERT(sa->callp->sy_narg <= nitems(sa->args), ("Syscall %d takes too many arguments", sa->code)); - memcpy(dst_ap, ap, (MAXARGS - 1) * sizeof(register_t)); + memcpy(dst_ap, ap, (nitems(sa->args) - 1) * sizeof(register_t)); td->td_retval[0] = 0; td->td_retval[1] = 0; diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index c88442a19c53..a63c82b38c73 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -160,9 +160,10 @@ linux_fetch_syscall_args(struct thread *td) else sa->callp = &p->p_sysent->sv_table[sa->code]; - if (sa->callp->sy_narg > MAXARGS) - panic("ARM64TODO: Could we have more than %d args?", MAXARGS); - memcpy(sa->args, ap, MAXARGS * sizeof(register_t)); + if (sa->callp->sy_narg > nitems(sa->args)) + panic("ARM64TODO: Could we have more than %zu args?", + nitems(sa->args)); + memcpy(sa->args, ap, nitems(sa->args) * sizeof(register_t)); td->td_retval[0] = 0; return (0); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index f448c8a9d104..ff97bfbd54a9 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -201,12 +201,11 @@ struct vm_map; struct vm_map_entry; struct epoch_tracker; -#define MAXARGS 8 struct syscall_args { u_int code; u_int original_code; struct sysent *callp; - register_t args[MAXARGS]; + register_t args[8]; }; /*