Index: sys/amd64/amd64/trap.c =================================================================== --- sys/amd64/amd64/trap.c +++ sys/amd64/amd64/trap.c @@ -1169,7 +1169,6 @@ void amd64_syscall(struct thread *td, int traced) { - int error; ksiginfo_t ksi; #ifdef DIAGNOSTIC @@ -1178,7 +1177,7 @@ /* NOT REACHED */ } #endif - error = syscallenter(td); + syscallenter(td); /* * Traced syscall. @@ -1203,7 +1202,7 @@ syscallname(td->td_proc, td->td_sa.code), td->td_md.md_invl_gen.gen)); - syscallret(td, error); + syscallret(td); /* * If the user-supplied value of %rip is not a canonical @@ -1216,5 +1215,5 @@ if (__predict_false(td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS)) set_pcb_flags(td->td_pcb, PCB_FULL_IRET); - amd64_syscall_ret_flush_l1d_inline(error); + amd64_syscall_ret_flush_l1d_inline(td->td_errno); } Index: sys/amd64/ia32/ia32_syscall.c =================================================================== --- sys/amd64/ia32/ia32_syscall.c +++ sys/amd64/ia32/ia32_syscall.c @@ -207,14 +207,13 @@ { struct thread *td; register_t orig_tf_rflags; - int error; ksiginfo_t ksi; orig_tf_rflags = frame->tf_rflags; td = curthread; td->td_frame = frame; - error = syscallenter(td); + syscallenter(td); /* * Traced syscall. @@ -228,8 +227,8 @@ trapsignal(td, &ksi); } - syscallret(td, error); - amd64_syscall_ret_flush_l1d(error); + syscallret(td); + amd64_syscall_ret_flush_l1d(td->td_errno); } static void Index: sys/arm/arm/syscall.c =================================================================== --- sys/arm/arm/syscall.c +++ sys/arm/arm/syscall.c @@ -141,14 +141,11 @@ static void syscall(struct thread *td, struct trapframe *frame) { - int error; td->td_sa.nap = 4; - error = syscallenter(td); - KASSERT(error != 0 || td->td_ar == NULL, - ("returning from syscall with td_ar set!")); - syscallret(td, error); + syscallenter(td); + syscallret(td); } void Index: sys/arm64/arm64/trap.c =================================================================== --- sys/arm64/arm64/trap.c +++ sys/arm64/arm64/trap.c @@ -137,11 +137,10 @@ static void svc_handler(struct thread *td, struct trapframe *frame) { - int error; if ((frame->tf_esr & ESR_ELx_ISS_MASK) == 0) { - error = syscallenter(td); - syscallret(td, error); + syscallenter(td); + syscallret(td); } else { call_trapsignal(td, SIGILL, ILL_ILLOPN, (void *)frame->tf_elr); userret(td, frame); Index: sys/i386/i386/trap.c =================================================================== --- sys/i386/i386/trap.c +++ sys/i386/i386/trap.c @@ -1142,7 +1142,6 @@ { struct thread *td; register_t orig_tf_eflags; - int error; ksiginfo_t ksi; #ifdef DIAGNOSTIC @@ -1157,7 +1156,7 @@ td = curthread; td->td_frame = frame; - error = syscallenter(td); + syscallenter(td); /* * Traced syscall. @@ -1178,5 +1177,5 @@ ("System call %s returning with mangled pcb_save", syscallname(td->td_proc, td->td_sa.code))); - syscallret(td, error); + syscallret(td); } Index: sys/kern/subr_syscall.c =================================================================== --- sys/kern/subr_syscall.c +++ sys/kern/subr_syscall.c @@ -54,7 +54,7 @@ #endif #include -static inline int +static inline void syscallenter(struct thread *td) { struct proc *p; @@ -167,11 +167,10 @@ PROC_UNLOCK(p); } (p->p_sysent->sv_set_syscall_retval)(td, error); - return (error); } static inline void -syscallret(struct thread *td, int error __unused) +syscallret(struct thread *td) { struct proc *p; struct syscall_args *sa; Index: sys/mips/mips/trap.c =================================================================== --- sys/mips/mips/trap.c +++ sys/mips/mips/trap.c @@ -787,10 +787,8 @@ case T_SYSCALL + T_USER: { - int error; - td->td_sa.trapframe = trapframe; - error = syscallenter(td); + syscallenter(td); #if !defined(SMP) && (defined(DDB) || defined(DEBUG)) if (trp == trapdebug) @@ -806,7 +804,7 @@ * instead of being done here under a special check * for SYS_ptrace(). */ - syscallret(td, error); + syscallret(td); return (trapframe->pc); } Index: sys/powerpc/powerpc/trap.c =================================================================== --- sys/powerpc/powerpc/trap.c +++ sys/powerpc/powerpc/trap.c @@ -700,7 +700,6 @@ syscall(struct trapframe *frame) { struct thread *td; - int error; td = curthread; td->td_frame = frame; @@ -715,8 +714,8 @@ "r"(td->td_pcb->pcb_cpu.aim.usr_vsid), "r"(USER_SLB_SLBE)); #endif - error = syscallenter(td); - syscallret(td, error); + syscallenter(td); + syscallret(td); } static int Index: sys/riscv/riscv/trap.c =================================================================== --- sys/riscv/riscv/trap.c +++ sys/riscv/riscv/trap.c @@ -156,13 +156,12 @@ svc_handler(struct trapframe *frame) { struct thread *td; - int error; td = curthread; td->td_frame = frame; - error = syscallenter(td); - syscallret(td, error); + syscallenter(td); + syscallret(td); } static void Index: sys/sparc64/sparc64/trap.c =================================================================== --- sys/sparc64/sparc64/trap.c +++ sys/sparc64/sparc64/trap.c @@ -593,7 +593,6 @@ syscall(struct trapframe *tf) { struct thread *td; - int error; td = curthread; td->td_frame = tf; @@ -608,6 +607,6 @@ td->td_pcb->pcb_tpc = tf->tf_tpc; TF_DONE(tf); - error = syscallenter(td); - syscallret(td, error); + syscallenter(td); + syscallret(td); }