Bug 125187 - Use of setpriority(2) only allows _increasing_ priorities
Summary: Use of setpriority(2) only allows _increasing_ priorities
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 2
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Arjan van de Ven
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-06-03 14:49 UTC by Stewart Wright
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-06-19 12:03:53 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Code to renice a process (1.17 KB, text/plain)
2004-06-03 14:50 UTC, Stewart Wright
no flags Details

Description Stewart Wright 2004-06-03 14:49:26 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510

Description of problem:
(Apologies for putting this in coreutils, I'm not exactly sure where
this goes as it relates (I think) to my renice bug.)

Core using setpriority(2) only allows an increase in priority, rather
than a decrease.

Using a line like 
   res = setpriority(PRIO_PROCESS, pid, prio);
will result in a failure if prio is smaller than the current priority
of pid.  Increasing the priority returns success.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Compile attached reniceit.c
2. Select process (Mozilla for example) and get PID
3. Run:
    reniceit PID 4
4. Run:
    reniceit PID 3
    

Actual Results:  > reniceit 983 4
Process 983 has priority 0
Renicing process 983 to priority 4
Return value is : 0
Process 983 has priority 4

> reniceit 983 3
Process 983 has priority 4
Renicing process 983 to priority 3
Return value is : -1
Process 983 has priority 4


Expected Results:  Process should change priority.

Additional info:

I think this is an indication of the problems in using both the renice
command and top to renice processes.

As to the cause ?????

Comment 1 Stewart Wright 2004-06-03 14:50:59 UTC
Created attachment 100832 [details]
Code to renice a process

This code is a simple example of how setpriority(2) will fail.

Comment 2 Alan Cox 2004-06-19 12:03:53 UTC
Lower numbers are higher priority. See man 2 setpriority.


Note You need to log in before you can comment on or make changes to this bug.