aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnarl/s-osinte__vxworks.ads
diff options
context:
space:
mode:
authorDoug Rupp <rupp@adacore.com>2021-07-23 12:00:04 -0700
committerPierre-Marie de Rodat <derodat@adacore.com>2021-09-22 15:01:48 +0000
commitab621f4ada197ec99f0b9673271c7accaa7925da (patch)
treef6f21f048efd94c0cc0b9683bb12e207c566be55 /gcc/ada/libgnarl/s-osinte__vxworks.ads
parent3d2226f1730e027808b8f9c17d4f6b7ac1eb7c44 (diff)
downloadgcc-ab621f4ada197ec99f0b9673271c7accaa7925da.zip
gcc-ab621f4ada197ec99f0b9673271c7accaa7925da.tar.gz
gcc-ab621f4ada197ec99f0b9673271c7accaa7925da.tar.bz2
[Ada] VxWorks inconsistent use of return type (STATUS)
gcc/ada/ * libgnarl/s-interr__vxworks.adb (Interfaces.C): Remove as unused. (System.VxWorks.Ext): Import. (System.VxWorks.Ext.STATUS): use type. (STATUS): New subtype. (OK): New constant. (Interrupt_Connector): Return STATUS type vice int. (Interrupt_Connect, Notify_Interrupt, Unbind_Handler, Interrupt_Server_Task): Rename Status to Result. Assert Result = OK. * libgnarl/s-osinte__vxworks.adb (To_Clock_Ticks): Define constant IERR, and return it vice ERROR. (Binary_Semaphore_Delete): Return STATUS type vice int. (Binary_Semaphore_Obtain): Likewise. (Binary_Semaphore_Release): Likewise. (Binary_Semaphore_Flush): Likewise. * libgnarl/s-osinte__vxworks.ads (SVE): Renaming of System.VxWorks.Ext. (STATUS): Use SVE in declaration of subtype. (BOOL): Likewise. (vx_freq_t): Likewise. (t_id): Likewise. (gitpid): Use SVE in renaming of subprogram (Task_Stop): Likewise. (Task_Cont): Likewise. (Int_Lock): Likewise. (Int_Unlock): Likewise. (Set_Time_Slice): Likewise. (semDelete): Likewise. (taskCpuAffinitySet): Likewise. (taskMaskAffinitySet): Likewise. (sigset_t): Use SVE in declaration of type. (OK): Remove as unused. (ERROR): Likewise. (taskOptionsGet): return STATUS vice int. (taskSuspend): Likewise. (taskResume): Likewise. (taskDelay): Likewise. (taskVarAdd): Likewise. (taskVarDelete): Likewise. (taskVarSet): Likewise. (tlkKeyCreate): Likewise. (taskPrioritySet): Likewise. (semGive): Likewise. (semTake): Likewise. (Binary_Semaphore_Delete): Likewise. (Binary_Semaphore_Obtain): Likewise. (Binary_Semaphore_Release): Likewise. (Binary_Semaphore_Flush): Likewise. (Interrupt_Connect): Likewise. * libgnarl/s-taprop__vxworks.adb (System.VxWorks.Ext.STATUS): use type. (int): Syntactically align subtype. (STATUS): New subtype. (OK): New constant. (Finalize_Lock): Check STATUS vice int. Assert OK. (Finalize_Lock): Likewise. (Write_Lock): Likewise. (Write_Lock): Likewise. (Write_Lock): Likewise. (Unlock): Likewise. (Unlock): Likewise. (Unlock): Likewise. (Unlock): Likewise. (Sleep): Likewise. (Sleep): Likewise. (Sleep): Likewise. (Timed_Sleep): Likewise and test Result. (Timed_Delay): Likewise and test Result. (Wakeup): Likewise. (Yield): Likewise. (Finalize_TCB): Likewise. (Suspend_Until_True): Check OK. (Stop_All_Tasks): Declare Dummy STATUS vice in. Check OK. (Is_Task_Context): Use OSI renaming. (Initialize): Use STATUS vice int. * libgnarl/s-vxwext.adb (IERR): Renamed from ERROR. (taskCpuAffinitySet): Return IERR (int). (taskMaskAffinitySet): Likewise. * libgnarl/s-vxwext.ads (STATUS): New subtype. (OK): New STATUS constant. (ERROR): Likewise. * libgnarl/s-vxwext__kernel-smp.adb (IERR): Renamed from ERROR. (Int_Lock): Return IERR. (semDelete): Return STATUS. (Task_Cont): Likewise. (Task_Stop): Likewise. * libgnarl/s-vxwext__kernel.adb (IERR): Renamed from ERROR. (semDelete): Return STATUS. (Task_Cont): Likewise. (Task_Stop): Likewise. (taskCpuAffinitySet): Return IERR (int) (taskMaskAffinitySet): Likewise. * libgnarl/s-vxwext__kernel.ads (STATUS): New subtype. (OK): New STATUS constant. (ERROR): Likewise. (Interrupt_Connect): Return STATUS (semDelete): Likewise. (Task_Cont): Likewise. (Task_Stop): Likewise. (Set_Time_Slice): Likewise. * libgnarl/s-vxwext__rtp-smp.adb (IERR): Renamed from ERROR. (Int_Lock): return IERR constant vice ERROR. (Interrupt_Connect): Return STATUS. (semDelete): Likewise. (Set_Time_Slice): Likewise. * libgnarl/s-vxwext__rtp.adb (IERR): Renamed from ERROR. (Int_Lock): return IERR constant vice ERROR. (Int_Unlock): Return STATUS. (semDelete): Likewise. (Set_Time_Slice): Likewise. (taskCpuAffinitySet): Return IERR (int) (taskMaskAffinitySet): Likewise. * libgnarl/s-vxwext__rtp.ads (STATUS): New subtype. (OK): New STATUS constant. (ERROR): Likewise. (Interrupt_Connect): Return STATUS (semDelete): Likewise. (Task_Cont): Likewise. (Task_Stop): Likewise. (Set_Time_Slice): Likewise.
Diffstat (limited to 'gcc/ada/libgnarl/s-osinte__vxworks.ads')
-rw-r--r--gcc/ada/libgnarl/s-osinte__vxworks.ads76
1 files changed, 35 insertions, 41 deletions
diff --git a/gcc/ada/libgnarl/s-osinte__vxworks.ads b/gcc/ada/libgnarl/s-osinte__vxworks.ads
index d4ed479..a63b922 100644
--- a/gcc/ada/libgnarl/s-osinte__vxworks.ads
+++ b/gcc/ada/libgnarl/s-osinte__vxworks.ads
@@ -47,6 +47,8 @@ with System.Parameters;
package System.OS_Interface is
pragma Preelaborate;
+ package SVE renames System.VxWorks.Ext;
+
subtype int is Interfaces.C.int;
subtype unsigned is Interfaces.C.unsigned;
subtype short is Short_Integer;
@@ -57,8 +59,9 @@ package System.OS_Interface is
type unsigned_long_long is mod 2 ** long_long'Size;
type size_t is mod 2 ** Standard'Address_Size;
- subtype BOOL is System.VxWorks.Ext.BOOL;
- subtype vx_freq_t is System.VxWorks.Ext.vx_freq_t;
+ subtype STATUS is SVE.STATUS;
+ subtype BOOL is SVE.BOOL;
+ subtype vx_freq_t is SVE.vx_freq_t;
-----------
-- Errno --
@@ -204,7 +207,7 @@ package System.OS_Interface is
oset : access sigset_t) return int;
pragma Import (C, pthread_sigmask, "sigprocmask");
- subtype t_id is System.VxWorks.Ext.t_id;
+ subtype t_id is SVE.t_id;
subtype Thread_Id is t_id;
-- Thread_Id and t_id are VxWorks identifiers for tasks. This value,
-- although represented as a Long_Integer, is in fact an address. With
@@ -214,26 +217,24 @@ package System.OS_Interface is
function kill (pid : t_id; sig : Signal) return int;
pragma Inline (kill);
- function getpid return t_id renames System.VxWorks.Ext.getpid;
+ function getpid return t_id renames SVE.getpid;
- function Task_Stop (tid : t_id) return int
- renames System.VxWorks.Ext.Task_Stop;
+ function Task_Stop (tid : t_id) return STATUS renames SVE.Task_Stop;
-- If we are in the kernel space, stop the task whose t_id is given in
-- parameter in such a way that it can be examined by the debugger. This
-- typically maps to taskSuspend on VxWorks 5 and to taskStop on VxWorks 6.
- function Task_Cont (tid : t_id) return int
- renames System.VxWorks.Ext.Task_Cont;
+ function Task_Cont (tid : t_id) return STATUS renames SVE.Task_Cont;
-- If we are in the kernel space, continue the task whose t_id is given
-- in parameter if it has been stopped previously to be examined by the
-- debugger (e.g. by taskStop). It typically maps to taskResume on VxWorks
-- 5 and to taskCont on VxWorks 6.
- function Int_Lock return int renames System.VxWorks.Ext.Int_Lock;
+ function Int_Lock return int renames SVE.Int_Lock;
-- If we are in the kernel space, lock interrupts. It typically maps to
-- intLock.
- procedure Int_Unlock (Old : int) renames System.VxWorks.Ext.Int_Unlock;
+ procedure Int_Unlock (Old : int) renames SVE.Int_Unlock;
-- If we are in the kernel space, unlock interrupts. It typically maps to
-- intUnlock. The parameter Old is only used on PowerPC where it contains
-- the returned value from Int_Lock (the old MPSR).
@@ -287,31 +288,25 @@ package System.OS_Interface is
-- VxWorks specific API --
--------------------------
- subtype STATUS is int;
- -- Equivalent of the C type STATUS
-
- OK : constant STATUS := 0;
- ERROR : constant STATUS := Interfaces.C.int (-1);
-
function taskIdVerify (tid : t_id) return STATUS;
pragma Import (C, taskIdVerify, "taskIdVerify");
function taskIdSelf return t_id;
pragma Import (C, taskIdSelf, "taskIdSelf");
- function taskOptionsGet (tid : t_id; pOptions : access int) return int;
+ function taskOptionsGet (tid : t_id; pOptions : access int) return STATUS;
pragma Import (C, taskOptionsGet, "taskOptionsGet");
- function taskSuspend (tid : t_id) return int;
+ function taskSuspend (tid : t_id) return STATUS;
pragma Import (C, taskSuspend, "taskSuspend");
- function taskResume (tid : t_id) return int;
+ function taskResume (tid : t_id) return STATUS;
pragma Import (C, taskResume, "taskResume");
function taskIsSuspended (tid : t_id) return BOOL;
pragma Import (C, taskIsSuspended, "taskIsSuspended");
- function taskDelay (ticks : int) return int;
+ function taskDelay (ticks : int) return STATUS;
pragma Import (C, taskDelay, "taskDelay");
function sysClkRateGet return vx_freq_t;
@@ -322,17 +317,17 @@ package System.OS_Interface is
-- taskVarLib: eg VxWorks 6 RTPs
function taskVarAdd
- (tid : t_id; pVar : access System.Address) return int;
+ (tid : t_id; pVar : access System.Address) return STATUS;
pragma Import (C, taskVarAdd, "taskVarAdd");
function taskVarDelete
- (tid : t_id; pVar : access System.Address) return int;
+ (tid : t_id; pVar : access System.Address) return STATUS;
pragma Import (C, taskVarDelete, "taskVarDelete");
function taskVarSet
(tid : t_id;
pVar : access System.Address;
- value : System.Address) return int;
+ value : System.Address) return STATUS;
pragma Import (C, taskVarSet, "taskVarSet");
function taskVarGet
@@ -345,7 +340,7 @@ package System.OS_Interface is
-- Can only be called from the VxWorks 6 run-time libary that supports
-- tlsLib, and not by the VxWorks 6.6 SMP library
- function tlsKeyCreate return int;
+ function tlsKeyCreate return STATUS;
pragma Import (C, tlsKeyCreate, "tlsKeyCreate");
function tlsValueGet (key : int) return System.Address;
@@ -381,15 +376,15 @@ package System.OS_Interface is
procedure taskDelete (tid : t_id);
pragma Import (C, taskDelete, "taskDelete");
- function Set_Time_Slice (ticks : int) return int
- renames System.VxWorks.Ext.Set_Time_Slice;
+ function Set_Time_Slice (ticks : int) return STATUS renames
+ SVE.Set_Time_Slice;
-- Calls kernelTimeSlice under VxWorks 5.x, VxWorks 653, or in VxWorks 6
-- kernel apps. Returns ERROR for RTPs, VxWorks 5 /CERT
- function taskPriorityGet (tid : t_id; pPriority : access int) return int;
+ function taskPriorityGet (tid : t_id; pPriority : access int) return STATUS;
pragma Import (C, taskPriorityGet, "taskPriorityGet");
- function taskPrioritySet (tid : t_id; newPriority : int) return int;
+ function taskPrioritySet (tid : t_id; newPriority : int) return STATUS;
pragma Import (C, taskPrioritySet, "taskPrioritySet");
-- Semaphore creation flags
@@ -421,7 +416,7 @@ package System.OS_Interface is
-- semTake() timeout with ticks > NO_WAIT
S_objLib_OBJ_TIMEOUT : constant := M_objLib + 4;
- subtype SEM_ID is System.VxWorks.Ext.SEM_ID;
+ subtype SEM_ID is SVE.SEM_ID;
-- typedef struct semaphore *SEM_ID;
-- We use two different kinds of VxWorks semaphores: mutex and binary
@@ -435,14 +430,13 @@ package System.OS_Interface is
function semMCreate (options : int) return SEM_ID;
pragma Import (C, semMCreate, "semMCreate");
- function semDelete (Sem : SEM_ID) return int
- renames System.VxWorks.Ext.semDelete;
+ function semDelete (Sem : SEM_ID) return STATUS renames SVE.semDelete;
-- Delete a semaphore
- function semGive (Sem : SEM_ID) return int;
+ function semGive (Sem : SEM_ID) return STATUS;
pragma Import (C, semGive, "semGive");
- function semTake (Sem : SEM_ID; timeout : int) return int;
+ function semTake (Sem : SEM_ID; timeout : int) return STATUS;
pragma Import (C, semTake, "semTake");
-- Attempt to take binary semaphore. Error is returned if operation
-- times out
@@ -460,16 +454,16 @@ package System.OS_Interface is
function Binary_Semaphore_Create return Binary_Semaphore_Id;
pragma Inline (Binary_Semaphore_Create);
- function Binary_Semaphore_Delete (ID : Binary_Semaphore_Id) return int;
+ function Binary_Semaphore_Delete (ID : Binary_Semaphore_Id) return STATUS;
pragma Inline (Binary_Semaphore_Delete);
- function Binary_Semaphore_Obtain (ID : Binary_Semaphore_Id) return int;
+ function Binary_Semaphore_Obtain (ID : Binary_Semaphore_Id) return STATUS;
pragma Inline (Binary_Semaphore_Obtain);
- function Binary_Semaphore_Release (ID : Binary_Semaphore_Id) return int;
+ function Binary_Semaphore_Release (ID : Binary_Semaphore_Id) return STATUS;
pragma Inline (Binary_Semaphore_Release);
- function Binary_Semaphore_Flush (ID : Binary_Semaphore_Id) return int;
+ function Binary_Semaphore_Flush (ID : Binary_Semaphore_Id) return STATUS;
pragma Inline (Binary_Semaphore_Flush);
------------------------------------------------------------
@@ -484,7 +478,7 @@ package System.OS_Interface is
function Interrupt_Connect
(Vector : Interrupt_Vector;
Handler : Interrupt_Handler;
- Parameter : System.Address := System.Null_Address) return int;
+ Parameter : System.Address := System.Null_Address) return STATUS;
pragma Inline (Interrupt_Connect);
-- Use this to set up an user handler. The routine installs a user handler
-- which is invoked after the OS has saved enough context for a high-level
@@ -505,12 +499,12 @@ package System.OS_Interface is
--------------------------------
function taskCpuAffinitySet (tid : t_id; CPU : int) return int
- renames System.VxWorks.Ext.taskCpuAffinitySet;
+ renames SVE.taskCpuAffinitySet;
-- For SMP run-times the affinity to CPU.
-- For uniprocessor systems return ERROR status.
function taskMaskAffinitySet (tid : t_id; CPU_Set : unsigned) return int
- renames System.VxWorks.Ext.taskMaskAffinitySet;
+ renames SVE.taskMaskAffinitySet;
-- For SMP run-times the affinity to CPU_Set.
-- For uniprocessor systems return ERROR status.
@@ -526,5 +520,5 @@ private
ERROR_PID : constant pid_t := -1;
- type sigset_t is new System.VxWorks.Ext.sigset_t;
+ type sigset_t is new SVE.sigset_t;
end System.OS_Interface;