How to set High Thread Priority?
-
I use Qt for Embedded Linux 4.7.3. And I have a thread that should be run with high priority. But to set high priority to thread a process have to have root privileges. But I don't want process is running with root privileges.
I have tried two approches:
-
I execute process by root, set the thread high priority and call setuid(1000) to reduce the privilege level.
But, in this case 'Qt for Embedded Linux data directory'(/tmp/qtembedded-0) is owned by root and after changing process uid my program can't access it. -
I execute process by root with setuid flag, so process have ordinary uid at startup, then I wanna call seteuid(0) to set the thread high priority and then call setuid(1000) to reduce the privilege level at all.
In this case my program Aborted with text "Qt for Embedded Linux data directory is not owned by user 0".
How can I set high thread priority and leave program with ordinary privilege level?
-