Commit aace458a by Geert Bosch Committed by Arnaud Charlet

adaint.c, [...]: Initial port to arm-mentor-nucleus.

2007-10-15  Geert Bosch  <bosch@adacore.com>

	* adaint.c, socket.c, cal.c: Initial port to arm-mentor-nucleus.

	* expect.c: Initial port to arm-mentor-nucleus.
	Use kill for __gnat_kill() on VMS.

From-SVN: r129319
parent 67ce0d7e
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
#include <utime.h> #include <utime.h>
#endif #endif
/* wait.h processing */
#ifdef __MINGW32__ #ifdef __MINGW32__
#if OLD_MINGW #if OLD_MINGW
#include <sys/wait.h> #include <sys/wait.h>
...@@ -108,7 +109,10 @@ ...@@ -108,7 +109,10 @@
preventing the inclusion of the GCC header from doing anything. */ preventing the inclusion of the GCC header from doing anything. */
#define GCC_RESOURCE_H #define GCC_RESOURCE_H
#include <sys/wait.h> #include <sys/wait.h>
#elif defined (__nucleus__)
/* No wait() or waitpid() calls available */
#else #else
/* Default case */
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif
...@@ -275,7 +279,7 @@ const int __gnat_vmsp = 0; ...@@ -275,7 +279,7 @@ const int __gnat_vmsp = 0;
#elif defined (VMS) #elif defined (VMS)
#define GNAT_MAX_PATH_LEN 256 /* PATH_MAX */ #define GNAT_MAX_PATH_LEN 256 /* PATH_MAX */
#elif defined (__vxworks) || defined (__OPENNT) #elif defined (__vxworks) || defined (__OPENNT) || defined(__nucleus__)
#define GNAT_MAX_PATH_LEN PATH_MAX #define GNAT_MAX_PATH_LEN PATH_MAX
#else #else
...@@ -391,38 +395,34 @@ __gnat_to_gm_time ...@@ -391,38 +395,34 @@ __gnat_to_gm_time
/* Place the contents of the symbolic link named PATH in the buffer BUF, /* Place the contents of the symbolic link named PATH in the buffer BUF,
which has size BUFSIZ. If PATH is a symbolic link, then return the number which has size BUFSIZ. If PATH is a symbolic link, then return the number
of characters of its content in BUF. Otherwise, return -1. For Windows, of characters of its content in BUF. Otherwise, return -1.
OS/2 and vxworks, always return -1. */ For systems not supporting symbolic links, always return -1. */
int int
__gnat_readlink (char *path ATTRIBUTE_UNUSED, __gnat_readlink (char *path ATTRIBUTE_UNUSED,
char *buf ATTRIBUTE_UNUSED, char *buf ATTRIBUTE_UNUSED,
size_t bufsiz ATTRIBUTE_UNUSED) size_t bufsiz ATTRIBUTE_UNUSED)
{ {
#if defined (MSDOS) || defined (_WIN32) || defined (__EMX__) #if defined (MSDOS) || defined (_WIN32) || defined (__EMX__) \
return -1; || defined (__INTERIX) || defined (VMS) \
#elif defined (__INTERIX) || defined (VMS) || defined(__vxworks) || defined (__nucleus__)
return -1;
#elif defined (__vxworks)
return -1; return -1;
#else #else
return readlink (path, buf, bufsiz); return readlink (path, buf, bufsiz);
#endif #endif
} }
/* Creates a symbolic link named NEWPATH which contains the string OLDPATH. If /* Creates a symbolic link named NEWPATH which contains the string OLDPATH.
NEWPATH exists it will NOT be overwritten. For Windows, OS/2, VxWorks, If NEWPATH exists it will NOT be overwritten.
Interix and VMS, always return -1. */ For systems not supporting symbolic links, always return -1. */
int int
__gnat_symlink (char *oldpath ATTRIBUTE_UNUSED, __gnat_symlink (char *oldpath ATTRIBUTE_UNUSED,
char *newpath ATTRIBUTE_UNUSED) char *newpath ATTRIBUTE_UNUSED)
{ {
#if defined (MSDOS) || defined (_WIN32) || defined (__EMX__) #if defined (MSDOS) || defined (_WIN32) || defined (__EMX__) \
return -1; || defined (__INTERIX) || defined (VMS) \
#elif defined (__INTERIX) || defined (VMS) || defined(__vxworks) || defined (__nucleus__)
return -1;
#elif defined (__vxworks)
return -1; return -1;
#else #else
return symlink (oldpath, newpath); return symlink (oldpath, newpath);
...@@ -431,7 +431,7 @@ __gnat_symlink (char *oldpath ATTRIBUTE_UNUSED, ...@@ -431,7 +431,7 @@ __gnat_symlink (char *oldpath ATTRIBUTE_UNUSED,
/* Try to lock a file, return 1 if success. */ /* Try to lock a file, return 1 if success. */
#if defined (__vxworks) || defined (MSDOS) || defined (_WIN32) #if defined (__vxworks) || defined (__nucleus__) || defined (MSDOS) || defined (_WIN32)
/* Version that does not use link. */ /* Version that does not use link. */
...@@ -888,6 +888,8 @@ __gnat_open_new_temp (char *path, int fmode) ...@@ -888,6 +888,8 @@ __gnat_open_new_temp (char *path, int fmode)
return mkstemp (path); return mkstemp (path);
#elif defined (__Lynx__) #elif defined (__Lynx__)
mktemp (path); mktemp (path);
#elif defined (__nucleus__)
return -1;
#else #else
if (mktemp (path) == NULL) if (mktemp (path) == NULL)
return -1; return -1;
...@@ -1649,7 +1651,7 @@ __gnat_is_writable_file (char *name) ...@@ -1649,7 +1651,7 @@ __gnat_is_writable_file (char *name)
void void
__gnat_set_writable (char *name) __gnat_set_writable (char *name)
{ {
#ifndef __vxworks #if ! defined (__vxworks) && ! defined(__nucleus__)
struct stat statbuf; struct stat statbuf;
if (stat (name, &statbuf) == 0) if (stat (name, &statbuf) == 0)
...@@ -1663,7 +1665,7 @@ __gnat_set_writable (char *name) ...@@ -1663,7 +1665,7 @@ __gnat_set_writable (char *name)
void void
__gnat_set_executable (char *name) __gnat_set_executable (char *name)
{ {
#ifndef __vxworks #if ! defined (__vxworks) && ! defined(__nucleus__)
struct stat statbuf; struct stat statbuf;
if (stat (name, &statbuf) == 0) if (stat (name, &statbuf) == 0)
...@@ -1677,7 +1679,7 @@ __gnat_set_executable (char *name) ...@@ -1677,7 +1679,7 @@ __gnat_set_executable (char *name)
void void
__gnat_set_readonly (char *name) __gnat_set_readonly (char *name)
{ {
#ifndef __vxworks #if ! defined (__vxworks) && ! defined(__nucleus__)
struct stat statbuf; struct stat statbuf;
if (stat (name, &statbuf) == 0) if (stat (name, &statbuf) == 0)
...@@ -1691,7 +1693,7 @@ __gnat_set_readonly (char *name) ...@@ -1691,7 +1693,7 @@ __gnat_set_readonly (char *name)
int int
__gnat_is_symbolic_link (char *name ATTRIBUTE_UNUSED) __gnat_is_symbolic_link (char *name ATTRIBUTE_UNUSED)
{ {
#if defined (__vxworks) #if defined (__vxworks) || defined (__nucleus__)
return 0; return 0;
#elif defined (_AIX) || defined (__APPLE__) || defined (__unix__) #elif defined (_AIX) || defined (__APPLE__) || defined (__unix__)
...@@ -1739,7 +1741,7 @@ __gnat_portable_spawn (char *args[]) ...@@ -1739,7 +1741,7 @@ __gnat_portable_spawn (char *args[])
else else
return status; return status;
#elif defined (__vxworks) #elif defined (__vxworks) || defined(__nucleus__)
return -1; return -1;
#else #else
...@@ -2039,7 +2041,7 @@ __gnat_portable_no_block_spawn (char *args[]) ...@@ -2039,7 +2041,7 @@ __gnat_portable_no_block_spawn (char *args[])
pid = win32_no_block_spawn (args[0], args); pid = win32_no_block_spawn (args[0], args);
return pid; return pid;
#elif defined (__vxworks) #elif defined (__vxworks) || defined (__nucleus__)
return -1; return -1;
#else #else
...@@ -2074,7 +2076,7 @@ __gnat_portable_wait (int *process_status) ...@@ -2074,7 +2076,7 @@ __gnat_portable_wait (int *process_status)
#elif defined (__EMX__) || defined (MSDOS) #elif defined (__EMX__) || defined (MSDOS)
/* ??? See corresponding comment in portable_no_block_spawn. */ /* ??? See corresponding comment in portable_no_block_spawn. */
#elif defined (__vxworks) #elif defined (__vxworks) || defined (__nucleus__)
/* Not sure what to do here, so do same as __EMX__ case, i.e., nothing but /* Not sure what to do here, so do same as __EMX__ case, i.e., nothing but
return zero. */ return zero. */
#else #else
...@@ -2897,7 +2899,7 @@ char __gnat_environment_char = '$'; ...@@ -2897,7 +2899,7 @@ char __gnat_environment_char = '$';
int int
__gnat_copy_attribs (char *from, char *to, int mode) __gnat_copy_attribs (char *from, char *to, int mode)
{ {
#if defined (VMS) || defined (__vxworks) #if defined (VMS) || defined (__vxworks) || defined (__nucleus__)
return -1; return -1;
#else #else
struct stat fbuf; struct stat fbuf;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Implementation File * * C Implementation File *
* * * *
* Copyright (C) 1992-2006, Free Software Foundation, Inc. * * Copyright (C) 1992-2007, 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- *
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
/* struct timeval fields type are not normalized (they are generally */ /* struct timeval fields type are not normalized (they are generally */
/* defined as int or long values). */ /* defined as int or long values). */
#if defined(VMS) #if defined(VMS) || defined(__nucleus__)
/* this is temporary code to avoid build failure under VMS */ /* this is temporary code to avoid build failure under VMS */
...@@ -62,6 +62,8 @@ __gnat_duration_to_timeval (long sec, long usec, void *t) ...@@ -62,6 +62,8 @@ __gnat_duration_to_timeval (long sec, long usec, void *t)
#else #else
#include <sys/times.h> #include <sys/times.h>
#endif #endif
#elif defined (__nucleus__)
#include <time.h>
#else #else
#include <sys/time.h> #include <sys/time.h>
#endif #endif
......
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
/* ??? See comment in adaint.c. */ /* ??? See comment in adaint.c. */
#define GCC_RESOURCE_H #define GCC_RESOURCE_H
#include <sys/wait.h> #include <sys/wait.h>
#elif defined (__nucleus__)
/* No wait.h available on Nucleus */
#else #else
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif
...@@ -243,6 +245,13 @@ __gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set) ...@@ -243,6 +245,13 @@ __gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set)
#include <stdio.h> #include <stdio.h>
#include <vms/stsdef.h> #include <vms/stsdef.h>
#include <vms/iodef.h> #include <vms/iodef.h>
#include <signal.h>
void
__gnat_kill (int pid, int sig, int close)
{
kill (pid, sig);
}
int int
__gnat_waitpid (int pid) __gnat_waitpid (int pid)
...@@ -367,8 +376,7 @@ __gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set) ...@@ -367,8 +376,7 @@ __gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set)
return ready; return ready;
} }
#elif defined (__unix__) && !defined (__nucleus__)
#elif defined (__unix__)
#ifdef __hpux__ #ifdef __hpux__
#include <sys/ptyio.h> #include <sys/ptyio.h>
......
...@@ -31,7 +31,10 @@ ...@@ -31,7 +31,10 @@
****************************************************************************/ ****************************************************************************/
/* This file provides a portable binding to the sockets API */ /* This file provides a portable binding to the sockets API */
#if defined (__nucleus__)
/* ??? Need proper implementation */
#warning Sockets not yet supported on Nucleus
#else
#include "gsocket.h" #include "gsocket.h"
/* Include all the necessary system-specific headers and define the /* Include all the necessary system-specific headers and define the
necessary macros (shared with gen-soccon). */ necessary macros (shared with gen-soccon). */
...@@ -408,3 +411,4 @@ __gnat_get_h_errno (void) { ...@@ -408,3 +411,4 @@ __gnat_get_h_errno (void) {
return h_errno; return h_errno;
#endif #endif
} }
#endif /* __nucleus__ */
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