Re: sys_getpriority()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Asok,

I went and grepped the kernel and had a look in
arch/ia64/kernel/sys_ia64.c to see how the return value is used.
Interestingly the function is used on the alpha, ia64 and mips but not on
a standard i386! :) and it turns the return value back into the nice value
correctly.

asmlinkage long
ia64_getpriority (int which, int who, long arg2, long arg3, long arg4,
long arg5, long arg6,
                  long arg7, long stack)
{
        struct pt_regs *regs = (struct pt_regs *) &stack;
        extern long sys_getpriority (int, int);
        long prio;

        prio = sys_getpriority(which, who);
        if (prio >= 0) {
                regs->r8 = 0;   /* ensure negative priority is not
mistaken as error code */
                prio = 20 - prio;
        }
        return prio;
}

I guess it's a matter of as long as both party's are talking the same
protocol.

mick

On Wed, 12 Dec 2001, Asok Tiyyagura wrote:

> Michael,
>
> I beleive -20 is the highest priority process while 19
> is the lowest priority process i.e, priority rule is
> "smaller the number higher the priority"
>
> i.e, in my case
> -20 ==> -20 + 20 = 0
> -19 ==> -19 + 20 = 1
> .....
> ..
> 18 ==> 18 + 20 = 38
> 19 ==> 19 + 20 = 39
>
> We "prevent" the priority rule in this mapping. In the
> current code...
>
> -20 ===> 20 - (-20) = 40
> -19 ===> 20 - (-19) = 39
> -18 ===> 20 - (-18) = 38
> ....
>
> 19 ===> 20 - 19 = 1
>
> This mapping violates the "priority rule". While I
> correct my earlier statement from
>
> niceval = 20 + p->nice to
> niceval = 21 + p->niceval (Just to make sure it indeed
> ranges from 1-40 )I still beleive it should be "+"
> instead of "-".
>
> --Asok
>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux