Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Oct 1998 07:09:53 -0800 (PST)
From:      eischen@vigrid.com
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   ports/8502: GNAT 3.10 port uses clock_gettime which isn't in FreeBSD 2.x
Message-ID:  <199810301509.HAA19144@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         8502
>Category:       ports
>Synopsis:       GNAT 3.10 port uses clock_gettime which isn't in FreeBSD 2.x
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 30 07:10:00 PST 1998
>Last-Modified:
>Originator:     Daniel M. Eischen
>Organization:
>Release:        FreeBSD-stable
>Environment:
FreeBSD klr.clc.gdeb.com 2.2.7-STABLE FreeBSD 2.2.7-STABLE #0: Thu Oct 22 18:12:35 EDT 1998     deischen@klr.clc.gdeb.com:/opt/b/src/src/sys/compile/klr  i386

Also tested on -current.
>Description:
The GNAT port uses clock_gettime when it builds the tasking run-time.
Unfortunately, clock_gettime doesn't exist under 2.x releases of
GNAT.  The simple fix is to use gettimeofday in the FreeBSD specific
Ada run-time files.
>How-To-Repeat:
Heh!  Build an Ada program with tasking:

-- This is in file hello.adb.  Build with 'gnatmake hello'
-- On a 2.x system, it will fail with unresolved symbol clock_gettime.
with Ada.Text_IO;
procedure Hello_World is
begin
  Ada.Text_IO.Put ("Hello, ");
  delay (0.125);  -- This invokes the Ada tasking run-time and clock_gettime.
  Ada.Text_IO.Put_Line ("world!");
end Hello_World;
>Fix:
Apply this patch to the port:

*** /usr/ports/lang/gnat/files/5fosinte.ads	Sun Jan 18 04:08:37 1998
--- gnat-3.10/files/5fosinte.ads	Fri May 22 11:52:24 1998
***************
*** 285,290 ****
--- 285,292 ----
        tz_dsttime   : int;
     end record;
     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().
***************
*** 297,303 ****
  
     function gettimeofday
       (tv : access struct_timeval;
!       tz : access struct_timezone) return int;
     pragma Import (C, gettimeofday, "gettimeofday");
  
     procedure usleep (useconds : unsigned_long);
--- 299,305 ----
  
     function gettimeofday
       (tv : access struct_timeval;
!       tz : struct_timezone_ptr) return int;
     pragma Import (C, gettimeofday, "gettimeofday");
  
     procedure usleep (useconds : unsigned_long);
*** /usr/ports/lang/gnat/files/5ftaprop.adb	Sun Jan 18 04:08:37 1998
--- gnat-3.10/files/5ftaprop.adb	Fri May 22 10:22:37 1998
***************
*** 470,483 ****
     -----------
  
     function Clock return Duration is
!       TS     : aliased timespec;
        Result : Interfaces.C.int;
  
     begin
!       Result := clock_gettime (CLOCK_REALTIME, TS'Unchecked_Access);
        pragma Assert (Result = 0
!         or else Shutdown ("GNULLI failure---clock_gettime"));
!       return To_Duration (TS);
     exception
        when others =>
           pragma Assert (Shutdown ("exception in Clock"));
--- 470,483 ----
     -----------
  
     function Clock return Duration is
!       TV     : aliased struct_timeval;
        Result : Interfaces.C.int;
  
     begin
!       Result := gettimeofday (TV'Unchecked_Access, null);
        pragma Assert (Result = 0
!         or else Shutdown ("GNULLI failure---gettimeofday"));
!       return To_Duration (TV);
     exception
        when others =>
           pragma Assert (Shutdown ("exception in Clock"));

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810301509.HAA19144>