1
Index: b/src/gcc/ada/s-osinte-kfreebsd-gnu.adb
2
===================================================================
4
+++ b/src/gcc/ada/s-osinte-kfreebsd-gnu.adb
6
+------------------------------------------------------------------------------
8
+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
10
+-- S Y S T E M . O S _ I N T E R F A C E --
14
+-- Copyright (C) 1991-1994, Florida State University --
15
+-- Copyright (C) 1995-2006, AdaCore --
17
+-- GNARL is free software; you can redistribute it and/or modify it under --
18
+-- terms of the GNU General Public License as published by the Free Soft- --
19
+-- ware Foundation; either version 2, or (at your option) any later ver- --
20
+-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
21
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
22
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
23
+-- for more details. You should have received a copy of the GNU General --
24
+-- Public License distributed with GNARL; see file COPYING. If not, write --
25
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
26
+-- Boston, MA 02110-1301, USA. --
28
+-- As a special exception, if other files instantiate generics from this --
29
+-- unit, or you link this unit with other files to produce an executable, --
30
+-- this unit does not by itself cause the resulting executable to be --
31
+-- covered by the GNU General Public License. This exception does not --
32
+-- however invalidate any other reasons why the executable file might be --
33
+-- covered by the GNU Public License. --
35
+-- GNARL was developed by the GNARL team at Florida State University. --
36
+-- Extensive contributions were provided by Ada Core Technologies, Inc. --
38
+------------------------------------------------------------------------------
40
+-- This is the GNU/kFreeBSD version of this package.
42
+pragma Polling (Off);
43
+-- Turn off polling, we do not want ATC polling to take place during
44
+-- tasking operations. It causes infinite loops and other problems.
46
+-- This package encapsulates all direct interfaces to OS services
47
+-- that are needed by children of System.
49
+package body System.OS_Interface is
51
+ --------------------
52
+ -- Get_Stack_Base --
53
+ --------------------
55
+ function Get_Stack_Base (thread : pthread_t) return Address is
56
+ pragma Warnings (Off, thread);
59
+ return Null_Address;
66
+ procedure pthread_init is
71
+ -----------------------------------
72
+ -- pthread_mutexattr_setprotocol --
73
+ -----------------------------------
75
+ function pthread_mutexattr_setprotocol
76
+ (attr : access pthread_mutexattr_t;
77
+ protocol : int) return int is
78
+ pragma Unreferenced (attr, protocol);
81
+ end pthread_mutexattr_setprotocol;
83
+ -----------------------------------
84
+ -- pthread_mutexattr_getprotocol --
85
+ -----------------------------------
87
+ function pthread_mutexattr_getprotocol
88
+ (attr : access pthread_mutexattr_t;
89
+ protocol : access int) return int is
90
+ pragma Unreferenced (attr, protocol);
93
+ end pthread_mutexattr_getprotocol;
95
+ --------------------------------------
96
+ -- pthread_mutexattr_setprioceiling --
97
+ --------------------------------------
99
+ function pthread_mutexattr_setprioceiling
100
+ (attr : access pthread_mutexattr_t;
101
+ prioceiling : int) return int is
102
+ pragma Unreferenced (attr, prioceiling);
105
+ end pthread_mutexattr_setprioceiling;
107
+ --------------------------------------
108
+ -- pthread_mutexattr_getprioceiling --
109
+ --------------------------------------
111
+ function pthread_mutexattr_getprioceiling
112
+ (attr : access pthread_mutexattr_t;
113
+ prioceiling : access int) return int is
114
+ pragma Unreferenced (attr, prioceiling);
117
+ end pthread_mutexattr_getprioceiling;
123
+ function To_Duration (TS : timespec) return Duration is
125
+ return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
128
+ ------------------------
129
+ -- To_Target_Priority --
130
+ ------------------------
132
+ function To_Target_Priority
133
+ (Prio : System.Any_Priority) return Interfaces.C.int
136
+ return Interfaces.C.int (Prio);
137
+ end To_Target_Priority;
143
+ function To_Timespec (D : Duration) return timespec is
148
+ S := time_t (Long_Long_Integer (D));
149
+ F := D - Duration (S);
151
+ -- If F has negative value due to a round-up, adjust for positive F
159
+ return timespec'(tv_sec => S,
160
+ tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
163
+end System.OS_Interface;
164
Index: b/src/gcc/ada/gcc-interface/Makefile.in
165
===================================================================
166
--- a/src/gcc/ada/gcc-interface/Makefile.in
167
+++ b/src/gcc/ada/gcc-interface/Makefile.in
168
@@ -1097,7 +1097,7 @@
169
a-numaux.ads<a-numaux-x86.ads \
170
s-inmaop.adb<s-inmaop-posix.adb \
171
s-intman.adb<s-intman-posix.adb \
172
- s-osinte.adb<s-osinte-posix.adb \
173
+ s-osinte.adb<s-osinte-kfreebsd-gnu.adb \
174
s-osinte.ads<s-osinte-kfreebsd-gnu.ads \
175
s-osprim.adb<s-osprim-posix.adb \
176
s-taprop.adb<s-taprop-posix.adb \
177
@@ -1123,7 +1123,7 @@
178
a-numaux.ads<a-numaux-x86.ads \
179
s-inmaop.adb<s-inmaop-posix.adb \
180
s-intman.adb<s-intman-posix.adb \
181
- s-osinte.adb<s-osinte-posix.adb \
182
+ s-osinte.adb<s-osinte-kfreebsd-gnu.adb \
183
s-osinte.ads<s-osinte-kfreebsd-gnu.ads \
184
s-osprim.adb<s-osprim-posix.adb \
185
s-taprop.adb<s-taprop-posix.adb \
186
Index: b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads
187
===================================================================
188
--- a/src/gcc/ada/s-osinte-kfreebsd-gnu.ads
189
+++ b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads
193
pragma Linker_Options ("-lpthread");
194
+ pragma Linker_Options ("-lrt");
196
subtype int is Interfaces.C.int;
197
subtype char is Interfaces.C.char;
198
@@ -431,31 +432,25 @@
199
PTHREAD_PRIO_PROTECT : constant := 2;
200
PTHREAD_PRIO_INHERIT : constant := 1;
202
+ -- GNU/kFreeBSD does not support Thread Priority Protection or Thread
203
+ -- Priority Inheritance and lacks some pthread_mutexattr_* functions.
204
+ -- Replace them with dummy versions.
206
function pthread_mutexattr_setprotocol
207
(attr : access pthread_mutexattr_t;
208
protocol : int) return int;
210
- (C, pthread_mutexattr_setprotocol, "pthread_mutexattr_setprotocol");
212
function pthread_mutexattr_getprotocol
213
(attr : access pthread_mutexattr_t;
214
protocol : access int) return int;
216
- (C, pthread_mutexattr_getprotocol, "pthread_mutexattr_getprotocol");
218
function pthread_mutexattr_setprioceiling
219
(attr : access pthread_mutexattr_t;
220
prioceiling : int) return int;
222
- (C, pthread_mutexattr_setprioceiling,
223
- "pthread_mutexattr_setprioceiling");
225
function pthread_mutexattr_getprioceiling
226
(attr : access pthread_mutexattr_t;
227
prioceiling : access int) return int;
229
- (C, pthread_mutexattr_getprioceiling,
230
- "pthread_mutexattr_getprioceiling");
232
type struct_sched_param is record
233
sched_priority : int; -- scheduling priority