From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: X-Archive-Original-Message-ID: <199606170540.WAA03261@koala.azstarnet.com> Date: Sun, 16 Jun 1996 22:40:10 -0700 From: David Mosberger-Tang Subject: kernel getpriority BUGFIX 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; }