From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/ada/s-proinf-irix-athread.adb | 225 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 gcc/ada/s-proinf-irix-athread.adb (limited to 'gcc/ada/s-proinf-irix-athread.adb') diff --git a/gcc/ada/s-proinf-irix-athread.adb b/gcc/ada/s-proinf-irix-athread.adb new file mode 100644 index 000000000..31e4dccf8 --- /dev/null +++ b/gcc/ada/s-proinf-irix-athread.adb @@ -0,0 +1,225 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT COMPILER COMPONENTS -- +-- -- +-- S Y S T E M . P R O G R A M _ I N F O -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 1997-2009, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- +-- -- +-- As a special exception under Section 7 of GPL version 3, you are granted -- +-- additional permissions described in the GCC Runtime Library Exception, -- +-- version 3.1, as published by the Free Software Foundation. -- +-- -- +-- You should have received a copy of the GNU General Public License and -- +-- a copy of the GCC Runtime Library Exception along with this program; -- +-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- +-- . -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This is an Irix (old pthread library) version of this package + +-- This package contains the parameters used by the run-time system at +-- program startup. These parameters are isolated in this package body to +-- facilitate replacement by the end user. +-- +-- To replace the default values, copy this source file into your build +-- directory, edit the file to reflect your desired behavior, and recompile +-- with the command: +-- +-- % gcc -c -O2 -gnatpg s-proinf.adb +-- +-- then relink your application as usual. + +pragma Warnings (Off); -- why??? +with System.OS_Lib; +pragma Warnings (On); + +package body System.Program_Info is + + Kbytes : constant := 1024; + + Default_Initial_Sproc_Count : constant := 0; + Default_Max_Sproc_Count : constant := 128; + Default_Sproc_Stack_Size : constant := 16#4000#; + Default_Stack_Guard_Pages : constant := 1; + Default_Default_Time_Slice : constant := 0.0; + Default_Default_Task_Stack : constant := 12 * Kbytes; + Default_Pthread_Sched_Signal : constant := 35; + Default_Pthread_Arena_Size : constant := 16#40000#; + Default_Os_Default_Priority : constant := 0; + + ------------------------- + -- Initial_Sproc_Count -- + ------------------------- + + function Initial_Sproc_Count return Integer is + + function sysmp (P1 : Integer) return Integer; + pragma Import (C, sysmp, "sysmp", "sysmp"); + + MP_NPROCS : constant := 1; -- # processor in complex + + Pthread_Sproc_Count : constant System.OS_Lib.String_Access := + System.OS_Lib.Getenv ("PTHREAD_SPROC_COUNT"); + + begin + if Pthread_Sproc_Count.all'Length = 0 then + return Default_Initial_Sproc_Count; + + elsif Pthread_Sproc_Count.all = "AUTO" then + return sysmp (MP_NPROCS); + + else + return Integer'Value (Pthread_Sproc_Count.all); + end if; + + exception + when others => + return Default_Initial_Sproc_Count; + end Initial_Sproc_Count; + + --------------------- + -- Max_Sproc_Count -- + --------------------- + + function Max_Sproc_Count return Integer is + Pthread_Max_Sproc_Count : constant System.OS_Lib.String_Access := + System.OS_Lib.Getenv ("PTHREAD_MAX_SPROC_COUNT"); + + begin + if Pthread_Max_Sproc_Count.all'Length = 0 then + return Default_Max_Sproc_Count; + else + return Integer'Value (Pthread_Max_Sproc_Count.all); + end if; + exception + when others => + return Default_Max_Sproc_Count; + end Max_Sproc_Count; + + ---------------------- + -- Sproc_Stack_Size -- + ---------------------- + + function Sproc_Stack_Size return Integer is + begin + return Default_Sproc_Stack_Size; + end Sproc_Stack_Size; + + ------------------------ + -- Default_Time_Slice -- + ------------------------ + + function Default_Time_Slice return Duration is + Pthread_Time_Slice_Sec : constant System.OS_Lib.String_Access := + System.OS_Lib.Getenv + ("PTHREAD_TIME_SLICE_SEC"); + Pthread_Time_Slice_Usec : constant System.OS_Lib.String_Access := + System.OS_Lib.Getenv + ("PTHREAD_TIME_SLICE_USEC"); + + Val_Sec, Val_Usec : Integer := 0; + + begin + if Pthread_Time_Slice_Sec.all'Length /= 0 or + Pthread_Time_Slice_Usec.all'Length /= 0 + then + if Pthread_Time_Slice_Sec.all'Length /= 0 then + Val_Sec := Integer'Value (Pthread_Time_Slice_Sec.all); + end if; + + if Pthread_Time_Slice_Usec.all'Length /= 0 then + Val_Usec := Integer'Value (Pthread_Time_Slice_Usec.all); + end if; + + return Duration (Val_Sec) + Duration (Val_Usec) / 1000.0; + else + return Default_Default_Time_Slice; + end if; + + exception + when others => + return Default_Default_Time_Slice; + end Default_Time_Slice; + + ------------------------ + -- Default_Task_Stack -- + ------------------------ + + function Default_Task_Stack return Integer is + begin + return Default_Default_Task_Stack; + end Default_Task_Stack; + + ----------------------- + -- Stack_Guard_Pages -- + ----------------------- + + function Stack_Guard_Pages return Integer is + Pthread_Stack_Guard_Pages : constant System.OS_Lib.String_Access := + System.OS_Lib.Getenv + ("PTHREAD_STACK_GUARD_PAGES"); + begin + if Pthread_Stack_Guard_Pages.all'Length /= 0 then + return Integer'Value (Pthread_Stack_Guard_Pages.all); + else + return Default_Stack_Guard_Pages; + end if; + exception + when others => + return Default_Stack_Guard_Pages; + end Stack_Guard_Pages; + + -------------------------- + -- Pthread_Sched_Signal -- + -------------------------- + + function Pthread_Sched_Signal return Integer is + begin + return Default_Pthread_Sched_Signal; + end Pthread_Sched_Signal; + + ------------------------ + -- Pthread_Arena_Size -- + ------------------------ + + function Pthread_Arena_Size return Integer is + Pthread_Arena_Size : constant System.OS_Lib.String_Access := + System.OS_Lib.Getenv + ("PTHREAD_ARENA_SIZE"); + + begin + if Pthread_Arena_Size.all'Length = 0 then + return Default_Pthread_Arena_Size; + else + return Integer'Value (Pthread_Arena_Size.all); + end if; + + exception + when others => + return Default_Pthread_Arena_Size; + end Pthread_Arena_Size; + + ------------------------- + -- Os_Default_Priority -- + ------------------------- + + function Os_Default_Priority return Integer is + begin + return Default_Os_Default_Priority; + end Os_Default_Priority; + +end System.Program_Info; -- cgit v1.2.3