Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: David Mosberger-Tang <davidm@AZStarNet.com>
Subject: kernel getpriority BUGFIX
Date: Sun, 16 Jun 1996 22:40:10 -0700	[thread overview]
Message-ID: <c3b409af7862a563e003c2e078bd4298.axp-list@archive.invalid> (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;
 }

                 reply	other threads:[~1996-06-17  5:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

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