mips.h (set_volatile): Delete.
[official-gcc.git] / gcc / ada / s-proinf-irix-athread.adb
bloba5c81c1de850ef2847dae1a70cdc8c9cfb0a6074
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . P R O G R A M _ I N F O --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1997-2007, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 -- This is an Irix (old pthread library) version of this package
36 -- This package contains the parameters used by the run-time system at
37 -- program startup. These parameters are isolated in this package body to
38 -- facilitate replacement by the end user.
40 -- To replace the default values, copy this source file into your build
41 -- directory, edit the file to reflect your desired behavior, and recompile
42 -- with the command:
44 -- % gcc -c -O2 -gnatpg s-proinf.adb
46 -- then relink your application as usual.
48 pragma Warnings (Off); -- why???
49 with System.OS_Lib;
50 pragma Warnings (On);
52 package body System.Program_Info is
54 Kbytes : constant := 1024;
56 Default_Initial_Sproc_Count : constant := 0;
57 Default_Max_Sproc_Count : constant := 128;
58 Default_Sproc_Stack_Size : constant := 16#4000#;
59 Default_Stack_Guard_Pages : constant := 1;
60 Default_Default_Time_Slice : constant := 0.0;
61 Default_Default_Task_Stack : constant := 12 * Kbytes;
62 Default_Pthread_Sched_Signal : constant := 35;
63 Default_Pthread_Arena_Size : constant := 16#40000#;
64 Default_Os_Default_Priority : constant := 0;
66 -------------------------
67 -- Initial_Sproc_Count --
68 -------------------------
70 function Initial_Sproc_Count return Integer is
72 function sysmp (P1 : Integer) return Integer;
73 pragma Import (C, sysmp, "sysmp", "sysmp");
75 MP_NPROCS : constant := 1; -- # processor in complex
77 Pthread_Sproc_Count : constant System.OS_Lib.String_Access :=
78 System.OS_Lib.Getenv ("PTHREAD_SPROC_COUNT");
80 begin
81 if Pthread_Sproc_Count.all'Length = 0 then
82 return Default_Initial_Sproc_Count;
84 elsif Pthread_Sproc_Count.all = "AUTO" then
85 return sysmp (MP_NPROCS);
87 else
88 return Integer'Value (Pthread_Sproc_Count.all);
89 end if;
91 exception
92 when others =>
93 return Default_Initial_Sproc_Count;
94 end Initial_Sproc_Count;
96 ---------------------
97 -- Max_Sproc_Count --
98 ---------------------
100 function Max_Sproc_Count return Integer is
101 Pthread_Max_Sproc_Count : constant System.OS_Lib.String_Access :=
102 System.OS_Lib.Getenv ("PTHREAD_MAX_SPROC_COUNT");
104 begin
105 if Pthread_Max_Sproc_Count.all'Length = 0 then
106 return Default_Max_Sproc_Count;
107 else
108 return Integer'Value (Pthread_Max_Sproc_Count.all);
109 end if;
110 exception
111 when others =>
112 return Default_Max_Sproc_Count;
113 end Max_Sproc_Count;
115 ----------------------
116 -- Sproc_Stack_Size --
117 ----------------------
119 function Sproc_Stack_Size return Integer is
120 begin
121 return Default_Sproc_Stack_Size;
122 end Sproc_Stack_Size;
124 ------------------------
125 -- Default_Time_Slice --
126 ------------------------
128 function Default_Time_Slice return Duration is
129 Pthread_Time_Slice_Sec : constant System.OS_Lib.String_Access :=
130 System.OS_Lib.Getenv
131 ("PTHREAD_TIME_SLICE_SEC");
132 Pthread_Time_Slice_Usec : constant System.OS_Lib.String_Access :=
133 System.OS_Lib.Getenv
134 ("PTHREAD_TIME_SLICE_USEC");
136 Val_Sec, Val_Usec : Integer := 0;
138 begin
139 if Pthread_Time_Slice_Sec.all'Length /= 0 or
140 Pthread_Time_Slice_Usec.all'Length /= 0
141 then
142 if Pthread_Time_Slice_Sec.all'Length /= 0 then
143 Val_Sec := Integer'Value (Pthread_Time_Slice_Sec.all);
144 end if;
146 if Pthread_Time_Slice_Usec.all'Length /= 0 then
147 Val_Usec := Integer'Value (Pthread_Time_Slice_Usec.all);
148 end if;
150 return Duration (Val_Sec) + Duration (Val_Usec) / 1000.0;
151 else
152 return Default_Default_Time_Slice;
153 end if;
155 exception
156 when others =>
157 return Default_Default_Time_Slice;
158 end Default_Time_Slice;
160 ------------------------
161 -- Default_Task_Stack --
162 ------------------------
164 function Default_Task_Stack return Integer is
165 begin
166 return Default_Default_Task_Stack;
167 end Default_Task_Stack;
169 -----------------------
170 -- Stack_Guard_Pages --
171 -----------------------
173 function Stack_Guard_Pages return Integer is
174 Pthread_Stack_Guard_Pages : constant System.OS_Lib.String_Access :=
175 System.OS_Lib.Getenv
176 ("PTHREAD_STACK_GUARD_PAGES");
177 begin
178 if Pthread_Stack_Guard_Pages.all'Length /= 0 then
179 return Integer'Value (Pthread_Stack_Guard_Pages.all);
180 else
181 return Default_Stack_Guard_Pages;
182 end if;
183 exception
184 when others =>
185 return Default_Stack_Guard_Pages;
186 end Stack_Guard_Pages;
188 --------------------------
189 -- Pthread_Sched_Signal --
190 --------------------------
192 function Pthread_Sched_Signal return Integer is
193 begin
194 return Default_Pthread_Sched_Signal;
195 end Pthread_Sched_Signal;
197 ------------------------
198 -- Pthread_Arena_Size --
199 ------------------------
201 function Pthread_Arena_Size return Integer is
202 Pthread_Arena_Size : constant System.OS_Lib.String_Access :=
203 System.OS_Lib.Getenv
204 ("PTHREAD_ARENA_SIZE");
206 begin
207 if Pthread_Arena_Size.all'Length = 0 then
208 return Default_Pthread_Arena_Size;
209 else
210 return Integer'Value (Pthread_Arena_Size.all);
211 end if;
213 exception
214 when others =>
215 return Default_Pthread_Arena_Size;
216 end Pthread_Arena_Size;
218 -------------------------
219 -- Os_Default_Priority --
220 -------------------------
222 function Os_Default_Priority return Integer is
223 begin
224 return Default_Os_Default_Priority;
225 end Os_Default_Priority;
227 end System.Program_Info;