summaryrefslogtreecommitdiff
path: root/gcc/ada/s-osinte-aix.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-31 17:45:11 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-31 17:45:11 +0000
commit4503aa6e08e282190851174dcb3ebbb90d509d85 (patch)
tree2abe81e1eeecf6b4534b5efbc0cf38263b6afcac /gcc/ada/s-osinte-aix.adb
parentd68c9dadbe2c8fda2039b574af7201427c09a77e (diff)
downloadgcc-4503aa6e08e282190851174dcb3ebbb90d509d85.tar.gz
2006-10-31 Arnaud Charlet <charlet@adacore.com>
Jose Ruiz <ruiz@adacore.com> * s-osinte-posix.adb, s-osinte-linux.ads, s-osinte-freebsd.adb, s-osinte-freebsd.ads, s-osinte-solaris-posix.ads, s-osinte-hpux.ads, s-osinte-darwin.adb, s-osinte-darwin.ads, s-osinte-lynxos-3.ads, s-osinte-lynxos-3.adb (To_Target_Priority): New function maps from System.Any_Priority to a POSIX priority on the target. * system-linux-ia64.ads: Extend range of Priority types on Linux to use the whole range made available by the system. * s-osinte-aix.adb, s-osinte-aix.ads (To_Target_Priority): New function maps from System.Any_Priority to a POSIX priority on the target. (PTHREAD_PRIO_PROTECT): Set real value. (PTHREAD_PRIO_INHERIT): Now a function. (SIGCPUFAIL): New signal. (Reserved): Add SIGALRM1, SIGWAITING, SIGCPUFAIL, since these signals are documented as reserved by the OS. * system-aix.ads: Use the full range of priorities provided by the system on AIX. * s-taprop-posix.adb: Call new function To_Target_Priority. (Set_Priority): Take into account Task_Dispatching_Policy and Priority_Specific_Dispatching pragmas when determining if Round Robin must be used for scheduling the task. * system-linux-x86_64.ads, system-linux-x86.ads, system-linux-ppc.ads: Extend range of Priority types on Linux to use the whole range made available by the system. * s-taprop-vms.adb, s-taprop-mingw.adb, s-taprop-irix.adb, s-taprop-tru64.adb, s-taprop-linux.adb, s-taprop-hpux-dce.adb, s-taprop-lynxos.adb (Finalize_TCB): invalidate the stack-check cache when deallocating the TCB in order to avoid potential references to deallocated data. (Set_Priority): Take into account Task_Dispatching_Policy and Priority_Specific_Dispatching pragmas when determining if Round Robin or FIFO within priorities must be used for scheduling the task. * s-taprop-vxworks.adb (Enter_Task): Store the user-level task id in the Thread field (to be used internally by the run-time system) and the kernel-level task id in the LWP field (to be used by the debugger). (Create_Task): Reorganize to unify the calls to taskSpawn into a single instance, and propagate the current task options to the spawned task. (Set_Priority): Take into account Priority_Specific_Dispatching pragmas. (Initialize): Set Round Robin dispatching when the corresponding pragma is in effect. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118235 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-osinte-aix.adb')
-rw-r--r--gcc/ada/s-osinte-aix.adb85
1 files changed, 82 insertions, 3 deletions
diff --git a/gcc/ada/s-osinte-aix.adb b/gcc/ada/s-osinte-aix.adb
index bef7de50f99..b56282b251b 100644
--- a/gcc/ada/s-osinte-aix.adb
+++ b/gcc/ada/s-osinte-aix.adb
@@ -55,6 +55,20 @@ package body System.OS_Interface is
return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
end To_Duration;
+ ------------------------
+ -- To_Target_Priority --
+ ------------------------
+
+ function To_Target_Priority
+ (Prio : System.Any_Priority) return Interfaces.C.int
+ is
+ begin
+ -- Priorities on AIX are defined in the range 1 .. 127, so we
+ -- map 0 .. 126 to 1 .. 127.
+
+ return Interfaces.C.int (Prio) + 1;
+ end To_Target_Priority;
+
-----------------
-- To_Timespec --
-----------------
@@ -138,20 +152,85 @@ package body System.OS_Interface is
-- AIX Thread does not have sched_yield;
function sched_yield return int is
-
procedure pthread_yield;
pragma Import (C, pthread_yield, "sched_yield");
-
begin
pthread_yield;
return 0;
end sched_yield;
+ --------------------
+ -- Get_Stack_Base --
+ --------------------
+
function Get_Stack_Base (thread : pthread_t) return Address is
pragma Warnings (Off, thread);
-
begin
return Null_Address;
end Get_Stack_Base;
+ --------------------------
+ -- PTHREAD_PRIO_INHERIT --
+ --------------------------
+
+ AIX_Version : Integer := 0;
+ -- AIX version in the form xy for AIX version x.y (0 means not set)
+
+ SYS_NMLN : constant := 32;
+ -- AIX system constant used to define utsname, see sys/utsname.h
+
+ subtype String_NMLN is String (1 .. SYS_NMLN);
+
+ type utsname is record
+ sysname : String_NMLN;
+ nodename : String_NMLN;
+ release : String_NMLN;
+ version : String_NMLN;
+ machine : String_NMLN;
+ procserial : String_NMLN;
+ end record;
+ pragma Convention (C, utsname);
+
+ procedure uname (name : out utsname);
+ pragma Import (C, uname);
+
+ function PTHREAD_PRIO_INHERIT return int is
+ name : utsname;
+
+ function Val (C : Character) return Integer;
+ -- Transform a numeric character ('0' .. '9') to an integer
+
+ ---------
+ -- Val --
+ ---------
+
+ function Val (C : Character) return Integer is
+ begin
+ return Character'Pos (C) - Character'Pos ('0');
+ end Val;
+
+ -- Start of processing for PTHREAD_PRIO_INHERIT
+
+ begin
+ if AIX_Version = 0 then
+
+ -- Set AIX_Version
+
+ uname (name);
+ AIX_Version := Val (name.version (1)) * 10 + Val (name.release (1));
+ end if;
+
+ if AIX_Version < 53 then
+
+ -- Under AIX < 5.3, PTHREAD_PRIO_INHERIT is defined as 0 in pthread.h
+
+ return 0;
+
+ else
+ -- Under AIX >= 5.3, PTHREAD_PRIO_INHERIT is defined as 3
+
+ return 3;
+ end if;
+ end PTHREAD_PRIO_INHERIT;
+
end System.OS_Interface;