From owner-svn-src-stable@freebsd.org Sun Jun 5 07:34:12 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67814B687C4; Sun, 5 Jun 2016 07:34:12 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 351801DBC; Sun, 5 Jun 2016 07:34:12 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u557YB51074039; Sun, 5 Jun 2016 07:34:11 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u557YAXl074033; Sun, 5 Jun 2016 07:34:10 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201606050734.u557YAXl074033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 5 Jun 2016 07:34:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r301428 - in stable/10/sys: amd64/amd64 i386/i386 powerpc/powerpc sparc64/sparc64 sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jun 2016 07:34:12 -0000 Author: dchagin Date: Sun Jun 5 07:34:10 2016 New Revision: 301428 URL: https://svnweb.freebsd.org/changeset/base/301428 Log: MFC r300415: Add macro to convert errno and use it when appropriate. Modified: stable/10/sys/amd64/amd64/vm_machdep.c stable/10/sys/i386/i386/vm_machdep.c stable/10/sys/powerpc/powerpc/exec_machdep.c stable/10/sys/sparc64/sparc64/vm_machdep.c stable/10/sys/sys/sysent.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/vm_machdep.c ============================================================================== --- stable/10/sys/amd64/amd64/vm_machdep.c Sun Jun 5 06:37:54 2016 (r301427) +++ stable/10/sys/amd64/amd64/vm_machdep.c Sun Jun 5 07:34:10 2016 (r301428) @@ -414,13 +414,7 @@ cpu_set_syscall_retval(struct thread *td break; default: - if (td->td_proc->p_sysent->sv_errsize) { - if (error >= td->td_proc->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = td->td_proc->p_sysent->sv_errtbl[error]; - } - td->td_frame->tf_rax = error; + td->td_frame->tf_rax = SV_ABI_ERRNO(td->td_proc, error); td->td_frame->tf_rflags |= PSL_C; break; } Modified: stable/10/sys/i386/i386/vm_machdep.c ============================================================================== --- stable/10/sys/i386/i386/vm_machdep.c Sun Jun 5 06:37:54 2016 (r301427) +++ stable/10/sys/i386/i386/vm_machdep.c Sun Jun 5 07:34:10 2016 (r301428) @@ -486,13 +486,7 @@ cpu_set_syscall_retval(struct thread *td break; default: - if (td->td_proc->p_sysent->sv_errsize) { - if (error >= td->td_proc->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = td->td_proc->p_sysent->sv_errtbl[error]; - } - td->td_frame->tf_eax = error; + td->td_frame->tf_eax = SV_ABI_ERRNO(td->td_proc, error); td->td_frame->tf_eflags |= PSL_C; break; } Modified: stable/10/sys/powerpc/powerpc/exec_machdep.c ============================================================================== --- stable/10/sys/powerpc/powerpc/exec_machdep.c Sun Jun 5 06:37:54 2016 (r301427) +++ stable/10/sys/powerpc/powerpc/exec_machdep.c Sun Jun 5 07:34:10 2016 (r301428) @@ -901,11 +901,7 @@ cpu_set_syscall_retval(struct thread *td tf->srr0 -= 4; break; default: - if (p->p_sysent->sv_errsize) { - error = (error < p->p_sysent->sv_errsize) ? - p->p_sysent->sv_errtbl[error] : -1; - } - tf->fixreg[FIRSTARG] = error; + tf->fixreg[FIRSTARG] = SV_ABI_ERRNO(p, error); tf->cr |= 0x10000000; /* Set summary overflow */ break; } Modified: stable/10/sys/sparc64/sparc64/vm_machdep.c ============================================================================== --- stable/10/sys/sparc64/sparc64/vm_machdep.c Sun Jun 5 06:37:54 2016 (r301427) +++ stable/10/sys/sparc64/sparc64/vm_machdep.c Sun Jun 5 07:34:10 2016 (r301428) @@ -196,13 +196,7 @@ cpu_set_syscall_retval(struct thread *td break; default: - if (td->td_proc->p_sysent->sv_errsize) { - if (error >= td->td_proc->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = td->td_proc->p_sysent->sv_errtbl[error]; - } - td->td_frame->tf_out[0] = error; + td->td_frame->tf_out[0] = SV_ABI_ERRNO(td->td_proc, error); td->td_frame->tf_tstate |= TSTATE_XCC_C; break; } Modified: stable/10/sys/sys/sysent.h ============================================================================== --- stable/10/sys/sys/sysent.h Sun Jun 5 06:37:54 2016 (r301427) +++ stable/10/sys/sys/sysent.h Sun Jun 5 07:34:10 2016 (r301428) @@ -141,6 +141,8 @@ struct sysentvec { #define SV_SHP 0x010000 #define SV_ABI_MASK 0xff +#define SV_ABI_ERRNO(p, e) ((p)->p_sysent->sv_errsize <= 0 ? e : \ + ((e) >= (p)->p_sysent->sv_errsize ? -1 : (p)->p_sysent->sv_errtbl[e])) #define SV_PROC_FLAG(p, x) ((p)->p_sysent->sv_flags & (x)) #define SV_PROC_ABI(p) ((p)->p_sysent->sv_flags & SV_ABI_MASK) #define SV_CURPROC_FLAG(x) SV_PROC_FLAG(curproc, x)