I'm writing a benchmark. To reduce performance variance, I want to run it with the highest priority. But since it requires root, I want to drop the privileges once they are not needed. I searched the net and couldn't find the solution to my problem though:
How do I obtain UID that I should feed setuid with?
The only answer that I found is to set setuid flag on the executable to always start it with root and then call setuid(getuid()). It's quite burdensome for users though. Is there any simple way of performing the simple task?
How do I obtain UID that I should feed setuid with?
The only answer that I found is to set setuid flag on the executable to always start it with root and then call setuid(getuid()). It's quite burdensome for users though. Is there any simple way of performing the simple task?