Merge from mainline
[official-gcc.git] / gcc / ada / s-osinte-os2.ads
blob6b32b5d610b08db90e7db71da49f10a36b8bafcb
1 ------------------------------------------------------------------------------
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-2005, Free Software Foundation, Inc. --
11 -- --
12 -- GNARL 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 2, or (at your option) any later ver- --
15 -- sion. GNARL 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. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNARL; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
21 -- Boston, MA 02110-1301, USA. --
22 -- --
23 -- As a special exception, if other files instantiate generics from this --
24 -- unit, or you link this unit with other files to produce an executable, --
25 -- this unit does not by itself cause the resulting executable to be --
26 -- covered by the GNU General Public License. This exception does not --
27 -- however invalidate any other reasons why the executable file might be --
28 -- covered by the GNU Public License. --
29 -- --
30 -- GNARL was developed by the GNARL team at Florida State University. --
31 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
32 -- --
33 ------------------------------------------------------------------------------
35 -- This is the OS/2 version of this package
37 -- This package encapsulates all direct interfaces to OS services
38 -- that are needed by children of System.
40 -- PLEASE DO NOT add any with-clauses to this package or remove the pragma
41 -- Preelaborate. This package is designed to be a bottom-level (leaf) package.
43 with Interfaces.C;
45 package System.OS_Interface is
46 pragma Preelaborate;
48 package C renames Interfaces.C;
50 subtype int is C.int;
51 subtype unsigned_long is C.unsigned_long;
53 type Duration_In_Millisec is new C.long;
54 -- New type to prevent confusing time functions in this package
55 -- with time functions returning seconds or other units.
57 type Thread_Id is new unsigned_long;
59 -----------
60 -- Errno --
61 -----------
63 function errno return int;
64 pragma Import (C, errno, "__get_errno");
66 EAGAIN : constant := 5;
67 EINTR : constant := 13;
68 EINVAL : constant := 14;
69 ENOMEM : constant := 25;
71 -------------
72 -- Signals --
73 -------------
75 Max_Interrupt : constant := 15;
76 type Signal is new int range 0 .. Max_Interrupt;
78 -- Signals for OS/2, only SIGTERM used currently. The values are
79 -- fake, since OS/2 uses 32 bit exception numbers that cannot be
80 -- used to index arrays etc. The GNULLI maps these Unix-like signals
81 -- to OS/2 exception numbers.
83 -- SIGTERM is used for the abort interrupt.
85 SIGHUP : constant := 1; -- hangup
86 SIGINT : constant := 2; -- interrupt (rubout)
87 SIGQUIT : constant := 3; -- quit (ASCD FS)
88 SIGILL : constant := 4; -- illegal instruction (not reset)
89 SIGTRAP : constant := 5; -- trace trap (not reset)
90 SIGIOT : constant := 6; -- IOT instruction
91 SIGEMT : constant := 0; -- 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
101 subtype sigset_t is unsigned_long;
103 ----------
104 -- Time --
105 ----------
107 function Clock return Duration;
108 pragma Inline (Clock);
109 -- Clock measuring time since the epoch, which is the boot-time.
110 -- The clock resolution is approximately 838 ns.
112 procedure Delay_For (Period : in Duration_In_Millisec);
113 pragma Inline (Delay_For);
114 -- Changed Sleep to Delay_For, for consistency with System.Time_Operations
116 ----------------
117 -- Scheduling --
118 ----------------
120 -- Put the calling task at the end of the ready queue for its priority
122 procedure Yield;
123 pragma Inline (Yield);
125 end System.OS_Interface;