OSDN Git Service

2007-10-15 Geert Bosch <bosch@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 Oct 2007 13:54:02 +0000 (13:54 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 Oct 2007 13:54:02 +0000 (13:54 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129319 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/adaint.c
gcc/ada/cal.c
gcc/ada/expect.c
gcc/ada/socket.c

index 74fb670..f5d4d10 100644 (file)
@@ -94,6 +94,7 @@
 #include <utime.h>
 #endif
 
+/* wait.h processing */
 #ifdef __MINGW32__
 #if OLD_MINGW
 #include <sys/wait.h>
    preventing the inclusion of the GCC header from doing anything.  */
 #define GCC_RESOURCE_H
 #include <sys/wait.h>
+#elif defined (__nucleus__)
+/* No wait() or waitpid() calls available */
 #else
+/* Default case */
 #include <sys/wait.h>
 #endif
 
@@ -275,7 +279,7 @@ const int __gnat_vmsp = 0;
 #elif defined (VMS)
 #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
 
 #else
@@ -391,38 +395,34 @@ __gnat_to_gm_time
 
 /* 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
-   of characters of its content in BUF.  Otherwise, return -1.  For Windows,
-   OS/2 and vxworks, always return -1.  */
+   of characters of its content in BUF.  Otherwise, return -1.
+   For systems not supporting symbolic links, always return -1.  */
 
 int
 __gnat_readlink (char *path ATTRIBUTE_UNUSED,
                 char *buf ATTRIBUTE_UNUSED,
                 size_t bufsiz ATTRIBUTE_UNUSED)
 {
-#if defined (MSDOS) || defined (_WIN32) || defined (__EMX__)
-  return -1;
-#elif defined (__INTERIX) || defined (VMS)
-  return -1;
-#elif defined (__vxworks)
+#if defined (MSDOS) || defined (_WIN32) || defined (__EMX__) \
+  || defined (__INTERIX) || defined (VMS) \
+  || defined(__vxworks) || defined (__nucleus__)
   return -1;
 #else
   return readlink (path, buf, bufsiz);
 #endif
 }
 
-/* Creates a symbolic link named NEWPATH which contains the string OLDPATH.  If
-   NEWPATH exists it will NOT be overwritten.  For Windows, OS/2, VxWorks,
-   Interix and VMS, always return -1. */
+/* Creates a symbolic link named NEWPATH which contains the string OLDPATH.
+   If NEWPATH exists it will NOT be overwritten.
+   For systems not supporting symbolic links, always return -1.  */
 
 int
 __gnat_symlink (char *oldpath ATTRIBUTE_UNUSED,
                char *newpath ATTRIBUTE_UNUSED)
 {
-#if defined (MSDOS) || defined (_WIN32) || defined (__EMX__)
-  return -1;
-#elif defined (__INTERIX) || defined (VMS)
-  return -1;
-#elif defined (__vxworks)
+#if defined (MSDOS) || defined (_WIN32) || defined (__EMX__) \
+  || defined (__INTERIX) || defined (VMS) \
+  || defined(__vxworks) || defined (__nucleus__)
   return -1;
 #else
   return symlink (oldpath, newpath);
@@ -431,7 +431,7 @@ __gnat_symlink (char *oldpath ATTRIBUTE_UNUSED,
 
 /* 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. */
 
@@ -888,6 +888,8 @@ __gnat_open_new_temp (char *path, int fmode)
   return mkstemp (path);
 #elif defined (__Lynx__)
   mktemp (path);
+#elif defined (__nucleus__)
+  return -1;
 #else
   if (mktemp (path) == NULL)
     return -1;
@@ -1649,7 +1651,7 @@ __gnat_is_writable_file (char *name)
 void
 __gnat_set_writable (char *name)
 {
-#ifndef __vxworks
+#if ! defined (__vxworks) && ! defined(__nucleus__)
   struct stat statbuf;
 
   if (stat (name, &statbuf) == 0)
@@ -1663,7 +1665,7 @@ __gnat_set_writable (char *name)
 void
 __gnat_set_executable (char *name)
 {
-#ifndef __vxworks
+#if ! defined (__vxworks) && ! defined(__nucleus__)
   struct stat statbuf;
 
   if (stat (name, &statbuf) == 0)
@@ -1677,7 +1679,7 @@ __gnat_set_executable (char *name)
 void
 __gnat_set_readonly (char *name)
 {
-#ifndef __vxworks
+#if ! defined (__vxworks) && ! defined(__nucleus__)
   struct stat statbuf;
 
   if (stat (name, &statbuf) == 0)
@@ -1691,7 +1693,7 @@ __gnat_set_readonly (char *name)
 int
 __gnat_is_symbolic_link (char *name ATTRIBUTE_UNUSED)
 {
-#if defined (__vxworks)
+#if defined (__vxworks) || defined (__nucleus__)
   return 0;
 
 #elif defined (_AIX) || defined (__APPLE__) || defined (__unix__)
@@ -1739,7 +1741,7 @@ __gnat_portable_spawn (char *args[])
   else
     return status;
 
-#elif defined (__vxworks)
+#elif defined (__vxworks) || defined(__nucleus__)
   return -1;
 #else
 
@@ -2039,7 +2041,7 @@ __gnat_portable_no_block_spawn (char *args[])
   pid = win32_no_block_spawn (args[0], args);
   return pid;
 
-#elif defined (__vxworks)
+#elif defined (__vxworks) || defined (__nucleus__)
   return -1;
 
 #else
@@ -2074,7 +2076,7 @@ __gnat_portable_wait (int *process_status)
 #elif defined (__EMX__) || defined (MSDOS)
   /* ??? 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
      return zero.  */
 #else
@@ -2897,7 +2899,7 @@ char __gnat_environment_char = '$';
 int
 __gnat_copy_attribs (char *from, char *to, int mode)
 {
-#if defined (VMS) || defined (__vxworks)
+#if defined (VMS) || defined (__vxworks) || defined (__nucleus__)
   return -1;
 #else
   struct stat fbuf;
index 0a552aa..38f68a8 100644 (file)
@@ -6,7 +6,7 @@
  *                                                                          *
  *                          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 *
  * terms of the  GNU General Public License as published  by the Free Soft- *
@@ -36,7 +36,7 @@
 /*  struct timeval fields type are not normalized (they are generally       */
 /*  defined as int or long values).                                         */
 
-#if defined(VMS)
+#if defined(VMS) || defined(__nucleus__)
 
 /* this is temporary code to avoid build failure under VMS */
 
@@ -62,6 +62,8 @@ __gnat_duration_to_timeval (long sec, long usec, void *t)
 #else
 #include <sys/times.h>
 #endif
+#elif defined (__nucleus__)
+#include <time.h>
 #else
 #include <sys/time.h>
 #endif
index 7503de0..a909232 100644 (file)
@@ -55,6 +55,8 @@
 /* ??? See comment in adaint.c.  */
 #define GCC_RESOURCE_H
 #include <sys/wait.h>
+#elif defined (__nucleus__)
+/* No wait.h available on Nucleus */
 #else
 #include <sys/wait.h>
 #endif
@@ -243,6 +245,13 @@ __gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set)
 #include <stdio.h>
 #include <vms/stsdef.h>
 #include <vms/iodef.h>
+#include <signal.h>
+
+void
+__gnat_kill (int pid, int sig, int close)
+{
+  kill (pid, sig);
+}
 
 int
 __gnat_waitpid (int pid)
@@ -367,8 +376,7 @@ __gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set)
 
   return ready;
 }
-
-#elif defined (__unix__)
+#elif defined (__unix__) && !defined (__nucleus__)
 
 #ifdef __hpux__
 #include <sys/ptyio.h>
index cae30e6..913d1ca 100644 (file)
  ****************************************************************************/
 
 /*  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 all the necessary system-specific headers and define the
    necessary macros (shared with gen-soccon). */
@@ -408,3 +411,4 @@ __gnat_get_h_errno (void) {
   return h_errno;
 #endif
 }
+#endif /* __nucleus__ */