Commit c9e80306 by Jerome Lambourg Committed by Pierre-Marie de Rodat

[Ada] QNX: various runtime fixes for file I/O, timers, timezone

2018-01-11  Jerome Lambourg  <lambourg@adacore.com>

gcc/ada/

	* libgnat/g-soliop__qnx.ads: New.
	* adaint.c, adaint.h, cstreams.c, s-oscons-tmplt.c, sysdep.c: Update
	for QNX.

From-SVN: r256512
parent 4727f693
2018-01-11 Jerome Lambourg <lambourg@adacore.com>
* libgnat/g-soliop__qnx.ads: New.
* adaint.c, adaint.h, cstreams.c, s-oscons-tmplt.c, sysdep.c: Update
for QNX.
2018-01-11 Bob Duff <duff@adacore.com> 2018-01-11 Bob Duff <duff@adacore.com>
* par-ch9.adb (P_Protected_Operation_Declaration_Opt): Give an error if * par-ch9.adb (P_Protected_Operation_Declaration_Opt): Give an error if
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Implementation File * * C Implementation File *
* * * *
* Copyright (C) 1992-2017, Free Software Foundation, Inc. * * Copyright (C) 1992-2018, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -81,6 +81,10 @@ ...@@ -81,6 +81,10 @@
#define __BSD_VISIBLE 1 #define __BSD_VISIBLE 1
#endif #endif
#if defined (__QNX__)
#define _LARGEFILE64_SOURCE 1
#endif
#ifdef IN_RTS #ifdef IN_RTS
#include "tconfig.h" #include "tconfig.h"
#include "tsystem.h" #include "tsystem.h"
...@@ -773,7 +777,7 @@ __gnat_rmdir (char *path) ...@@ -773,7 +777,7 @@ __gnat_rmdir (char *path)
} }
#if defined (_WIN32) || defined (__linux__) || defined (__sun__) \ #if defined (_WIN32) || defined (__linux__) || defined (__sun__) \
|| defined (__FreeBSD__) || defined(__DragonFly__) || defined (__FreeBSD__) || defined(__DragonFly__) || defined (__QNX__)
#define HAS_TARGET_WCHAR_T #define HAS_TARGET_WCHAR_T
#endif #endif
...@@ -2346,7 +2350,7 @@ __gnat_number_of_cpus (void) ...@@ -2346,7 +2350,7 @@ __gnat_number_of_cpus (void)
#if defined (__linux__) || defined (__sun__) || defined (_AIX) \ #if defined (__linux__) || defined (__sun__) || defined (_AIX) \
|| defined (__APPLE__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ || defined (__APPLE__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
|| defined (__DragonFly__) || defined (__NetBSD__) || defined (__DragonFly__) || defined (__NetBSD__) || defined (__QNX__)
cores = (int) sysconf (_SC_NPROCESSORS_ONLN); cores = (int) sysconf (_SC_NPROCESSORS_ONLN);
#elif defined (__hpux__) #elif defined (__hpux__)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Header File * * C Header File *
* * * *
* Copyright (C) 1992-2017, Free Software Foundation, Inc. * * Copyright (C) 1992-2018, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -51,7 +51,7 @@ extern "C" { ...@@ -51,7 +51,7 @@ extern "C" {
determine at compile time what support the system offers for large files. determine at compile time what support the system offers for large files.
For now we just list the platforms we have manually tested. */ For now we just list the platforms we have manually tested. */
#if defined (__GLIBC__) || defined (__sun__) #if defined (__GLIBC__) || defined (__sun__) || defined (__QNX__)
#define GNAT_FOPEN fopen64 #define GNAT_FOPEN fopen64
#define GNAT_OPEN open64 #define GNAT_OPEN open64
#define GNAT_STAT stat64 #define GNAT_STAT stat64
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* Auxiliary C functions for Interfaces.C.Streams * * Auxiliary C functions for Interfaces.C.Streams *
* * * *
* Copyright (C) 1992-2017, Free Software Foundation, Inc. * * Copyright (C) 1992-2018, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -198,6 +198,19 @@ __gnat_full_name (char *nam, char *buffer) ...@@ -198,6 +198,19 @@ __gnat_full_name (char *nam, char *buffer)
getcwd approach instead. */ getcwd approach instead. */
realpath (nam, buffer); realpath (nam, buffer);
#elif defined (__QNX__)
int length;
if (__gnat_is_absolute_path (nam, strlen (nam)))
realpath (nam, buffer);
else
{
length = __gnat_max_path_len;
__gnat_get_current_dir (buffer, &length);
strncat (buffer, nam, __gnat_max_path_len - length - 1);
}
#elif defined (__vxworks) #elif defined (__vxworks)
/* On VxWorks systems, an absolute path can be represented (depending on /* On VxWorks systems, an absolute path can be represented (depending on
......
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . S O C K E T S . L I N K E R _ O P T I O N S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2018, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package is used to provide target specific linker_options for the
-- support of sockets as required by the package GNAT.Sockets.
-- This is an empty version for default use where no additional libraries
-- are required. On some targets a target specific version of this unit
-- ensures linking with required libraries for proper sockets operation.
-- This package should not be directly with'ed by an application program
package GNAT.Sockets.Linker_Options is
pragma Linker_Options ("-lsocket");
end GNAT.Sockets.Linker_Options;
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2000-2017, Free Software Foundation, Inc. -- -- Copyright (C) 2000-2018, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -1443,7 +1443,7 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock") ...@@ -1443,7 +1443,7 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
#if defined(__linux__) || defined(__FreeBSD__) \ #if defined(__linux__) || defined(__FreeBSD__) \
|| (defined(_AIX) && defined(_AIXVERSION_530)) \ || (defined(_AIX) && defined(_AIXVERSION_530)) \
|| defined(__DragonFly__) || defined(__DragonFly__) || defined(__QNX__)
/** On these platforms use system provided monotonic clock instead of /** On these platforms use system provided monotonic clock instead of
** the default CLOCK_REALTIME. We then need to set up cond var attributes ** the default CLOCK_REALTIME. We then need to set up cond var attributes
** appropriately (see thread.c). ** appropriately (see thread.c).
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Implementation File * * C Implementation File *
* * * *
* Copyright (C) 1992-2017, Free Software Foundation, Inc. * * Copyright (C) 1992-2018, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -317,7 +317,8 @@ __gnat_ttyname (int filedes) ...@@ -317,7 +317,8 @@ __gnat_ttyname (int filedes)
|| defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \ || defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \
|| (defined (__svr4__) && defined (__i386__)) || defined (__Lynx__) \ || (defined (__svr4__) && defined (__i386__)) || defined (__Lynx__) \
|| defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ || defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
|| defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \
|| defined (__QNX__)
# ifdef __MINGW32__ # ifdef __MINGW32__
# if OLD_MINGW # if OLD_MINGW
...@@ -369,7 +370,8 @@ getc_immediate_common (FILE *stream, ...@@ -369,7 +370,8 @@ getc_immediate_common (FILE *stream,
|| defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \ || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \
|| defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \ || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \
|| defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
|| defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \
|| defined (__QNX__)
char c; char c;
int nread; int nread;
int good_one = 0; int good_one = 0;
...@@ -389,7 +391,8 @@ getc_immediate_common (FILE *stream, ...@@ -389,7 +391,8 @@ getc_immediate_common (FILE *stream,
|| defined (__MACHTEN__) || defined (__hpux__) \ || defined (__MACHTEN__) || defined (__hpux__) \
|| defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \ || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \
|| defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
|| defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \
|| defined (__QNX__)
eof_ch = termios_rec.c_cc[VEOF]; eof_ch = termios_rec.c_cc[VEOF];
/* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for /* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for
...@@ -826,7 +829,7 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED, ...@@ -826,7 +829,7 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED,
#elif defined (__APPLE__) || defined (__FreeBSD__) || defined (__linux__) \ #elif defined (__APPLE__) || defined (__FreeBSD__) || defined (__linux__) \
|| defined (__GLIBC__) || defined (__DragonFly__) || defined (__OpenBSD__) \ || defined (__GLIBC__) || defined (__DragonFly__) || defined (__OpenBSD__) \
|| defined (__DJGPP__) || defined (__DJGPP__) || defined (__QNX__)
{ {
localtime_r (timer, &tp); localtime_r (timer, &tp);
*off = tp.tm_gmtoff; *off = tp.tm_gmtoff;
......
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