Make nice(2) return EPERM on error, not EACCES (from sys_setpriority).

This commit is contained in:
njoly 2009-06-02 13:00:23 +00:00
parent 2428caab9f
commit 7c47c56d95
2 changed files with 13 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc_notalpha.c,v 1.105 2008/12/29 22:21:49 njoly Exp $ */
/* $NetBSD: linux_misc_notalpha.c,v 1.106 2009/06/02 13:00:23 njoly Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.105 2008/12/29 22:21:49 njoly Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.106 2009/06/02 13:00:23 njoly Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -200,13 +200,15 @@ linux_sys_nice(struct lwp *l, const struct linux_sys_nice_args *uap, register_t
syscallarg(int) incr;
} */
struct proc *p = l->l_proc;
struct sys_setpriority_args bsa;
struct sys_setpriority_args bsa;
int error;
SCARG(&bsa, which) = PRIO_PROCESS;
SCARG(&bsa, who) = 0;
SCARG(&bsa, which) = PRIO_PROCESS;
SCARG(&bsa, who) = 0;
SCARG(&bsa, prio) = p->p_nice - NZERO + SCARG(uap, incr);
return sys_setpriority(l, &bsa, retval);
error = sys_setpriority(l, &bsa, retval);
return (error) ? EPERM : 0;
}
#endif /* !__amd64__ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux32_unistd.c,v 1.32 2009/03/29 19:21:19 christos Exp $ */
/* $NetBSD: linux32_unistd.c,v 1.33 2009/06/02 13:00:24 njoly Exp $ */
/*-
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.32 2009/03/29 19:21:19 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.33 2009/06/02 13:00:24 njoly Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -443,12 +443,14 @@ linux32_sys_nice(struct lwp *l, const struct linux32_sys_nice_args *uap, registe
} */
struct proc *p = l->l_proc;
struct sys_setpriority_args bsa;
int error;
SCARG(&bsa, which) = PRIO_PROCESS;
SCARG(&bsa, who) = 0;
SCARG(&bsa, prio) = p->p_nice - NZERO + SCARG(uap, incr);
return sys_setpriority(l, &bsa, retval);
error = sys_setpriority(l, &bsa, retval);
return (error) ? EPERM : 0;
}
int