Commit 0fe6afd3 by Arnaud Charlet

s-osinte-darwin.ads, [...]: Clean up darwin port by using proper type…

s-osinte-darwin.ads, [...]: Clean up darwin port by using proper type definitions from header files.

	* s-osinte-darwin.ads, s-osinte-darwin.adb: Clean up
	darwin port by using proper type definitions from header files.
	Use SIGTERM instead of SIGABRT for SIGADAABORT.

From-SVN: r92845
parent 8d75f39c
...@@ -78,7 +78,7 @@ package body System.OS_Interface is ...@@ -78,7 +78,7 @@ package body System.OS_Interface is
end if; end if;
return timespec'(tv_sec => S, return timespec'(tv_sec => S,
tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); tv_nsec => int32_t (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec; end To_Timespec;
---------------- ----------------
...@@ -86,11 +86,11 @@ package body System.OS_Interface is ...@@ -86,11 +86,11 @@ package body System.OS_Interface is
---------------- ----------------
function To_Timeval (D : Duration) return struct_timeval is function To_Timeval (D : Duration) return struct_timeval is
S : long; S : int32_t;
F : Duration; F : Duration;
begin begin
S := long (Long_Long_Integer (D)); S := int32_t (D);
F := D - Duration (S); F := D - Duration (S);
-- If F has negative value due to a round-up, adjust for positive F -- If F has negative value due to a round-up, adjust for positive F
...@@ -101,8 +101,9 @@ package body System.OS_Interface is ...@@ -101,8 +101,9 @@ package body System.OS_Interface is
F := F + 1.0; F := F + 1.0;
end if; end if;
return struct_timeval'(tv_sec => S, return struct_timeval'
tv_usec => long (Long_Long_Integer (F * 10#1#E6))); (Tv_Sec => S,
tv_usec => int32_t (Long_Long_Integer (F * 10#1#E6)));
end To_Timeval; end To_Timeval;
------------------- -------------------
......
...@@ -109,7 +109,7 @@ package System.OS_Interface is ...@@ -109,7 +109,7 @@ package System.OS_Interface is
SIGUSR1 : constant := 30; -- user defined signal 1 SIGUSR1 : constant := 30; -- user defined signal 1
SIGUSR2 : constant := 31; -- user defined signal 2 SIGUSR2 : constant := 31; -- user defined signal 2
SIGADAABORT : constant := SIGABRT; SIGADAABORT : constant := SIGTERM;
-- Change this if you want to use another signal for task abort. -- Change this if you want to use another signal for task abort.
-- SIGTERM might be a good one. -- SIGTERM might be a good one.
...@@ -308,7 +308,7 @@ package System.OS_Interface is ...@@ -308,7 +308,7 @@ package System.OS_Interface is
(how : int; (how : int;
set : sigset_t_ptr; set : sigset_t_ptr;
oset : sigset_t_ptr) return int; oset : sigset_t_ptr) return int;
pragma Import (C, pthread_sigmask, "sigprocmask"); pragma Import (C, pthread_sigmask, "pthread_sigmask");
-------------------------- --------------------------
-- POSIX.1c Section 11 -- -- POSIX.1c Section 11 --
...@@ -390,9 +390,13 @@ package System.OS_Interface is ...@@ -390,9 +390,13 @@ package System.OS_Interface is
(C, pthread_mutexattr_setprioceiling, (C, pthread_mutexattr_setprioceiling,
"pthread_mutexattr_setprioceiling"); "pthread_mutexattr_setprioceiling");
type padding is array (int range <>) of Interfaces.C.char;
type struct_sched_param is record type struct_sched_param is record
sched_priority : int; -- scheduling priority sched_priority : int; -- scheduling priority
opaque : padding (1 .. 4);
end record; end record;
pragma Convention (C, struct_sched_param);
function pthread_setschedparam function pthread_setschedparam
(thread : pthread_t; (thread : pthread_t;
...@@ -475,19 +479,17 @@ package System.OS_Interface is ...@@ -475,19 +479,17 @@ package System.OS_Interface is
private private
type array_type_1 is array (Integer range 0 .. 3) of unsigned_long; type sigset_t is new unsigned;
type sigset_t is record
X_X_sigbits : array_type_1; type int32_t is new int;
end record;
pragma Convention (C, sigset_t);
type pid_t is new long; type pid_t is new int32_t;
type time_t is new long; type time_t is new long;
type timespec is record type timespec is record
tv_sec : time_t; tv_sec : time_t;
tv_nsec : long; tv_nsec : int32_t;
end record; end record;
pragma Convention (C, timespec); pragma Convention (C, timespec);
...@@ -495,15 +497,15 @@ private ...@@ -495,15 +497,15 @@ private
CLOCK_REALTIME : constant clockid_t := 0; CLOCK_REALTIME : constant clockid_t := 0;
type struct_timeval is record type struct_timeval is record
tv_sec : long; tv_sec : int32_t;
tv_usec : long; tv_usec : int32_t;
end record; end record;
pragma Convention (C, struct_timeval); pragma Convention (C, struct_timeval);
-- --
-- Darwin specific signal implementation -- Darwin specific signal implementation
-- --
type Pad_Type is array (0 .. 7) of int; type Pad_Type is array (1 .. 7) of unsigned;
type siginfo_t is record type siginfo_t is record
si_signo : int; -- signal number si_signo : int; -- signal number
si_errno : int; -- errno association si_errno : int; -- errno association
...@@ -544,98 +546,42 @@ private ...@@ -544,98 +546,42 @@ private
type pthread_lock_t is new long; type pthread_lock_t is new long;
type sched_param_pad is array (0 .. 3) of plain_char;
type sched_param is record
sched_priority : int;
opaque : sched_param_pad;
end record;
pragma Convention (C, sched_param);
type boolean_t is new int;
type pthread_attr_t is record type pthread_attr_t is record
sig : long; sig : long;
lock : pthread_lock_t; opaque : padding (1 .. 36);
detached : int;
inherit : int;
policy : int;
param : sched_param;
stackaddr : System.Address;
stacksize : long;
freeStackOnExit : boolean_t;
end record; end record;
pragma Convention (C, pthread_attr_t); pragma Convention (C, pthread_attr_t);
type pthread_mutexattr_t is record type pthread_mutexattr_t is record
sig : long; sig : long;
prioceiling : int; opaque : padding (1 .. 8);
protocol : int;
end record; end record;
pragma Convention (C, pthread_mutexattr_t); pragma Convention (C, pthread_mutexattr_t);
type mach_port_t is new unsigned_long;
type pthread_mutex_t is record type pthread_mutex_t is record
sig : long; sig : long;
lock : pthread_lock_t; opaque : padding (1 .. 40);
prioceiling : int;
priority : int;
protocol : int;
owner : pthread_t;
next : pthread_mutex_ptr;
prev : pthread_mutex_ptr;
busy : pthread_cond_ptr;
field : int;
sem : mach_port_t;
end record; end record;
pragma Convention (C, pthread_mutex_t); pragma Convention (C, pthread_mutex_t);
type pthread_condattr_t is record type pthread_condattr_t is record
sig : long; sig : long;
unsupported : int; opaque : padding (1 .. 4);
end record; end record;
pragma Convention (C, pthread_condattr_t); pragma Convention (C, pthread_condattr_t);
type pthread_cond_t is record type pthread_cond_t is record
sig : long; sig : long;
lock : pthread_lock_t; opaque : padding (1 .. 24);
sem : mach_port_t;
next : pthread_cond_ptr;
prev : pthread_cond_ptr;
busy : pthread_mutex_ptr;
waiters : short;
sigspending : short;
end record; end record;
pragma Convention (C, pthread_cond_t); pragma Convention (C, pthread_cond_t);
type pthread_once_t is record type pthread_once_t is record
sig : long; sig : long;
lock : pthread_lock_t; opaque : padding (1 .. 4);
end record; end record;
pragma Convention (C, pthread_once_t); pragma Convention (C, pthread_once_t);
type rwlockattr_rfu_array is array (0 .. 1) of int;
type pthread_rwlockattr_t is record
sig : long;
pshared : int;
rfu : rwlockattr_rfu_array;
end record;
pragma Convention (C, pthread_rwlockattr_t);
type rwlock_rfu_array is array (0 .. 2) of int;
type pthread_rwlock_t is record
sig : long;
lock : pthread_mutex_t;
state : int;
read_signal : pthread_cond_t;
write_signal : pthread_cond_t;
block_writers : int;
pshared : int;
rfu : rwlock_rfu_array;
end record;
pragma Convention (C, pthread_rwlock_t);
type pthread_key_t is new unsigned_long; type pthread_key_t is new unsigned_long;
end System.OS_Interface; end System.OS_Interface;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment