Bug 206040 - sleepqueue(9) describes priority arguments wrong.
Summary: sleepqueue(9) describes priority arguments wrong.
Status: Open
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: easy, patch
Depends on:
Blocks:
 
Reported: 2016-01-08 18:29 UTC by David Reed
Modified: 2021-09-30 14:20 UTC (History)
2 users (show)

See Also:


Attachments
sleepqueue(9) patch (931 bytes, patch)
2021-09-30 14:19 UTC, Felix Johnson
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Reed 2016-01-08 18:29:38 UTC
sleepq_signal, sleepq_broadcast both take a "pri" argument.  The man page says that if -1 is passed there will be no priority change, otherwise the pri value will set the priority of all threads being signaled to pri.

However, if one looks at the code that uses the pri argument in sleepq_resume, the actual logic can be described by this sentence:

"If pri is 0, the threads that are signaled will awake with priority unchanged. Otherwise, if a thread is in priority class TIMESHARE, and a thread has a lower TIMESHARE priority (larger value than pri) that thread's priority will be set to pri. pri must either be between MIN_PRI and MAX_PRI, or zero."

I'd be happy if this simple fix to the document were made, and backported to 10.2 as well.  Feel free to use the wording above.
Comment 1 Felix Johnson 2021-09-30 14:19:12 UTC
Created attachment 228287 [details]
sleepqueue(9) patch

Improved description of thread priority on resume.