OSDN Git Service

* Make-lang.in (gnat_ug_unx.info): Add dependency on stmp-docobjdir.
[pf3gnuchains/gcc-fork.git] / gcc / ada / 5qosinte.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS               --
4 --                                                                          --
5 --                   S Y S T E M . O S _ I N T E R F A C E                  --
6 --                                                                          --
7 --                                  S p e c                                 --
8 --                                                                          --
9 --             Copyright (C) 1991-2001 Florida State University             --
10 --                                                                          --
11 -- GNARL 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 2,  or (at your option) any later ver- --
14 -- sion. GNARL 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.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNARL; see file COPYING.  If not, write --
19 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
20 -- MA 02111-1307, USA.                                                      --
21 --                                                                          --
22 -- As a special exception,  if other files  instantiate  generics from this --
23 -- unit, or you link  this unit with other files  to produce an executable, --
24 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
25 -- covered  by the  GNU  General  Public  License.  This exception does not --
26 -- however invalidate  any other reasons why  the executable file  might be --
27 -- covered by the  GNU Public License.                                      --
28 --                                                                          --
29 -- GNARL was developed by the GNARL team at Florida State University. It is --
30 -- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
31 -- State University (http://www.gnat.com).                                  --
32 --                                                                          --
33 ------------------------------------------------------------------------------
34
35 --  RT GNU/Linux version.
36
37 --  This package encapsulates all direct interfaces to OS services
38 --  that are needed by children of System.
39
40 --  PLEASE DO NOT add any with-clauses to this package
41 --  or remove the pragma Elaborate_Body.
42 --  It is designed to be a bottom-level (leaf) package.
43
44 with Interfaces.C;
45
46 package System.OS_Interface is
47
48    pragma Preelaborate;
49
50    subtype int            is Interfaces.C.int;
51    subtype unsigned_long  is Interfaces.C.unsigned_long;
52
53    --  RT GNU/Linux kernel threads should not use the
54    --  OS signal interfaces.
55
56    Max_Interrupt : constant := 2;
57    type Signal is new int range 0 .. Max_Interrupt;
58    type sigset_t is new Integer;
59
60    ----------
61    -- Time --
62    ----------
63
64    RT_TICKS_PER_SEC : constant := 1193180;
65    --  the amount of time units in one second.
66
67    RT_TIME_END : constant := 16#7fffFfffFfffFfff#;
68
69    type RTIME is range -2 ** 63 .. 2 ** 63 - 1;
70    --  the introduction of type RTIME is due to the fact that RT-GNU/Linux
71    --  uses this type to represent time. In RT-GNU/Linux, it's a long long
72    --  integer that takes 64 bits for storage
73
74    -------------------------
75    -- Priority Scheduling --
76    -------------------------
77
78    RT_LOWEST_PRIORITY : constant System.Any_Priority :=
79      System.Any_Priority'First;
80    --  for the lowest priority task in RT-GNU/Linux. By the design, this
81    --  task is the regular GNU/Linux kernel.
82
83    RT_TASK_MAGIC : constant := 16#754d2774#;
84    --  a special constant used as a label for a task that has been created
85
86    ----------------------------
87    -- RT constants and types --
88    ----------------------------
89
90    SFIF : Integer;
91    pragma Import (C, SFIF, "SFIF");
92    --  Interrupt emulation flag used by RT-GNU/Linux. If it's 0, the regular
93    --  GNU/Linux kernel is preempted. Otherwise, the regular Linux kernel is
94    --  running
95
96    GFP_ATOMIC : constant := 16#1#;
97    GFP_KERNEL : constant := 16#3#;
98    --  constants to indicate the priority of a call to kmalloc.
99    --  GFP_KERNEL is used in the current implementation to allocate
100    --  stack space for a task. Since GFP_ATOMIC has higher priority,
101    --  if necessary, replace GFP_KERNEL with GFP_ATOMIC
102
103    type Rt_Task_States is (RT_TASK_READY, RT_TASK_DELAYED, RT_TASK_DORMANT);
104
105    -------------
106    -- Threads --
107    -------------
108
109    type Thread_Body is access
110      function (arg : System.Address) return System.Address;
111
112    --  ??? need to define a type for references to (IDs of)
113    --  RT GNU/Linux lock objects, and implement the lock objects.
114
115    subtype Thread_Id is System.Address;
116
117    -------------------------------
118    -- Useful imported functions --
119    -------------------------------
120
121    -------------------------------------
122    -- Functions from GNU/Linux kernel --
123    -------------------------------------
124
125    function Kmalloc (size : Integer; Priority : Integer) return System.Address;
126    pragma Import (C, Kmalloc, "kmalloc");
127
128    procedure Kfree (Ptr : System.Address);
129    pragma Import (C, Kfree, "kfree");
130
131    procedure Printk (Msg : String);
132    pragma Import (C, Printk, "printk");
133
134    ---------------------
135    -- RT time related --
136    ---------------------
137
138    function Rt_Get_Time return RTIME;
139    pragma Import (C, Rt_Get_Time, "rt_get_time");
140
141    function Rt_Request_Timer (Fn : System.Address) return Integer;
142    procedure Rt_Request_Timer (Fn : System.Address);
143    pragma Import (C, Rt_Request_Timer, "rt_request_timer");
144
145    procedure Rt_Free_Timer;
146    pragma Import (C, Rt_Free_Timer, "rt_free_timer");
147
148    procedure Rt_Set_Timer (T : RTIME);
149    pragma Import (C, Rt_Set_Timer, "rt_set_timer");
150
151    procedure Rt_No_Timer;
152    pragma Import (C, Rt_No_Timer, "rt_no_timer");
153
154    ---------------------
155    -- RT FIFO related --
156    ---------------------
157
158    function Rtf_Create (Fifo : Integer; Size : Integer) return Integer;
159    pragma Import (C, Rtf_Create, "rtf_create");
160
161    function Rtf_Destroy (Fifo : Integer) return Integer;
162    pragma Import (C, Rtf_Destroy, "rtf_destroy");
163
164    function Rtf_Resize (Minor : Integer; Size : Integer) return Integer;
165    pragma Import (C, Rtf_Resize, "rtf_resize");
166
167    function Rtf_Put
168      (Fifo  : Integer;
169       Buf   : System.Address;
170       Count : Integer) return Integer;
171    pragma Import (C, Rtf_Put, "rtf_put");
172
173    function Rtf_Get
174      (Fifo  : Integer;
175       Buf   : System.Address;
176       Count : Integer) return Integer;
177    pragma Import (C, Rtf_Get, "rtf_get");
178
179    function Rtf_Create_Handler
180      (Fifo    : Integer;
181       Handler : System.Address) return Integer;
182    pragma Import (C, Rtf_Create_Handler, "rtf_create_handler");
183
184 private
185    type Require_Body;
186 end System.OS_Interface;