1

I'm write a time-critical application in C on an embedded computer and need to change the scheduling policy of the process. Using pthread_setscheduler with SCHED_RR leads to sufficient results for me. But now the application needs root-rights. But giving root-rights to the application is not very nice. Is there any possibility to set round-robin without the need of root-rights? Or there are a more elegant solution?


Another approach with setcap

sudo setcap cap_sys_nice+ep my_application

leads to problems while loading some own shared libraries which are placed in several folders.

chrisaycock
  • 36,470
  • 14
  • 88
  • 125
Alex44
  • 3,597
  • 7
  • 39
  • 56
  • Nope. Scheduling policies of OS are not allowed to be modified by non-super users for a reason. Similarly shared libraries (LD_LIBRARY_PATH, LD_PRELOAD etc) don't work for the same reason. See [this](http://stackoverflow.com/q/9843178/1275169) for a couple options using which you could make it work with `setcap` -- which requires you to recompile your shared libraries or place them in standard locations. Otherwise, you are out of luck. – P.P Feb 08 '17 at 18:23
  • You could set the scheduling policy at startup and then drop root rights. This is analogous to what many system services do when they need to obtain access to protected resources, such as reserved network ports, but do not need to operate with continuing privilege. – John Bollinger Feb 08 '17 at 18:42
  • What about using `fakeroot`? Is this an appropriate way? – Alex44 Feb 08 '17 at 19:46

0 Answers0