Module Name:    src
Committed By:   njoly
Date:           Tue Jun  2 13:00:24 UTC 2009

Modified Files:
        src/sys/compat/linux/common: linux_misc_notalpha.c
        src/sys/compat/linux32/common: linux32_unistd.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 \
    src/sys/compat/linux/common/linux_misc_notalpha.c
cvs rdiff -u -r1.32 -r1.33 src/sys/compat/linux32/common/linux32_unistd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/linux/common/linux_misc_notalpha.c
diff -u src/sys/compat/linux/common/linux_misc_notalpha.c:1.105 src/sys/compat/linux/common/linux_misc_notalpha.c:1.106
--- src/sys/compat/linux/common/linux_misc_notalpha.c:1.105	Mon Dec 29 22:21:49 2008
+++ src/sys/compat/linux/common/linux_misc_notalpha.c	Tue Jun  2 13:00:23 2009
@@ -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 @@
 		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__ */
 

Index: src/sys/compat/linux32/common/linux32_unistd.c
diff -u src/sys/compat/linux32/common/linux32_unistd.c:1.32 src/sys/compat/linux32/common/linux32_unistd.c:1.33
--- src/sys/compat/linux32/common/linux32_unistd.c:1.32	Sun Mar 29 19:21:19 2009
+++ src/sys/compat/linux32/common/linux32_unistd.c	Tue Jun  2 13:00:24 2009
@@ -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 @@
 	} */
 	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

Reply via email to