OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [s-osinte-hpux-dce.ads] - Blame information for rev 750

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                 GNAT 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-1994, Florida State University            --
10
--          Copyright (C) 1995-2011, Free Software Foundation, Inc.         --
11
--                                                                          --
12
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
13
-- terms of the  GNU General Public License as published  by the Free Soft- --
14
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
15
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
16
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
17
-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
18
--                                                                          --
19
-- As a special exception under Section 7 of GPL version 3, you are granted --
20
-- additional permissions described in the GCC Runtime Library Exception,   --
21
-- version 3.1, as published by the Free Software Foundation.               --
22
--                                                                          --
23
-- You should have received a copy of the GNU General Public License and    --
24
-- a copy of the GCC Runtime Library Exception along with this program;     --
25
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
26
-- <http://www.gnu.org/licenses/>.                                          --
27
--                                                                          --
28
-- GNARL was developed by the GNARL team at Florida State University.       --
29
-- Extensive contributions were provided by Ada Core Technologies, Inc.     --
30
--                                                                          --
31
------------------------------------------------------------------------------
32
 
33
--  This is the HP-UX version of this package
34
 
35
--  This package encapsulates all direct interfaces to OS services
36
--  that are needed by the tasking run-time (libgnarl).
37
 
38
--  PLEASE DO NOT add any with-clauses to this package or remove the pragma
39
--  Preelaborate. This package is designed to be a bottom-level (leaf) package.
40
 
41
with Ada.Unchecked_Conversion;
42
 
43
with Interfaces.C;
44
 
45
package System.OS_Interface is
46
   pragma Preelaborate;
47
 
48
   pragma Linker_Options ("-lcma");
49
 
50
   subtype int            is Interfaces.C.int;
51
   subtype short          is Interfaces.C.short;
52
   subtype long           is Interfaces.C.long;
53
   subtype unsigned       is Interfaces.C.unsigned;
54
   subtype unsigned_short is Interfaces.C.unsigned_short;
55
   subtype unsigned_long  is Interfaces.C.unsigned_long;
56
   subtype unsigned_char  is Interfaces.C.unsigned_char;
57
   subtype plain_char     is Interfaces.C.plain_char;
58
   subtype size_t         is Interfaces.C.size_t;
59
 
60
   -----------
61
   -- Errno --
62
   -----------
63
 
64
   function errno return int;
65
   pragma Import (C, errno, "__get_errno");
66
 
67
   EAGAIN    : constant := 11;
68
   EINTR     : constant := 4;
69
   EINVAL    : constant := 22;
70
   ENOMEM    : constant := 12;
71
   ETIME     : constant := 52;
72
   ETIMEDOUT : constant := 238;
73
 
74
   FUNC_ERR : constant := -1;
75
 
76
   -------------
77
   -- Signals --
78
   -------------
79
 
80
   Max_Interrupt : constant := 44;
81
   type Signal is new int range 0 .. Max_Interrupt;
82
   for Signal'Size use int'Size;
83
 
84
   SIGHUP     : constant := 1; --  hangup
85
   SIGINT     : constant := 2; --  interrupt (rubout)
86
   SIGQUIT    : constant := 3; --  quit (ASCD FS)
87
   SIGILL     : constant := 4; --  illegal instruction (not reset)
88
   SIGTRAP    : constant := 5; --  trace trap (not reset)
89
   SIGIOT     : constant := 6; --  IOT instruction
90
   SIGABRT    : constant := 6; --  used by abort, replace SIGIOT in the  future
91
   SIGEMT     : constant := 7; --  EMT instruction
92
   SIGFPE     : constant := 8; --  floating point exception
93
   SIGKILL    : constant := 9; --  kill (cannot be caught or ignored)
94
   SIGBUS     : constant := 10; --  bus error
95
   SIGSEGV    : constant := 11; --  segmentation violation
96
   SIGSYS     : constant := 12; --  bad argument to system call
97
   SIGPIPE    : constant := 13; --  write on a pipe with no one to read it
98
   SIGALRM    : constant := 14; --  alarm clock
99
   SIGTERM    : constant := 15; --  software termination signal from kill
100
   SIGUSR1    : constant := 16; --  user defined signal 1
101
   SIGUSR2    : constant := 17; --  user defined signal 2
102
   SIGCLD     : constant := 18; --  alias for SIGCHLD
103
   SIGCHLD    : constant := 18; --  child status change
104
   SIGPWR     : constant := 19; --  power-fail restart
105
   SIGVTALRM  : constant := 20; --  virtual timer alarm
106
   SIGPROF    : constant := 21; --  profiling timer alarm
107
   SIGIO      : constant := 22; --  asynchronous I/O
108
   SIGPOLL    : constant := 22; --  pollable event occurred
109
   SIGWINCH   : constant := 23; --  window size change
110
   SIGSTOP    : constant := 24; --  stop (cannot be caught or ignored)
111
   SIGTSTP    : constant := 25; --  user stop requested from tty
112
   SIGCONT    : constant := 26; --  stopped process has been continued
113
   SIGTTIN    : constant := 27; --  background tty read attempted
114
   SIGTTOU    : constant := 28; --  background tty write attempted
115
   SIGURG     : constant := 29; --  urgent condition on IO channel
116
   SIGLOST    : constant := 30; --  remote lock lost  (NFS)
117
   SIGDIL     : constant := 32; --  DIL signal
118
   SIGXCPU    : constant := 33; --  CPU time limit exceeded (setrlimit)
119
   SIGXFSZ    : constant := 34; --  file size limit exceeded (setrlimit)
120
 
121
   SIGADAABORT : constant := SIGABRT;
122
   --  Note: on other targets, we usually use SIGABRT, but on HP/UX, it
123
   --  appears that SIGABRT can't be used in sigwait(), so we use SIGTERM.
124
 
125
   type Signal_Set is array (Natural range <>) of Signal;
126
 
127
   Unmasked    : constant Signal_Set :=
128
     (SIGBUS, SIGTRAP, SIGTTIN, SIGTTOU, SIGTSTP);
129
 
130
   Reserved    : constant Signal_Set := (SIGKILL, SIGSTOP);
131
 
132
   type sigset_t is private;
133
 
134
   type isr_address is access procedure (sig : int);
135
   pragma Convention (C, isr_address);
136
 
137
   function intr_attach (sig : int; handler : isr_address) return long;
138
 
139
   Intr_Attach_Reset : constant Boolean := True;
140
   --  True if intr_attach is reset after an interrupt handler is called
141
 
142
   function sigaddset (set : access sigset_t; sig : Signal) return int;
143
   pragma Import (C, sigaddset, "sigaddset");
144
 
145
   function sigdelset (set : access sigset_t; sig : Signal) return int;
146
   pragma Import (C, sigdelset, "sigdelset");
147
 
148
   function sigfillset (set : access sigset_t) return int;
149
   pragma Import (C, sigfillset, "sigfillset");
150
 
151
   function sigismember (set : access sigset_t; sig : Signal) return int;
152
   pragma Import (C, sigismember, "sigismember");
153
 
154
   function sigemptyset (set : access sigset_t) return int;
155
   pragma Import (C, sigemptyset, "sigemptyset");
156
 
157
   type Signal_Handler is access procedure (signo : Signal);
158
 
159
   type struct_sigaction is record
160
      sa_handler : System.Address;
161
      sa_mask    : sigset_t;
162
      sa_flags   : int;
163
   end record;
164
   pragma Convention (C, struct_sigaction);
165
   type struct_sigaction_ptr is access all struct_sigaction;
166
 
167
   SA_RESTART  : constant  := 16#40#;
168
   SA_SIGINFO  : constant  := 16#10#;
169
   SA_ONSTACK  : constant  := 16#01#;
170
 
171
   SIG_BLOCK   : constant  := 0;
172
   SIG_UNBLOCK : constant  := 1;
173
   SIG_SETMASK : constant  := 2;
174
 
175
   SIG_DFL : constant := 0;
176
   SIG_IGN : constant := 1;
177
   SIG_ERR : constant := -1;
178
 
179
   function sigaction
180
     (sig  : Signal;
181
      act  : struct_sigaction_ptr;
182
      oact : struct_sigaction_ptr) return int;
183
   pragma Import (C, sigaction, "sigaction");
184
 
185
   ----------
186
   -- Time --
187
   ----------
188
 
189
   type timespec is private;
190
 
191
   function nanosleep (rqtp, rmtp : access timespec) return int;
192
   pragma Import (C, nanosleep);
193
 
194
   type clockid_t is new int;
195
 
196
   function Clock_Gettime
197
     (Clock_Id : clockid_t; Tp : access timespec) return int;
198
   pragma Import (C, Clock_Gettime);
199
 
200
   function To_Duration (TS : timespec) return Duration;
201
   pragma Inline (To_Duration);
202
 
203
   function To_Timespec (D : Duration) return timespec;
204
   pragma Inline (To_Timespec);
205
 
206
   -------------------------
207
   -- Priority Scheduling --
208
   -------------------------
209
 
210
   SCHED_FIFO  : constant := 0;
211
   SCHED_RR    : constant := 1;
212
   SCHED_OTHER : constant := 2;
213
 
214
   -------------
215
   -- Process --
216
   -------------
217
 
218
   type pid_t is private;
219
 
220
   function kill (pid : pid_t; sig : Signal) return int;
221
   pragma Import (C, kill, "kill");
222
 
223
   function getpid return pid_t;
224
   pragma Import (C, getpid, "getpid");
225
 
226
   -------------
227
   -- Threads --
228
   -------------
229
 
230
   type Thread_Body is access
231
     function (arg : System.Address) return System.Address;
232
   pragma Convention (C, Thread_Body);
233
 
234
   function Thread_Body_Access is new
235
     Ada.Unchecked_Conversion (System.Address, Thread_Body);
236
 
237
   type pthread_t           is private;
238
   subtype Thread_Id        is pthread_t;
239
 
240
   type pthread_mutex_t     is limited private;
241
   type pthread_cond_t      is limited private;
242
   type pthread_attr_t      is limited private;
243
   type pthread_mutexattr_t is limited private;
244
   type pthread_condattr_t  is limited private;
245
   type pthread_key_t       is private;
246
 
247
   -----------
248
   -- Stack --
249
   -----------
250
 
251
   function Get_Stack_Base (thread : pthread_t) return Address;
252
   pragma Inline (Get_Stack_Base);
253
   --  This is a dummy procedure to share some GNULLI files
254
 
255
   ---------------------------------------
256
   -- Nonstandard Thread Initialization --
257
   ---------------------------------------
258
 
259
   procedure pthread_init;
260
   pragma Inline (pthread_init);
261
   --  This is a dummy procedure to share some GNULLI files
262
 
263
   -------------------------
264
   -- POSIX.1c  Section 3 --
265
   -------------------------
266
 
267
   function sigwait (set : access sigset_t) return int;
268
   pragma Import (C, sigwait, "cma_sigwait");
269
 
270
   function sigwait
271
     (set : access sigset_t;
272
      sig : access Signal) return int;
273
   pragma Inline (sigwait);
274
   --  DCE_THREADS has a nonstandard sigwait
275
 
276
   function pthread_kill
277
     (thread : pthread_t;
278
      sig    : Signal) return int;
279
   pragma Inline (pthread_kill);
280
   --  DCE_THREADS doesn't have pthread_kill
281
 
282
   function pthread_sigmask
283
     (how  : int;
284
      set  : access sigset_t;
285
      oset : access sigset_t) return int;
286
   --  DCE THREADS does not have pthread_sigmask. Instead, it uses sigprocmask
287
   --  to do the signal handling when the thread library is sucked in.
288
   pragma Import (C, pthread_sigmask, "sigprocmask");
289
 
290
   --------------------------
291
   -- POSIX.1c  Section 11 --
292
   --------------------------
293
 
294
   function pthread_mutexattr_init
295
     (attr : access pthread_mutexattr_t) return int;
296
   --  DCE_THREADS has a nonstandard pthread_mutexattr_init
297
 
298
   function pthread_mutexattr_destroy
299
     (attr : access pthread_mutexattr_t) return int;
300
   --  DCE_THREADS has a nonstandard pthread_mutexattr_destroy
301
 
302
   function pthread_mutex_init
303
     (mutex : access pthread_mutex_t;
304
      attr  : access pthread_mutexattr_t) return int;
305
   --  DCE_THREADS has a nonstandard pthread_mutex_init
306
 
307
   function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
308
   --  DCE_THREADS has a nonstandard pthread_mutex_destroy
309
 
310
   function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
311
   pragma Inline (pthread_mutex_lock);
312
   --  DCE_THREADS has nonstandard pthread_mutex_lock
313
 
314
   function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
315
   pragma Inline (pthread_mutex_unlock);
316
   --  DCE_THREADS has nonstandard pthread_mutex_lock
317
 
318
   function pthread_condattr_init
319
     (attr : access pthread_condattr_t) return int;
320
   --  DCE_THREADS has nonstandard pthread_condattr_init
321
 
322
   function pthread_condattr_destroy
323
     (attr : access pthread_condattr_t) return int;
324
   --  DCE_THREADS has nonstandard pthread_condattr_destroy
325
 
326
   function pthread_cond_init
327
     (cond : access pthread_cond_t;
328
      attr : access pthread_condattr_t) return int;
329
   --  DCE_THREADS has nonstandard pthread_cond_init
330
 
331
   function pthread_cond_destroy (cond : access pthread_cond_t) return int;
332
   --  DCE_THREADS has nonstandard pthread_cond_destroy
333
 
334
   function pthread_cond_signal (cond : access pthread_cond_t) return int;
335
   pragma Inline (pthread_cond_signal);
336
   --  DCE_THREADS has nonstandard pthread_cond_signal
337
 
338
   function pthread_cond_wait
339
     (cond  : access pthread_cond_t;
340
      mutex : access pthread_mutex_t) return int;
341
   pragma Inline (pthread_cond_wait);
342
   --  DCE_THREADS has a nonstandard pthread_cond_wait
343
 
344
   function pthread_cond_timedwait
345
     (cond    : access pthread_cond_t;
346
      mutex   : access pthread_mutex_t;
347
      abstime : access timespec) return int;
348
   pragma Inline (pthread_cond_timedwait);
349
   --  DCE_THREADS has a nonstandard pthread_cond_timedwait
350
 
351
   --------------------------
352
   -- POSIX.1c  Section 13 --
353
   --------------------------
354
 
355
   type struct_sched_param is record
356
      sched_priority : int;  --  scheduling priority
357
   end record;
358
 
359
   function pthread_setschedparam
360
     (thread : pthread_t;
361
      policy : int;
362
      param  : access struct_sched_param) return int;
363
   pragma Inline (pthread_setschedparam);
364
   --  DCE_THREADS has a nonstandard pthread_setschedparam
365
 
366
   function sched_yield return int;
367
   pragma Inline (sched_yield);
368
   --  DCE_THREADS has a nonstandard sched_yield
369
 
370
   ---------------------------
371
   -- P1003.1c - Section 16 --
372
   ---------------------------
373
 
374
   function pthread_attr_init (attributes : access pthread_attr_t) return int;
375
   pragma Inline (pthread_attr_init);
376
   --  DCE_THREADS has a nonstandard pthread_attr_init
377
 
378
   function pthread_attr_destroy
379
     (attributes : access pthread_attr_t) return int;
380
   pragma Inline (pthread_attr_destroy);
381
   --  DCE_THREADS has a nonstandard pthread_attr_destroy
382
 
383
   function pthread_attr_setstacksize
384
     (attr      : access pthread_attr_t;
385
      stacksize : size_t) return int;
386
   pragma Inline (pthread_attr_setstacksize);
387
   --  DCE_THREADS has a nonstandard pthread_attr_setstacksize
388
 
389
   function pthread_create
390
     (thread        : access pthread_t;
391
      attributes    : access pthread_attr_t;
392
      start_routine : Thread_Body;
393
      arg           : System.Address) return int;
394
   pragma Inline (pthread_create);
395
   --  DCE_THREADS has a nonstandard pthread_create
396
 
397
   procedure pthread_detach (thread : access pthread_t);
398
   pragma Import (C, pthread_detach);
399
 
400
   procedure pthread_exit (status : System.Address);
401
   pragma Import (C, pthread_exit, "pthread_exit");
402
 
403
   function pthread_self return pthread_t;
404
   pragma Import (C, pthread_self, "pthread_self");
405
 
406
   --------------------------
407
   -- POSIX.1c  Section 17 --
408
   --------------------------
409
 
410
   function pthread_setspecific
411
     (key   : pthread_key_t;
412
      value : System.Address) return int;
413
   pragma Inline (pthread_setspecific);
414
   --  DCE_THREADS has a nonstandard pthread_setspecific
415
 
416
   function pthread_getspecific (key : pthread_key_t) return System.Address;
417
   pragma Inline (pthread_getspecific);
418
   --  DCE_THREADS has a nonstandard pthread_getspecific
419
 
420
   type destructor_pointer is access procedure (arg : System.Address);
421
   pragma Convention (C, destructor_pointer);
422
 
423
   function pthread_key_create
424
     (key        : access pthread_key_t;
425
      destructor : destructor_pointer) return int;
426
   pragma Inline (pthread_key_create);
427
   --  DCE_THREADS has a nonstandard pthread_key_create
428
 
429
private
430
 
431
   type array_type_1 is array (Integer range 0 .. 7) of unsigned_long;
432
   type sigset_t is record
433
      X_X_sigbits : array_type_1;
434
   end record;
435
   pragma Convention (C, sigset_t);
436
 
437
   type pid_t is new int;
438
 
439
   type time_t is new long;
440
 
441
   type timespec is record
442
      tv_sec  : time_t;
443
      tv_nsec : long;
444
   end record;
445
   pragma Convention (C, timespec);
446
 
447
   type clockid_t is new int;
448
   CLOCK_REALTIME : constant clockid_t := 1;
449
 
450
   type cma_t_address is new System.Address;
451
 
452
   type cma_t_handle is record
453
      field1 : cma_t_address;
454
      field2 : Short_Integer;
455
      field3 : Short_Integer;
456
   end record;
457
   for cma_t_handle'Size use 64;
458
 
459
   type pthread_attr_t is new cma_t_handle;
460
   pragma Convention (C_Pass_By_Copy, pthread_attr_t);
461
 
462
   type pthread_condattr_t is new cma_t_handle;
463
   pragma Convention (C_Pass_By_Copy, pthread_condattr_t);
464
 
465
   type pthread_mutexattr_t is new cma_t_handle;
466
   pragma Convention (C_Pass_By_Copy, pthread_mutexattr_t);
467
 
468
   type pthread_t is new cma_t_handle;
469
   pragma Convention (C_Pass_By_Copy, pthread_t);
470
 
471
   type pthread_mutex_t is new cma_t_handle;
472
   pragma Convention (C_Pass_By_Copy, pthread_mutex_t);
473
 
474
   type pthread_cond_t is new cma_t_handle;
475
   pragma Convention (C_Pass_By_Copy, pthread_cond_t);
476
 
477
   type pthread_key_t is new int;
478
 
479
end System.OS_Interface;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.