* config/sh/sh.c (sh_gimplify_va_arg_expr): Don't call
[official-gcc.git] / gcc / ada / s-proinf-irix-athread.adb
blob31e4dccf813ae2a6f5d6a6a81f503909b87bb3a9
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-2009, 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 3, 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. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
32 -- This is an Irix (old pthread library) version of this package
34 -- This package contains the parameters used by the run-time system at
35 -- program startup. These parameters are isolated in this package body to
36 -- facilitate replacement by the end user.
38 -- To replace the default values, copy this source file into your build
39 -- directory, edit the file to reflect your desired behavior, and recompile
40 -- with the command:
42 -- % gcc -c -O2 -gnatpg s-proinf.adb
44 -- then relink your application as usual.
46 pragma Warnings (Off); -- why???
47 with System.OS_Lib;
48 pragma Warnings (On);
50 package body System.Program_Info is
52 Kbytes : constant := 1024;
54 Default_Initial_Sproc_Count : constant := 0;
55 Default_Max_Sproc_Count : constant := 128;
56 Default_Sproc_Stack_Size : constant := 16#4000#;
57 Default_Stack_Guard_Pages : constant := 1;
58 Default_Default_Time_Slice : constant := 0.0;
59 Default_Default_Task_Stack : constant := 12 * Kbytes;
60 Default_Pthread_Sched_Signal : constant := 35;
61 Default_Pthread_Arena_Size : constant := 16#40000#;
62 Default_Os_Default_Priority : constant := 0;
64 -------------------------
65 -- Initial_Sproc_Count --
66 -------------------------
68 function Initial_Sproc_Count return Integer is
70 function sysmp (P1 : Integer) return Integer;
71 pragma Import (C, sysmp, "sysmp", "sysmp");
73 MP_NPROCS : constant := 1; -- # processor in complex
75 Pthread_Sproc_Count : constant System.OS_Lib.String_Access :=
76 System.OS_Lib.Getenv ("PTHREAD_SPROC_COUNT");
78 begin
79 if Pthread_Sproc_Count.all'Length = 0 then
80 return Default_Initial_Sproc_Count;
82 elsif Pthread_Sproc_Count.all = "AUTO" then
83 return sysmp (MP_NPROCS);
85 else
86 return Integer'Value (Pthread_Sproc_Count.all);
87 end if;
89 exception
90 when others =>
91 return Default_Initial_Sproc_Count;
92 end Initial_Sproc_Count;
94 ---------------------
95 -- Max_Sproc_Count --
96 ---------------------
98 function Max_Sproc_Count return Integer is
99 Pthread_Max_Sproc_Count : constant System.OS_Lib.String_Access :=
100 System.OS_Lib.Getenv ("PTHREAD_MAX_SPROC_COUNT");
102 begin
103 if Pthread_Max_Sproc_Count.all'Length = 0 then
104 return Default_Max_Sproc_Count;
105 else
106 return Integer'Value (Pthread_Max_Sproc_Count.all);
107 end if;
108 exception
109 when others =>
110 return Default_Max_Sproc_Count;
111 end Max_Sproc_Count;
113 ----------------------
114 -- Sproc_Stack_Size --
115 ----------------------
117 function Sproc_Stack_Size return Integer is
118 begin
119 return Default_Sproc_Stack_Size;
120 end Sproc_Stack_Size;
122 ------------------------
123 -- Default_Time_Slice --
124 ------------------------
126 function Default_Time_Slice return Duration is
127 Pthread_Time_Slice_Sec : constant System.OS_Lib.String_Access :=
128 System.OS_Lib.Getenv
129 ("PTHREAD_TIME_SLICE_SEC");
130 Pthread_Time_Slice_Usec : constant System.OS_Lib.String_Access :=
131 System.OS_Lib.Getenv
132 ("PTHREAD_TIME_SLICE_USEC");
134 Val_Sec, Val_Usec : Integer := 0;
136 begin
137 if Pthread_Time_Slice_Sec.all'Length /= 0 or
138 Pthread_Time_Slice_Usec.all'Length /= 0
139 then
140 if Pthread_Time_Slice_Sec.all'Length /= 0 then
141 Val_Sec := Integer'Value (Pthread_Time_Slice_Sec.all);
142 end if;
144 if Pthread_Time_Slice_Usec.all'Length /= 0 then
145 Val_Usec := Integer'Value (Pthread_Time_Slice_Usec.all);
146 end if;
148 return Duration (Val_Sec) + Duration (Val_Usec) / 1000.0;
149 else
150 return Default_Default_Time_Slice;
151 end if;
153 exception
154 when others =>
155 return Default_Default_Time_Slice;
156 end Default_Time_Slice;
158 ------------------------
159 -- Default_Task_Stack --
160 ------------------------
162 function Default_Task_Stack return Integer is
163 begin
164 return Default_Default_Task_Stack;
165 end Default_Task_Stack;
167 -----------------------
168 -- Stack_Guard_Pages --
169 -----------------------
171 function Stack_Guard_Pages return Integer is
172 Pthread_Stack_Guard_Pages : constant System.OS_Lib.String_Access :=
173 System.OS_Lib.Getenv
174 ("PTHREAD_STACK_GUARD_PAGES");
175 begin
176 if Pthread_Stack_Guard_Pages.all'Length /= 0 then
177 return Integer'Value (Pthread_Stack_Guard_Pages.all);
178 else
179 return Default_Stack_Guard_Pages;
180 end if;
181 exception
182 when others =>
183 return Default_Stack_Guard_Pages;
184 end Stack_Guard_Pages;
186 --------------------------
187 -- Pthread_Sched_Signal --
188 --------------------------
190 function Pthread_Sched_Signal return Integer is
191 begin
192 return Default_Pthread_Sched_Signal;
193 end Pthread_Sched_Signal;
195 ------------------------
196 -- Pthread_Arena_Size --
197 ------------------------
199 function Pthread_Arena_Size return Integer is
200 Pthread_Arena_Size : constant System.OS_Lib.String_Access :=
201 System.OS_Lib.Getenv
202 ("PTHREAD_ARENA_SIZE");
204 begin
205 if Pthread_Arena_Size.all'Length = 0 then
206 return Default_Pthread_Arena_Size;
207 else
208 return Integer'Value (Pthread_Arena_Size.all);
209 end if;
211 exception
212 when others =>
213 return Default_Pthread_Arena_Size;
214 end Pthread_Arena_Size;
216 -------------------------
217 -- Os_Default_Priority --
218 -------------------------
220 function Os_Default_Priority return Integer is
221 begin
222 return Default_Os_Default_Priority;
223 end Os_Default_Priority;
225 end System.Program_Info;