summaryrefslogtreecommitdiff
path: root/lang/gnat/files/5fosinte.ads
diff options
context:
space:
mode:
Diffstat (limited to 'lang/gnat/files/5fosinte.ads')
-rw-r--r--lang/gnat/files/5fosinte.ads254
1 files changed, 123 insertions, 131 deletions
diff --git a/lang/gnat/files/5fosinte.ads b/lang/gnat/files/5fosinte.ads
index b8ecbec463d3..63d773ae554b 100644
--- a/lang/gnat/files/5fosinte.ads
+++ b/lang/gnat/files/5fosinte.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (Version for new GNARL) --
-- --
--- $Revision: 1.1 $ --
+-- $Revision: 1.5 $ --
-- --
-- Copyright (C) 1991,92,93,94,95,1996 Free Software Foundation, Inc. --
-- --
@@ -39,7 +39,7 @@
-- This is only a first approximation.
-- It should be autogenerated by the m4 macro processor.
--- Contributed by Daniel Eischen (deischen@iworks.InterWorks.org)
+-- Contributed by Daniel Eischen (eischen@vigrid.com)
-- DO NOT EDIT this file.
-- It was automatically generated from another file by the m4 macro processor.
@@ -87,7 +87,7 @@ with Interfaces.C;
package System.OS_Interface is
pragma Preelaborate;
- pragma Linker_Options ("-lc_r");
+ pragma Linker_Options ("-pthread");
subtype int is Interfaces.C.int;
subtype short is Interfaces.C.short;
@@ -250,7 +250,7 @@ package System.OS_Interface is
function sigaction
(sig : Signal;
- act : access struct_sigaction;
+ act : struct_sigaction_ptr;
oact : struct_sigaction_ptr)
return int;
pragma Import (C, sigaction, "sigaction");
@@ -259,6 +259,9 @@ package System.OS_Interface is
-- Time --
----------
+ Time_Slice_Supported : constant boolean := True;
+ -- Indicates wether time slicing is supported (i.e SCHED_RR is supported)
+
type timespec is private;
function nanosleep (rqtp, rmtp : access timespec) return int;
@@ -297,7 +300,7 @@ package System.OS_Interface is
function gettimeofday
(tv : access struct_timeval;
- tz : access struct_timezone) return int;
+ tz : System.Address) return int;
pragma Import (C, gettimeofday, "gettimeofday");
procedure usleep (useconds : unsigned_long);
@@ -309,13 +312,13 @@ package System.OS_Interface is
-- Priority Scheduling --
-------------------------
- MIN_PRIO : constant := 0;
- MAX_PRIO : constant := 126;
+ MIN_PRIO : constant := 0;
+ MAX_PRIO : constant := 126;
+ DEFAULT_PRIO : constant := 64;
- SCHED_RR : constant := 0;
- SCHED_IO : constant := 1;
- SCHED_FIFO : constant := 2;
- SCHED_OTHER : constant := 3;
+ SCHED_FIFO : constant := 1;
+ SCHED_OTHER : constant := 2;
+ SCHED_RR : constant := 3;
-------------
-- Process --
@@ -323,6 +326,8 @@ package System.OS_Interface is
type pid_t is private;
+ Self_PID : constant pid_t;
+
function kill
(pid : pid_t;
sig : Signal)
@@ -351,10 +356,55 @@ package System.OS_Interface is
PTHREAD_CREATE_DETACHED : constant := 1;
PTHREAD_CREATE_JOINABLE : constant := 0;
+ -----------
+ -- Stack --
+ -----------
+
+ Stack_Base_Available : constant boolean := False;
+ -- Indicates wether the stack base is available on this target.
+ -- This allows us to share s-osinte.adb between all the FSU run time.
+ -- Note that this value can only be true if pthread_t has a complete
+ -- definition that corresponds exactly to the C header files.
+
+ function Get_Stack_Base (thread : pthread_t) return Address;
+ pragma Inline (Get_Stack_Base);
+ -- returns the stack base of the specified thread.
+ -- Only call this function when Stack_Base_Available is True.
+
+ function Get_Page_Size return size_t;
+ function Get_Page_Size return Address;
+ pragma Import (C, Get_Page_Size, "getpagesize");
+ -- returns the size of a page, or 0 if this is not relevant on this
+ -- target
+
+ PROT_NONE : constant := 0;
+ PROT_READ : constant := 1;
+ PROT_WRITE : constant := 2;
+ PROT_EXEC : constant := 4;
+ PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
+
+ PROT_ON : constant := PROT_NONE;
+ PROT_OFF : constant := PROT_ALL;
+
+ function mprotect
+ (addr : Address; len : size_t; prot : int) return int;
+ pragma Import (C, mprotect);
+
+ -----------------------------------------
+ -- Nonstandard Thread Initialization --
+ -----------------------------------------
+ -- FSU_THREADS requires pthread_init, which is nonstandard
+ -- and this should be invoked during the elaboration of s-taprop.adb
+ --
+ -- FreeBSD does not require this so we provide an empty Ada body.
+ procedure pthread_init;
+
---------------------------
-- POSIX.1c Section 3 --
---------------------------
+ type sigset_t_ptr is access all sigset_t;
+
function sigwait
(set : access sigset_t;
sig : access Signal)
@@ -369,8 +419,8 @@ package System.OS_Interface is
function pthread_sigmask
(how : int;
- set : access sigset_t;
- oset : access sigset_t)
+ set : sigset_t_ptr;
+ oset : sigset_t_ptr)
return int;
pragma Import (C, pthread_sigmask, "pthread_sigmask");
@@ -472,44 +522,44 @@ package System.OS_Interface is
----------------------------
-- FreeBSD pthreads does not support these yet.
--- PTHREAD_PRIO_NONE : constant := 0;
--- PTHREAD_PRIO_PROTECT : constant := 2;
--- PTHREAD_PRIO_INHERIT : constant := 1;
+ --
+ -- PTHREAD_PRIO_NONE : constant := 0;
+ -- PTHREAD_PRIO_PROTECT : constant := 2;
+ -- PTHREAD_PRIO_INHERIT : constant := 1;
-- FreeBSD doesn't have pthread_getschedparam or pthread_setschedparam
- -- yet. It has pthread_getprio and pthread_setprio, so we use these
- -- instead.
-
--- type struct_sched_param is record
--- prio : int;
--- no_data : System.Address;
--- end record;
--- pragma Convention (C, struct_sched_param);
---
--- function pthread_getschedparam
--- (thread : pthread_t;
--- policy : access int;
--- param : access struct_sched_param)
--- return int;
--- pragma Import (C, pthread_getschedparam, "pthread_getschedparam");
---
--- function pthread_setschedparam
--- (thread : pthread_t;
--- policy : int;
--- param : access struct_sched_param)
--- return int;
--- pragma Import (C, pthread_setschedparam, "pthread_setschedparam");
+ -- yet, but we provide the compliant interface and implement them with
+ -- pthread_getprio and pthread_setprio instead.
+
+ type struct_sched_param is record
+ sched_priority : int;
+ end record;
+ pragma Convention (C, struct_sched_param);
+
+ function sched_getparam
+ (pid : pid_t;
+ param : access struct_sched_param)
+ return int;
+ pragma Import (C, sched_getparam, "sched_getparam");
+
+ function sched_setscheduler
+ (pid : pid_t;
+ policy : int;
+ param : access struct_sched_param)
+ return int;
+ pragma Import (C, sched_setscheduler, "sched_setscheduler");
function pthread_getschedparam
- (thread : pthread_t)
+ (thread : pthread_t;
+ policy : access int;
+ param : access struct_sched_param)
return int;
- pragma Import (C, pthread_getschedparam, "pthread_getprio");
function pthread_setschedparam
- (thread : pthread_t;
- priority : int)
+ (thread : pthread_t;
+ policy : int;
+ param : access struct_sched_param)
return int;
- pragma Import (C, pthread_setschedparam, "pthread_setprio");
function pthread_attr_setscope
(attr : access pthread_attr_t;
@@ -541,45 +591,29 @@ package System.OS_Interface is
(attr : access pthread_attr_t;
policy : int)
return int;
- pragma Import
- (C, pthread_attr_setschedpolicy,
- "pthread_attr_setschedpolicy");
+-- pragma Import
+-- (C, pthread_attr_setschedpolicy,
+-- "pthread_attr_setschedpolicy");
function pthread_attr_getschedpolicy
(attr : access pthread_attr_t;
policy : access int)
return int;
- pragma Import (C, pthread_attr_getschedpolicy,
- "pthread_attr_getschedpolicy");
+-- pragma Import (C, pthread_attr_getschedpolicy,
+-- "pthread_attr_getschedpolicy");
-- FreeBSD doesn't have pthread_attr_setschedparm and
- -- pthread_attr_getschedparm yet. It has pthread_attr_setprio and
- -- pthread_attr_getprio instead. It seems we don't need either one
- -- of these, though.
+ -- pthread_attr_getschedparm yet.
-- function pthread_attr_setschedparam
--- (attr : access pthread_attr_t;
--- sched_param : access struct_sched_param)
+-- (attr : access pthread_attr_t;
+-- param : access struct_sched_param)
-- return int;
--- pragma Import (C, pthread_attr_setschedparam,
--- "pthread_attr_setschedparam");
--
-- function pthread_attr_getschedparam
--- (attr : access pthread_attr_t;
--- sched_param : access struct_sched_param)
+-- (attr : access pthread_attr_t;
+-- param : access struct_sched_param)
-- return int;
--- pragma Import (C, pthread_attr_getschedparam,
--- "pthread_attr_getschedparam");
- function pthread_attr_setschedparam
- (attr : access pthread_attr_t;
- priority : int)
- return int;
- pragma Import (C, pthread_attr_setschedparam, "pthread_attr_setprio");
-
- function pthread_attr_getschedparam
- (attr : access pthread_attr_t)
- return int;
- pragma Import (C, pthread_attr_getschedparam, "pthread_attr_getprio");
function sched_yield return int;
pragma Import (C, sched_yield, "pthread_yield");
@@ -598,8 +632,6 @@ package System.OS_Interface is
return int;
pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
-
-
function pthread_attr_setdetachstate
(attr : access pthread_attr_t;
detachstate : int)
@@ -673,6 +705,16 @@ package System.OS_Interface is
return int;
pragma Import (C, pthread_key_create, "pthread_key_create");
+ --------------------------------------
+ -- Non-portable pthread functions --
+ --------------------------------------
+
+ function pthread_set_name_np
+ (thread : pthread_t;
+ name : System.Address)
+ return int;
+ pragma Import (C, pthread_set_name_np, "pthread_set_name_np");
+
private
@@ -692,6 +734,7 @@ private
-- #define sa_sigaction __funcptr._sigaction
type pid_t is new int;
+ Self_PID : constant pid_t := 0;
type time_t is new long;
@@ -710,66 +753,15 @@ private
end record;
pragma Convention (C, struct_timeval);
+ type record_type_1 is null record;
+ pragma Convention (C, record_type_1);
- type enumeral_type_3 is new int;
- type pthread_attr_t is record
- schedparam_policy : enumeral_type_3;
- prio : int;
- suspend : int;
- flags : int;
- arg_attr : System.Address;
- cleanup_attr : System.Address;
- stackaddr_attr : System.Address;
- stacksize_attr : size_t;
- end record;
- pragma Convention (C, pthread_attr_t);
-
- type enumeral_type_2 is new int;
- type pthread_condattr_t is record
- c_type : enumeral_type_2;
- c_flags : long;
- end record;
- pragma Convention (C, pthread_condattr_t);
-
- type enumeral_type_1 is new int;
- type pthread_mutexattr_t is record
- m_type : enumeral_type_1;
- m_flags : long;
- end record;
- pragma Convention (C, pthread_mutexattr_t);
-
- type record_type_3 is null record;
- pragma Convention (C, record_type_3);
- type pthread_t is access record_type_3;
-
- type enumeral_type_4 is new int;
- type pthread_queue_t is record
- q_next : System.Address;
- q_last : System.Address;
- q_data : System.Address;
- end record;
- pragma Convention (C, pthread_queue_t);
- type union_type_1 is new int;
- type pthread_mutex_t is record
- m_type : enumeral_type_4;
- m_queue : pthread_queue_t;
- m_owner : System.Address;
--- m_lock : long;
- m_data : union_type_1;
- m_flags : long;
- end record;
- pragma Convention (C, pthread_mutex_t);
-
- type enumeral_type_5 is new int;
- type pthread_cond_t is record
- c_type : enumeral_type_5;
- c_queue : pthread_queue_t;
--- c_lock : long;
- c_data : System.Address;
- c_flags : long;
- end record;
- pragma Convention (C, pthread_cond_t);
-
- type pthread_key_t is new int;
+ type pthread_t is access record_type_1;
+ type pthread_attr_t is access record_type_1;
+ type pthread_mutex_t is access record_type_1;
+ type pthread_mutexattr_t is access record_type_1;
+ type pthread_cond_t is access record_type_1;
+ type pthread_condattr_t is access record_type_1;
+ type pthread_key_t is new int;
end System.OS_Interface;