Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* kernel getpriority BUGFIX
@ 1996-06-17  5:40 David Mosberger-Tang
  0 siblings, 0 replies; only message in thread
From: David Mosberger-Tang @ 1996-06-17  5:40 UTC (permalink / raw)


There is a silly bug in osf_getpriority() that makes it fail when
returning a negative priority.  I don't know what I was thinking when
I wrote the original code.  Anyhow, the patch below should fix it.

BTW: even with this fix, getpriority() returns more or less random
priority values for realtime threads (notably kswapd).  Maybe it would
be better to return the maximum priority (-20) instead?  Or do you
have a better solution in mind?

	--david

--- 386/arch/alpha/kernel/osf_sys.c	Thu Apr 11 23:49:30 1996
+++ linux/arch/alpha/kernel/osf_sys.c	Sun Jun 16 13:59:10 1996
@@ -125,14 +125,22 @@
 	return count - buf.count;
 }
 
-asmlinkage int osf_getpriority(int which, int who)
+/*
+ * Alpha syscall convention has no problem returning negative
+ * values:
+ */
+asmlinkage int osf_getpriority(int which, int who, int a2, int a3, int a4,
+			       int a5, struct pt_regs regs)
 {
 	extern int sys_getpriority(int, int);
-	/*
-	 * Alpha syscall convention has no problem returning negative
-	 * values:
-	 */
-	return 20 - sys_getpriority(which, who);
+	int prio;
+
+	prio = sys_getpriority(which, who);
+	if (prio < 0)
+		return prio;
+
+	regs.r0 = 0; /* special return: no errors */
+	return 20 - prio;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-06-17  5:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-06-17  5:40 kernel getpriority BUGFIX David Mosberger-Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox