When using a POSIX threads implementation, you have a choice of several
Typically, the default is
SCHED_OTHER, while using
SCHED_RR requires special (e.g., root) privileges.
By default, GNAT uses the
SCHED_OTHER policy. To specify
you can use one of the following:
pragma Time_Slice (0.0)
pragma Task_Dispatching_Policy (FIFO_Within_Priorities)
you should use
pragma Time_Slice with a
value greater than 0.0, or else use the corresponding
To make sure a program is running as root, you can put something like this in a library package body in your application:
function geteuid return Integer; pragma Import (C, geteuid, "geteuid"); Ignore : constant Boolean := (if geteuid = 0 then True else raise Program_Error with "must be root");
It gets the effective user id, and if it’s not 0 (i.e. root), it raises Program_Error.