1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
Description: add support for GNU/kFreeBSD and GNU/Hurd.
For now, it seems that BSD requires -lrt.
On other architectures, the library is ignored thanks to --as-needed.
Author: Ludovic Brenta <lbrenta@debian.org>
Author: Nicolas Boulenguez <nicolas@debian.org>
--- a/src/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads
+++ b/src/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads
@@ -46,6 +46,7 @@ package System.OS_Interface is
pragma Preelaborate;
pragma Linker_Options ("-lpthread");
+ pragma Linker_Options ("-lrt");
subtype int is Interfaces.C.int;
subtype char is Interfaces.C.char;
@@ -438,31 +439,25 @@ package System.OS_Interface is
PTHREAD_PRIO_PROTECT : constant := 2;
PTHREAD_PRIO_INHERIT : constant := 1;
+ -- GNU/kFreeBSD does not support Thread Priority Protection or Thread
+ -- Priority Inheritance and lacks some pthread_mutexattr_* functions.
+ -- Replace them with dummy versions.
+
function pthread_mutexattr_setprotocol
- (attr : access pthread_mutexattr_t;
- protocol : int) return int;
- pragma Import
- (C, pthread_mutexattr_setprotocol, "pthread_mutexattr_setprotocol");
+ (ignored_attr : access pthread_mutexattr_t;
+ ignored_protocol : int) return int is (0);
function pthread_mutexattr_getprotocol
- (attr : access pthread_mutexattr_t;
- protocol : access int) return int;
- pragma Import
- (C, pthread_mutexattr_getprotocol, "pthread_mutexattr_getprotocol");
+ (ignored_attr : access pthread_mutexattr_t;
+ ignored_protocol : access int) return int is (0);
function pthread_mutexattr_setprioceiling
- (attr : access pthread_mutexattr_t;
- prioceiling : int) return int;
- pragma Import
- (C, pthread_mutexattr_setprioceiling,
- "pthread_mutexattr_setprioceiling");
+ (ignored_attr : access pthread_mutexattr_t;
+ ignored_prioceiling : int) return int is (0);
function pthread_mutexattr_getprioceiling
- (attr : access pthread_mutexattr_t;
- prioceiling : access int) return int;
- pragma Import
- (C, pthread_mutexattr_getprioceiling,
- "pthread_mutexattr_getprioceiling");
+ (ignored_attr : access pthread_mutexattr_t;
+ ignored_prioceiling : access int) return int is (0);
type struct_sched_param is record
sched_priority : int; -- scheduling priority
--- a/src/gcc/ada/s-oscons-tmplt.c
+++ b/src/gcc/ada/s-oscons-tmplt.c
@@ -1970,6 +1970,7 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU
#if defined(__linux__) || defined(__FreeBSD__) \
|| (defined(_AIX) && defined(_AIXVERSION_530)) \
+ || defined(__FreeBSD_kernel__) \
|| defined(__DragonFly__) || defined(__QNX__)
/** On these platforms use system provided monotonic clock instead of
** the default CLOCK_REALTIME. We then need to set up cond var attributes
|