/usr/share/ada/adainclude/florist/posix-process_scheduling.adb is in libflorist2014-dev 2014-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | ------------------------------------------------------------------------------
-- --
-- FLORIST (FSU Implementation of POSIX.5) COMPONENTS --
-- --
-- P O S I X . P R O C E S S _ S C H E D U L I N G --
-- --
-- B o d y --
-- --
-- --
-- Copyright (C) 1996-1997 Florida State University --
-- Copyright (C) 1998-2006 AdaCore --
-- --
-- This file is a component of FLORIST, an implementation of an Ada API --
-- for the POSIX OS services, for use with the GNAT Ada compiler and --
-- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended --
-- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD --
-- 1003.5b: 1996. --
-- --
-- FLORIST is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 2, or (at your option) any --
-- later version. FLORIST is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have received a --
-- copy of the GNU General Public License distributed with GNARL; see --
-- file COPYING. If not, write to the Free Software Foundation, 59 --
-- Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
with POSIX.Implementation,
POSIX.Process_Identification,
Unchecked_Conversion;
package body POSIX.Process_Scheduling is
use POSIX.C;
use POSIX.Implementation;
--------------------
-- Get_Priority --
--------------------
function Get_Priority (Parameters : Scheduling_Parameters)
return Scheduling_Priority is
begin
return Scheduling_Priority (Parameters.Param.sched_priority);
end Get_Priority;
--------------------
-- Set_Priority --
--------------------
procedure Set_Priority
(Parameters : in out Scheduling_Parameters;
Priority : Scheduling_Priority) is
begin
Parameters.Param.sched_priority := int (Priority);
end Set_Priority;
---------------------------------
-- Set_Scheduling_Parameters --
---------------------------------
function sched_setparam
(pid : pid_t;
param : sched_param_ptr) return int;
pragma Import (C, sched_setparam, sched_setparam_LINKNAME);
function To_pid_t is
new Unchecked_Conversion (POSIX.Process_Identification.Process_ID, pid_t);
procedure Set_Scheduling_Parameters
(Process : POSIX_Process_Identification.Process_ID;
Parameters : Scheduling_Parameters) is
begin
Check (sched_setparam (To_pid_t (Process),
Parameters.Param'Unchecked_Access));
end Set_Scheduling_Parameters;
---------------------------------
-- Get_Scheduling_Parameters --
---------------------------------
function sched_getparam
(pid : pid_t;
param : access struct_sched_param) return int;
pragma Import (C, sched_getparam, sched_getparam_LINKNAME);
function Get_Scheduling_Parameters
(Process : POSIX_Process_Identification.Process_ID)
return Scheduling_Parameters is
Params : aliased Scheduling_Parameters;
begin
Check (sched_getparam
(To_pid_t (Process), Params.Param'Unchecked_Access));
return Params;
end Get_Scheduling_Parameters;
-----------------------------
-- Set_Scheduling_Policy --
-----------------------------
function sched_setscheduler
(pid : pid_t;
policy : int;
param : sched_param_ptr) return int;
pragma Import (C, sched_setscheduler, sched_setscheduler_LINKNAME);
procedure Set_Scheduling_Policy
(Process : POSIX_Process_Identification.Process_ID;
New_Policy : Scheduling_Policy;
Parameters : Scheduling_Parameters) is
begin
Check (sched_setscheduler
(To_pid_t (Process),
int (New_Policy),
Parameters.Param'Unchecked_Access));
end Set_Scheduling_Policy;
-----------------------------
-- Get_Scheduling_Policy --
-----------------------------
function sched_getscheduler (pid : pid_t) return int;
pragma Import (C, sched_getscheduler, sched_getscheduler_LINKNAME);
function Get_Scheduling_Policy
(Process : POSIX_Process_Identification.Process_ID)
return Scheduling_Policy is
begin
return Scheduling_Policy
(Check (sched_getscheduler (To_pid_t (Process))));
end Get_Scheduling_Policy;
-------------
-- Yield --
-------------
function sched_yield return int;
pragma Import (C, sched_yield, sched_yield_LINKNAME);
procedure Yield is
begin
Check (sched_yield);
end Yield;
----------------------------
-- Get_Maximum_Priority --
----------------------------
function sched_get_priority_max (policy : int) return int;
pragma Import (C, sched_get_priority_max, sched_get_priority_max_LINKNAME);
function Get_Maximum_Priority (Policy : Scheduling_Policy)
return Scheduling_Priority is
begin
return Scheduling_Priority
(Check (sched_get_priority_max (int (Policy))));
end Get_Maximum_Priority;
----------------------------
-- Get_Minimum_Priority --
----------------------------
function sched_get_priority_min (policy : int) return int;
pragma Import (C, sched_get_priority_min, sched_get_priority_min_LINKNAME);
function Get_Minimum_Priority (Policy : Scheduling_Policy)
return Scheduling_Priority is
begin
return Scheduling_Priority
(Check (sched_get_priority_min (int (Policy))));
end Get_Minimum_Priority;
---------------------------------
-- Get_Round_Robin_Interval --
---------------------------------
function sched_rr_get_interval
(pid : pid_t;
interval : access struct_timespec) return int;
pragma Import (C, sched_rr_get_interval, sched_rr_get_interval_LINKNAME);
function Get_Round_Robin_Interval
(Process : POSIX_Process_Identification.Process_ID)
return POSIX.Timespec is
TS : aliased struct_timespec;
begin
Check (sched_rr_get_interval (To_pid_t (Process), TS'Unchecked_Access));
return To_Timespec (TS);
end Get_Round_Robin_Interval;
end POSIX.Process_Scheduling;
|