[SDL] Giving an SDL app high priority (Linux)

Drake Wilson drake at libcom.com
Wed Nov 19 02:12:02 PST 2003

> My problem is that I would like a game I may write for example on SDL to
> automatically get high priority on a user's system, without him having to
> renice it manually or such. I would also like to avoid requiring that the
> user have root priviliges in order to renice the game process.

Under Linux, there's beginning to be support for process capabilities
-- that is, individual rootish privileges that can be granted to a
process.  However, filesystem support for them does not exist yet
AFAIK, one would still have to be root on install to grant the
privilege (in this case CAP_SYS_NICE, I think) in the first place, and
it's not portable.

Pretty much _the_ way to change the priority of a process on Unix-like
systems, AFAIK, is setpriority() or nice(), and to raise the priority
of a process above normal requires either full root, or, on systems
with more fine-grained capabilities, something like the Linux

In short, I think you may be out of luck.  My approach would be to
make it the user's responsibility to _reduce_ the priority of the
batch resource hogs appropriately, but I assume that's not really what
you're trying to do.


   ---> Drake Wilson

More information about the SDL mailing list