Commit a7194bfe by Eric Botcazou Committed by Laurent Guerby

re PR ada/42153 (s-osinte.adb:46:21: missing body for "To_Duration" declared at s-osinte.ads:216)

2009-11-23  Eric Botcazou  <ebotcazou@adacore.com>
            Laurent GUERBY  <laurent@guerby.net>

	PR ada/42153
        * s-osinte-linux.ads (struct_timeval): Delete.
        * s-osinte-hpux.ads (struct_timeval, To_Duration, To_Timeval): 
        Delete.
        * s-osinte-kfreebsd-gnu.ads: Likewise.
        * s-osinte-rtems.ads: Likewise.
        * s-osinte-aix.ads: Likewise.
        * s-osinte-hpux-dce.ads: Likewise.
        * s-osinte-darwin.ads: Likewise.
        * s-osinte-solaris-posix.ads: Likewise.
        * s-osinte-irix.ads: Likewise.
        * s-osinte-solaris.ads: Likewise.
        * s-osinte-hpux-dce.adb (To_Duration, To_Timeval): Delete.
        * s-osinte-irix.adb: Likewise.
        * s-osinte-solaris.adb: Likewise.
        * s-osinte-rtems.adb: Likewise. Minor reformatting.
        * s-osinte-aix.adb (To_Duration, To_Timeval): Delete.
        (clock_gettime): Use cal.c timeval_to_duration.
        * s-osinte-darwin.adb: Likewise.


Co-Authored-By: Laurent GUERBY <laurent@guerby.net>

From-SVN: r154446
parent aa373032
2009-11-23 Eric Botcazou <ebotcazou@adacore.com>
Laurent GUERBY <laurent@guerby.net>
PR ada/42153
* s-osinte-linux.ads (struct_timeval): Delete.
* s-osinte-hpux.ads (struct_timeval, To_Duration, To_Timeval):
Delete.
* s-osinte-kfreebsd-gnu.ads: Likewise.
* s-osinte-rtems.ads: Likewise.
* s-osinte-aix.ads: Likewise.
* s-osinte-hpux-dce.ads: Likewise.
* s-osinte-darwin.ads: Likewise.
* s-osinte-solaris-posix.ads: Likewise.
* s-osinte-irix.ads: Likewise.
* s-osinte-solaris.ads: Likewise.
* s-osinte-hpux-dce.adb (To_Duration, To_Timeval): Delete.
* s-osinte-irix.adb: Likewise.
* s-osinte-solaris.adb: Likewise.
* s-osinte-rtems.adb: Likewise. Minor reformatting.
* s-osinte-aix.adb (To_Duration, To_Timeval): Delete.
(clock_gettime): Use cal.c timeval_to_duration.
* s-osinte-darwin.adb: Likewise.
2009-11-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* adaint.h: Assume large file support on IRIX only if _LFAPI.
......
......@@ -48,11 +48,6 @@ package body System.OS_Interface is
return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
end To_Duration;
function To_Duration (TV : struct_timeval) return Duration is
begin
return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
end To_Duration;
------------------------
-- To_Target_Priority --
------------------------
......@@ -104,31 +99,6 @@ package body System.OS_Interface is
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
----------------
-- To_Timeval --
----------------
function To_Timeval (D : Duration) return struct_timeval is
S : long;
F : Duration;
begin
S := long (Long_Long_Integer (D));
F := D - Duration (S);
-- If F is negative due to a round-up, adjust for positive F value
if F < 0.0 then
S := S - 1;
F := F + 1.0;
end if;
return
struct_timeval'
(tv_sec => S,
tv_usec => long (Long_Long_Integer (F * 10#1#E6)));
end To_Timeval;
-------------------
-- clock_gettime --
-------------------
......@@ -138,20 +108,37 @@ package body System.OS_Interface is
tp : access timespec)
return int
is
pragma Warnings (Off, clock_id);
pragma Unreferenced (clock_id);
-- Darwin threads don't have clock_gettime, so use
-- gettimeofday() instead.
use Interfaces;
type timeval is array (1 .. 2) of C.long;
procedure timeval_to_duration
(T : not null access timeval;
sec : not null access C.long;
usec : not null access C.long);
pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration");
Micro : constant := 10**6;
sec : aliased C.long;
usec : aliased C.long;
TV : aliased timeval;
Result : int;
tv : aliased struct_timeval;
function gettimeofday
(tv : access struct_timeval;
tz : System.Address := System.Null_Address)
return int;
(Tv : access timeval;
Tz : System.Address := System.Null_Address) return int;
pragma Import (C, gettimeofday, "gettimeofday");
begin
Result := gettimeofday (tv'Unchecked_Access);
tp.all := To_Timespec (To_Duration (tv));
Result := gettimeofday (TV'Access, System.Null_Address);
pragma Assert (Result = 0);
timeval_to_duration (TV'Access, sec'Access, usec'Access);
tp.all := To_Timespec (Duration (sec) + Duration (usec) / Micro);
return Result;
end clock_gettime;
......
......@@ -206,7 +206,6 @@ package System.OS_Interface is
function clock_gettime
(clock_id : clockid_t;
tp : access timespec) return int;
-- AIX threads don't have clock_gettime, so use gettimeofday() instead
function To_Duration (TS : timespec) return Duration;
pragma Inline (To_Duration);
......@@ -221,16 +220,6 @@ package System.OS_Interface is
pragma Convention (C, struct_timezone);
type struct_timezone_ptr is access all struct_timezone;
type struct_timeval is private;
-- This is needed on systems that do not have clock_gettime() but do have
-- gettimeofday().
function To_Duration (TV : struct_timeval) return Duration;
pragma Inline (To_Duration);
function To_Timeval (D : Duration) return struct_timeval;
pragma Inline (To_Timeval);
-------------------------
-- Priority Scheduling --
-------------------------
......@@ -554,12 +543,6 @@ private
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 0;
type struct_timeval is record
tv_sec : long;
tv_usec : long;
end record;
pragma Convention (C, struct_timeval);
type pthread_attr_t is new System.Address;
pragma Convention (C, pthread_attr_t);
-- typedef struct __pt_attr *pthread_attr_t;
......
......@@ -48,11 +48,6 @@ package body System.OS_Interface is
return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
end To_Duration;
function To_Duration (TV : struct_timeval) return Duration is
begin
return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
end To_Duration;
------------------------
-- To_Target_Priority --
------------------------
......@@ -88,31 +83,6 @@ package body System.OS_Interface is
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
----------------
-- To_Timeval --
----------------
function To_Timeval (D : Duration) return struct_timeval is
S : time_t;
F : Duration;
begin
S := time_t (D);
F := D - Duration (S);
-- If F has negative value due to a round-up, adjust for positive F
-- value.
if F < 0.0 then
S := S - 1;
F := F + 1.0;
end if;
return struct_timeval'
(Tv_Sec => S,
tv_usec => int32_t (Long_Long_Integer (F * 10#1#E6)));
end To_Timeval;
-------------------
-- clock_gettime --
-------------------
......@@ -122,17 +92,36 @@ package body System.OS_Interface is
tp : access timespec) return int
is
pragma Unreferenced (clock_id);
-- AIX threads don't have clock_gettime, so use
-- gettimeofday() instead.
use Interfaces;
type timeval is array (1 .. 2) of C.long;
procedure timeval_to_duration
(T : not null access timeval;
sec : not null access C.long;
usec : not null access C.long);
pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration");
Micro : constant := 10**6;
sec : aliased C.long;
usec : aliased C.long;
TV : aliased timeval;
Result : int;
tv : aliased struct_timeval;
function gettimeofday
(tv : access struct_timeval;
tz : System.Address := System.Null_Address) return int;
(Tv : access timeval;
Tz : System.Address := System.Null_Address) return int;
pragma Import (C, gettimeofday, "gettimeofday");
begin
Result := gettimeofday (tv'Unchecked_Access);
tp.all := To_Timespec (To_Duration (tv));
Result := gettimeofday (TV'Access, System.Null_Address);
pragma Assert (Result = 0);
timeval_to_duration (TV'Access, sec'Access, usec'Access);
tp.all := To_Timespec (Duration (sec) + Duration (usec) / Micro);
return Result;
end clock_gettime;
......
......@@ -199,14 +199,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
type struct_timeval is private;
function To_Duration (TV : struct_timeval) return Duration;
pragma Inline (To_Duration);
function To_Timeval (D : Duration) return struct_timeval;
pragma Inline (To_Timeval);
-------------------------
-- Priority Scheduling --
-------------------------
......@@ -528,12 +520,6 @@ private
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 0;
type struct_timeval is record
tv_sec : time_t;
tv_usec : int32_t;
end record;
pragma Convention (C, struct_timeval);
--
-- Darwin specific signal implementation
--
......
......@@ -78,32 +78,6 @@ package body System.OS_Interface is
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
function To_Duration (TV : struct_timeval) return Duration is
begin
return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
end To_Duration;
function To_Timeval (D : Duration) return struct_timeval is
S : time_t;
F : Duration;
begin
S := time_t (Long_Long_Integer (D));
F := D - Duration (S);
-- If F has negative value due to a round-up, adjust for positive F
-- value.
if F < 0.0 then
S := S - 1;
F := F + 1.0;
end if;
return
struct_timeval'
(tv_sec => S,
tv_usec => time_t (Long_Long_Integer (F * 10#1#E6)));
end To_Timeval;
-------------------------
-- POSIX.1c Section 3 --
-------------------------
......
......@@ -207,14 +207,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
type struct_timeval is private;
function To_Duration (TV : struct_timeval) return Duration;
pragma Inline (To_Duration);
function To_Timeval (D : Duration) return struct_timeval;
pragma Inline (To_Timeval);
-------------------------
-- Priority Scheduling --
-------------------------
......@@ -459,12 +451,6 @@ private
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 1;
type struct_timeval is record
tv_sec : time_t;
tv_usec : time_t;
end record;
pragma Convention (C, struct_timeval);
type cma_t_address is new System.Address;
type cma_t_handle is record
......
......@@ -209,16 +209,6 @@ package System.OS_Interface is
pragma Convention (C, struct_timezone);
type struct_timezone_ptr is access all struct_timezone;
type struct_timeval is private;
-- This is needed on systems that do not have clock_gettime()
-- but do have gettimeofday().
function To_Duration (TV : struct_timeval) return Duration;
pragma Inline (To_Duration);
function To_Timeval (D : Duration) return struct_timeval;
pragma Inline (To_Timeval);
-------------------------
-- Priority Scheduling --
-------------------------
......@@ -535,12 +525,6 @@ private
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 1;
type struct_timeval is record
tv_sec : time_t;
tv_usec : time_t;
end record;
pragma Convention (C, struct_timeval);
type pthread_attr_t is new int;
type pthread_condattr_t is new int;
type pthread_mutexattr_t is new int;
......
......@@ -60,11 +60,6 @@ package body System.OS_Interface is
return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
end To_Duration;
function To_Duration (TV : struct_timeval) return Duration is
begin
return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
end To_Duration;
-----------------
-- To_Timespec --
-----------------
......@@ -89,30 +84,4 @@ package body System.OS_Interface is
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
----------------
-- To_Timeval --
----------------
function To_Timeval (D : Duration) return struct_timeval is
S : time_t;
F : Duration;
begin
S := time_t (Long_Long_Integer (D));
F := D - Duration (S);
-- If F has negative value due to a round-up, adjust for positive F
-- value.
if F < 0.0 then
S := S - 1;
F := F + 1.0;
end if;
return
struct_timeval'
(tv_sec => S,
tv_usec => time_t (Long_Long_Integer (F * 10#1#E6)));
end To_Timeval;
end System.OS_Interface;
......@@ -201,14 +201,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
type struct_timeval is private;
function To_Duration (TV : struct_timeval) return Duration;
pragma Inline (To_Duration);
function To_Timeval (D : Duration) return struct_timeval;
pragma Inline (To_Timeval);
-------------------------
-- Priority Scheduling --
-------------------------
......@@ -493,12 +485,6 @@ private
CLOCK_SGI_CYCLE : constant clockid_t := 2;
CLOCK_SGI_FAST : constant clockid_t := 3;
type struct_timeval is record
tv_sec : time_t;
tv_usec : time_t;
end record;
pragma Convention (C, struct_timeval);
type array_type_9 is array (Integer range 0 .. 4) of long;
type pthread_attr_t is record
X_X_D : array_type_9;
......
......@@ -208,19 +208,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
type struct_timeval is private;
function To_Duration (TV : struct_timeval) return Duration;
pragma Inline (To_Duration);
function To_Timeval (D : Duration) return struct_timeval;
pragma Inline (To_Timeval);
function gettimeofday
(tv : access struct_timeval;
tz : System.Address := System.Null_Address) return int;
pragma Import (C, gettimeofday, "gettimeofday");
function sysconf (name : int) return long;
pragma Import (C, sysconf);
......@@ -511,12 +498,6 @@ private
end record;
pragma Convention (C, timespec);
type struct_timeval is record
tv_sec : time_t;
tv_usec : time_t;
end record;
pragma Convention (C, struct_timeval);
type pthread_attr_t is record
detachstate : int;
schedpolicy : int;
......
......@@ -518,12 +518,6 @@ private
end record;
pragma Convention (C, timespec);
type struct_timeval is record
tv_sec : time_t;
tv_usec : time_t;
end record;
pragma Convention (C, struct_timeval);
type pthread_attr_t is record
detachstate : int;
schedpolicy : int;
......
......@@ -89,35 +89,19 @@ package body System.OS_Interface is
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
function To_Duration (TV : struct_timeval) return Duration is
begin
return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
end To_Duration;
function To_Timeval (D : Duration) return struct_timeval is
S : int;
F : Duration;
begin
S := int (Long_Long_Integer (D));
F := D - Duration (S);
-- If F has negative value due to a round-up, adjust for positive F
-- value.
if F < 0.0 then
S := S - 1;
F := F + 1.0;
end if;
return
struct_timeval'
(tv_sec => S,
tv_usec => int (Long_Long_Integer (F * 10#1#E6)));
end To_Timeval;
------------------
-- pthread_init --
------------------
procedure pthread_init is
begin
null;
end pthread_init;
--------------------
-- Get_Stack_Base --
--------------------
function Get_Stack_Base (thread : pthread_t) return Address is
pragma Warnings (Off, thread);
......@@ -125,6 +109,10 @@ package body System.OS_Interface is
return Null_Address;
end Get_Stack_Base;
-----------------
-- sigaltstack --
-----------------
function sigaltstack
(ss : not null access stack_t;
oss : access stack_t) return int is
......
......@@ -191,14 +191,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
type struct_timeval is private;
function To_Duration (TV : struct_timeval) return Duration;
pragma Inline (To_Duration);
function To_Timeval (D : Duration) return struct_timeval;
pragma Inline (To_Timeval);
-------------------------
-- Priority Scheduling --
-------------------------
......@@ -595,12 +587,6 @@ private
type clockid_t is new rtems_id;
CLOCK_REALTIME : constant clockid_t := 1;
type struct_timeval is record
tv_sec : int;
tv_usec : int;
end record;
pragma Convention (C, struct_timeval);
type pthread_attr_t is record
is_initialized : int;
stackaddr : System.Address;
......
......@@ -204,14 +204,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
type struct_timeval is private;
function To_Duration (TV : struct_timeval) return Duration;
pragma Inline (To_Duration);
function To_Timeval (D : Duration) return struct_timeval;
pragma Inline (To_Timeval);
-------------------------
-- Priority Scheduling --
-------------------------
......@@ -524,12 +516,6 @@ private
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 0;
type struct_timeval is record
tv_sec : time_t;
tv_usec : time_t;
end record;
pragma Convention (C, struct_timeval);
type pthread_attr_t is record
pthread_attrp : System.Address;
end record;
......
......@@ -77,40 +77,6 @@ package body System.OS_Interface is
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
-----------------
-- To_Duration --
-----------------
function To_Duration (TV : struct_timeval) return Duration is
begin
return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
end To_Duration;
----------------
-- To_Timeval --
----------------
function To_Timeval (D : Duration) return struct_timeval is
S : long;
F : Duration;
begin
S := long (Long_Long_Integer (D));
F := D - Duration (S);
-- If F has negative value due to a round-up, adjust for positive F
if F < 0.0 then
S := S - 1;
F := F + 1.0;
end if;
return
struct_timeval'
(tv_sec => S,
tv_usec => long (Long_Long_Integer (F * 10#1#E6)));
end To_Timeval;
------------------
-- pthread_init --
------------------
......
......@@ -263,16 +263,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
type struct_timeval is private;
-- This is needed on systems that do not have clock_gettime()
-- but do have gettimeofday().
function To_Duration (TV : struct_timeval) return Duration;
pragma Inline (To_Duration);
function To_Timeval (D : Duration) return struct_timeval;
pragma Inline (To_Timeval);
-------------
-- Process --
-------------
......@@ -528,12 +518,6 @@ private
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 0;
type struct_timeval is record
tv_sec : long;
tv_usec : long;
end record;
pragma Convention (C, struct_timeval);
type array_type_9 is array (0 .. 3) of unsigned_char;
type record_type_3 is record
flag : array_type_9;
......
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