Fri Oct 3 22:39:36 2008 UTC ()
Compat linux/linux32 nice(2) fix. The syscall argument is an increment
to be added to the current nice value, not an absolute value to be
set.


(njoly)
diff -r1.103 -r1.104 src/sys/compat/linux/common/linux_misc_notalpha.c
diff -r1.23 -r1.24 src/sys/compat/linux32/common/linux32_unistd.c

cvs diff -r1.103 -r1.104 src/sys/compat/linux/common/linux_misc_notalpha.c (expand / switch to context diff)
--- src/sys/compat/linux/common/linux_misc_notalpha.c 2008/07/15 16:18:08 1.103
+++ src/sys/compat/linux/common/linux_misc_notalpha.c 2008/10/03 22:39:36 1.104
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_misc_notalpha.c,v 1.103 2008/07/15 16:18:08 christos Exp $	*/
+/*	$NetBSD: linux_misc_notalpha.c,v 1.104 2008/10/03 22:39:36 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.103 2008/07/15 16:18:08 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.104 2008/10/03 22:39:36 njoly Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -199,11 +199,13 @@
 	/* {
 		syscallarg(int) incr;
 	} */
+	struct proc *p = l->l_proc;
         struct sys_setpriority_args bsa;
 
         SCARG(&bsa, which) = PRIO_PROCESS;
         SCARG(&bsa, who) = 0;
-	SCARG(&bsa, prio) = SCARG(uap, incr);
+	SCARG(&bsa, prio) = p->p_nice - NZERO + SCARG(uap, incr);
+
         return sys_setpriority(l, &bsa, retval);
 }
 #endif /* !__amd64__ */

cvs diff -r1.23 -r1.24 src/sys/compat/linux32/common/linux32_unistd.c (expand / switch to context diff)
--- src/sys/compat/linux32/common/linux32_unistd.c 2008/09/22 13:07:46 1.23
+++ src/sys/compat/linux32/common/linux32_unistd.c 2008/10/03 22:39:36 1.24
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_unistd.c,v 1.23 2008/09/22 13:07:46 njoly Exp $ */
+/*	$NetBSD: linux32_unistd.c,v 1.24 2008/10/03 22:39:36 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.23 2008/09/22 13:07:46 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.24 2008/10/03 22:39:36 njoly Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -391,11 +391,12 @@
 	/* {
 		syscallarg(int) incr;
 	} */
+	struct proc *p = l->l_proc;
 	struct sys_setpriority_args bsa;
 
 	SCARG(&bsa, which) = PRIO_PROCESS;
 	SCARG(&bsa, who) = 0;
-	SCARG(&bsa, prio) = SCARG(uap, incr);
+	SCARG(&bsa, prio) = p->p_nice - NZERO + SCARG(uap, incr);
 
 	return sys_setpriority(l, &bsa, retval);
 }