Issue #3485 has been reported by liweitianux.

----------------------------------------
Bug #3485: usched(8) requires root priviledge
http://bugs.dragonflybsd.org/issues/3485

* Author: liweitianux
* Status: New
* Priority: Normal
* Category: Feature request
* Target version: 6.6
* Start date: 2026-11-27
----------------------------------------
Currently the @usched(8)@ utility can only be used by root, and this limitation 
makes it much less useful.

The restriction is in the @usched_set(2)@ system call. However, the 
@lwp_setaffinity(2)@ allows an LWP to change the cpumask of itself. This is 
also the syscall used to implement @pthread_setaffinity_np()@.

After discussing with dillon, the solution is: a program can only set a CPU 
affinity within the mask of CPUs allowed by the parent. And the implementation 
may be:

* add a @p_cpumask@ field to the @struct proc@, to set the the governing mask
* an LWP can only set a @lwp_cpumask@ within @p_cpumask@
* when fork/exec, the sub-processes inherit the @p_cpumask@
* add extra @USCHED_*@ commands to manage the process's @p_cpumask@, but only 
allow it to be further restriccted

On the other hand, we should then extend @svc(8)@ to support CPU binding.



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://bugs.dragonflybsd.org/my/account

Reply via email to