diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-08-01 11:55:31 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-08-01 11:55:31 +0200 |
commit | e08add8ea93dfa94541f2d20c0b56614ef0a2449 (patch) | |
tree | cfb5ed0ca60c0acf412567b89fe656268827d52f /gcc/ada/adaint.c | |
parent | 21c51f53f0145dd812b2231e03116f49fadcd004 (diff) | |
download | gcc-e08add8ea93dfa94541f2d20c0b56614ef0a2449.zip gcc-e08add8ea93dfa94541f2d20c0b56614ef0a2449.tar.gz gcc-e08add8ea93dfa94541f2d20c0b56614ef0a2449.tar.bz2 |
[multiple changes]
2014-08-01 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Remove VMS specific rules for pragma Ident.
* Makefile.rtl, adaint.c, gnat_rm.texi, s-asthan.adb, s-asthan.ads,
s-filofl.ads, s-fishfl.ads, s-fvadfl.ads, s-fvaffl.ads, s-fvagfl.ads,
s-po32gl.adb, s-po32gl.ads, s-vaflop.adb, s-vaflop.ads, s-vmexta.adb,
s-vmexta.ads, sem_vfpt.adb, sem_vfpt.ads, socket.c: Remove VMS specific
code.
* gcc-interface/decl.c, gcc-interface/Makefile.in,
gcc-interface/Make-lang.in: Ditto. Also remove refs to rTX.
2014-08-01 Pascal Obry <obry@adacore.com>
* s-os_lib.ads: Rename File_Size to Large_File_Size.
From-SVN: r213438
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r-- | gcc/ada/adaint.c | 997 |
1 files changed, 26 insertions, 971 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index ecf961d..44839ea 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -71,12 +71,6 @@ #include <sys/pstat.h> #endif -#ifdef VMS -#define _POSIX_EXIT 1 -#define HOST_EXECUTABLE_SUFFIX ".exe" -#define HOST_OBJECT_SUFFIX ".obj" -#endif - #ifdef __PikeOS__ #define __BSD_VISIBLE 1 #endif @@ -87,9 +81,6 @@ #include <sys/stat.h> #include <fcntl.h> #include <time.h> -#ifdef VMS -#include <unixio.h> -#endif #if defined (__vxworks) || defined (__ANDROID__) /* S_IREAD and S_IWRITE are not defined in VxWorks or Android */ @@ -147,7 +138,7 @@ UINT CurrentCCSEncoding; #include <utime.h> #undef VMOS_DEV -#elif !defined (VMS) +#else #include <utime.h> #endif @@ -174,75 +165,17 @@ UINT CurrentCCSEncoding; #endif #if defined (_WIN32) -#elif defined (VMS) - -/* Header files and definitions for __gnat_set_file_time_name. */ - -#define __NEW_STARLET 1 -#include <vms/rms.h> -#include <vms/atrdef.h> -#include <vms/fibdef.h> -#include <vms/stsdef.h> -#include <vms/iodef.h> -#include <errno.h> -#include <vms/descrip.h> -#include <string.h> -#include <unixlib.h> - -/* Use native 64-bit arithmetic. */ -#define unix_time_to_vms(X,Y) \ - { \ - unsigned long long reftime, tmptime = (X); \ - $DESCRIPTOR (unixtime,"1-JAN-1970 0:00:00.00"); \ - SYS$BINTIM (&unixtime, &reftime); \ - Y = tmptime * 10000000 + reftime; \ - } - -/* descrip.h doesn't have everything ... */ -typedef struct fibdef* __fibdef_ptr32 __attribute__ (( mode (SI) )); -struct dsc$descriptor_fib -{ - unsigned int fib$l_len; - __fibdef_ptr32 fib$l_addr; -}; - -/* I/O Status Block. */ -struct IOSB -{ - unsigned short status, count; - unsigned int devdep; -}; - -static char *tryfile; -/* Variable length string. */ -struct vstring -{ - short length; - char string[NAM$C_MAXRSS+1]; -}; - -#define SYI$_ACTIVECPU_CNT 0x111e -extern int LIB$GETSYI (int *, unsigned int *); -extern unsigned int LIB$CALLG_64 (unsigned long long argument_list [], - int (*user_procedure)(void)); - -#else -#include <utime.h> -#endif - -#if defined (_WIN32) #include <process.h> -#endif - -#if defined (_WIN32) - #include <dir.h> #include <windows.h> #include <accctrl.h> #include <aclapi.h> #undef DIR_SEPARATOR #define DIR_SEPARATOR '\\' + +#else +#include <utime.h> #endif #include "adaint.h" @@ -315,27 +248,12 @@ char __gnat_path_separator = PATH_SEPARATOR; as well. This is only a temporary work-around for 3.11b. */ #ifndef GNAT_LIBRARY_TEMPLATE -#if defined (VMS) -#define GNAT_LIBRARY_TEMPLATE "*.olb" -#else #define GNAT_LIBRARY_TEMPLATE "lib*.a" #endif -#endif const char *__gnat_library_template = GNAT_LIBRARY_TEMPLATE; -/* This variable is used in hostparm.ads to say whether the host is a VMS - system. */ -#ifdef VMS -int __gnat_vmsp = 1; -#else -int __gnat_vmsp = 0; -#endif - -#if defined (VMS) -#define GNAT_MAX_PATH_LEN 256 /* PATH_MAX */ - -#elif defined (__vxworks) || defined (__OPENNT) || defined(__nucleus__) +#if defined (__vxworks) || defined (__OPENNT) || defined(__nucleus__) #define GNAT_MAX_PATH_LEN PATH_MAX #else @@ -382,37 +300,7 @@ int __gnat_use_acl = 1; system provides the routine readdir_r. */ #undef HAVE_READDIR_R -#if defined(VMS) && defined (__LONG_POINTERS) - -/* Return a 32 bit pointer to an array of 32 bit pointers - given a 64 bit pointer to an array of 64 bit pointers */ - -typedef __char_ptr32 *__char_ptr_char_ptr32 __attribute__ ((mode (SI))); - -static __char_ptr_char_ptr32 -to_ptr32 (char **ptr64) -{ - int argc; - __char_ptr_char_ptr32 short_argv; - - for (argc = 0; ptr64[argc]; argc++) - ; - - /* Reallocate argv with 32 bit pointers. */ - short_argv = (__char_ptr_char_ptr32) decc$malloc - (sizeof (__char_ptr32) * (argc + 1)); - - for (argc = 0; ptr64[argc]; argc++) - short_argv[argc] = (__char_ptr32) decc$strdup (ptr64[argc]); - - short_argv[argc] = (__char_ptr32) 0; - return short_argv; - -} -#define MAYBE_TO_PTR32(argv) to_ptr32 (argv) -#else #define MAYBE_TO_PTR32(argv) argv -#endif static const char ATTR_UNSET = 127; @@ -485,12 +373,7 @@ __gnat_to_gm_time (OS_Time *p_time, int *p_year, int *p_month, int *p_day, time++; #endif -#ifdef VMS - res = localtime (&time); -#else res = gmtime (&time); -#endif - if (res) { *p_year = res->tm_year; @@ -533,7 +416,7 @@ __gnat_readlink (char *path ATTRIBUTE_UNUSED, char *buf ATTRIBUTE_UNUSED, size_t bufsiz ATTRIBUTE_UNUSED) { -#if defined (_WIN32) || defined (VMS) \ +#if defined (_WIN32) \ || defined(__vxworks) || defined (__nucleus__) || defined (__PikeOS__) return -1; #else @@ -549,7 +432,7 @@ int __gnat_symlink (char *oldpath ATTRIBUTE_UNUSED, char *newpath ATTRIBUTE_UNUSED) { -#if defined (_WIN32) || defined (VMS) \ +#if defined (_WIN32) \ || defined(__vxworks) || defined (__nucleus__) || defined (__PikeOS__) return -1; #else @@ -560,7 +443,7 @@ __gnat_symlink (char *oldpath ATTRIBUTE_UNUSED, /* Try to lock a file, return 1 if success. */ #if defined (__vxworks) || defined (__nucleus__) \ - || defined (_WIN32) || defined (VMS) || defined (__PikeOS__) + || defined (_WIN32) || defined (__PikeOS__) /* Version that does not use link. */ @@ -632,14 +515,7 @@ __gnat_try_lock (char *dir, char *file) int __gnat_get_maximum_file_name_length (void) { -#if defined (VMS) - if (getenv ("GNAT$EXTENDED_FILE_SPECIFICATIONS")) - return -1; - else - return 39; -#else return -1; -#endif } /* Return nonzero if file names are case sensitive. */ @@ -658,7 +534,7 @@ __gnat_get_file_names_case_sensitive (void) && sensitive[1] == '\0') file_names_case_sensitive_cache = sensitive[0] - '0'; else -#if defined (VMS) || defined (WINNT) || defined (__APPLE__) +#if defined (WINNT) || defined (__APPLE__) file_names_case_sensitive_cache = 0; #else file_names_case_sensitive_cache = 1; @@ -672,7 +548,7 @@ __gnat_get_file_names_case_sensitive (void) int __gnat_get_env_vars_case_sensitive (void) { -#if defined (VMS) || defined (WINNT) +#if defined (WINNT) return 0; #else return 1; @@ -697,9 +573,6 @@ __gnat_get_current_dir (char *dir, int *length) WS2SC (dir, wdir, GNAT_MAX_PATH_LEN); -#elif defined (VMS) - /* Force Unix style, which is what GNAT uses internally. */ - getcwd (dir, *length, 0); #else getcwd (dir, *length); #endif @@ -888,38 +761,7 @@ __gnat_fopen (char *path, char *mode, int encoding ATTRIBUTE_UNUSED, S2WS (wpath, path, GNAT_MAX_PATH_LEN); return _tfopen (wpath, wmode); -#elif defined (VMS) - if (vms_form == 0) - return decc$fopen (path, mode); - else - { - char *local_form = (char *) alloca (strlen (vms_form) + 1); - /* Allocate an argument list of guaranteed ample length. */ - unsigned long long *arg_list = - (unsigned long long *) alloca (strlen (vms_form) + 3); - char *ptrb, *ptre; - int i; - - arg_list [1] = (unsigned long long) path; - arg_list [2] = (unsigned long long) mode; - strcpy (local_form, vms_form); - - /* Given a string such as "\"rfm=udf\",\"rat=cr\"" - Split it into an argument list as "rfm=udf","rat=cr". */ - ptrb = local_form; - for (i = 0; *ptrb; i++) - { - ptrb = strchr (ptrb, '"'); - ptre = strchr (ptrb + 1, '"'); - *ptre = 0; - arg_list [i + 3] = (unsigned long long) (ptrb + 1); - ptrb = ptre + 1; - } - arg_list [0] = i + 2; - /* CALLG_64 returns int , fortunately (FILE *) on VMS is a - always a 32bit pointer. */ - return LIB$CALLG_64 (arg_list, &decc$fopen); - } + #else return GNAT_FOPEN (path, mode); #endif @@ -946,39 +788,6 @@ __gnat_freopen (char *path, S2WS (wpath, path, GNAT_MAX_PATH_LEN); return _tfreopen (wpath, wmode, stream); -#elif defined (VMS) - if (vms_form == 0) - return decc$freopen (path, mode, stream); - else - { - char *local_form = (char *) alloca (strlen (vms_form) + 1); - /* Allocate an argument list of guaranteed ample length. */ - unsigned long long *arg_list = - (unsigned long long *) alloca (strlen (vms_form) + 4); - char *ptrb, *ptre; - int i; - - arg_list [1] = (unsigned long long) path; - arg_list [2] = (unsigned long long) mode; - arg_list [3] = (unsigned long long) stream; - strcpy (local_form, vms_form); - - /* Given a string such as "\"rfm=udf\",\"rat=cr\"" - Split it into an argument list as "rfm=udf","rat=cr". */ - ptrb = local_form; - for (i = 0; *ptrb; i++) - { - ptrb = strchr (ptrb, '"'); - ptre = strchr (ptrb + 1, '"'); - *ptre = 0; - arg_list [i + 4] = (unsigned long long) (ptrb + 1); - ptrb = ptre + 1; - } - arg_list [0] = i + 3; - /* CALLG_64 returns int , fortunately (FILE *) on VMS is a - always a 32bit pointer. */ - return LIB$CALLG_64 (arg_list, &decc$freopen); - } #else return freopen (path, mode, stream); #endif @@ -993,11 +802,7 @@ __gnat_open_read (char *path, int fmode) if (fmode) o_fmode = O_TEXT; -#if defined (VMS) - /* Optional arguments mbc,deq,fop increase read performance. */ - fd = open (path, O_RDONLY | o_fmode, 0444, - "mbc=16", "deq=64", "fop=tef"); -#elif defined (__vxworks) +#if defined (__vxworks) fd = open (path, O_RDONLY | o_fmode, 0444); #elif defined (__MINGW32__) { @@ -1015,15 +820,6 @@ __gnat_open_read (char *path, int fmode) #if defined (__MINGW32__) #define PERM (S_IREAD | S_IWRITE) -#elif defined (VMS) -/* Excerpt from DECC C RTL Reference Manual: - To create files with OpenVMS RMS default protections using the UNIX - system-call functions umask, mkdir, creat, and open, call mkdir, creat, - and open with a file-protection mode argument of 0777 in a program - that never specifically calls umask. These default protections include - correctly establishing protections based on ACLs, previous versions of - files, and so on. */ -#define PERM 0777 #else #define PERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) #endif @@ -1037,10 +833,7 @@ __gnat_open_rw (char *path, int fmode) if (fmode) o_fmode = O_TEXT; -#if defined (VMS) - fd = open (path, O_RDWR | o_fmode, PERM, - "mbc=16", "deq=64", "fop=tef"); -#elif defined (__MINGW32__) +#if defined (__MINGW32__) { TCHAR wpath[GNAT_MAX_PATH_LEN]; @@ -1063,10 +856,7 @@ __gnat_open_create (char *path, int fmode) if (fmode) o_fmode = O_TEXT; -#if defined (VMS) - fd = open (path, O_WRONLY | O_CREAT | O_TRUNC | o_fmode, PERM, - "mbc=16", "deq=64", "fop=tef"); -#elif defined (__MINGW32__) +#if defined (__MINGW32__) { TCHAR wpath[GNAT_MAX_PATH_LEN]; @@ -1084,11 +874,7 @@ int __gnat_create_output_file (char *path) { int fd; -#if defined (VMS) - fd = open (path, O_WRONLY | O_CREAT | O_TRUNC | O_TEXT, PERM, - "rfm=stmlf", "ctx=rec", "rat=none", "rop=nlk", - "shr=del,get,put,upd"); -#elif defined (__MINGW32__) +#if defined (__MINGW32__) { TCHAR wpath[GNAT_MAX_PATH_LEN]; @@ -1106,11 +892,7 @@ int __gnat_create_output_file_new (char *path) { int fd; -#if defined (VMS) - fd = open (path, O_WRONLY | O_CREAT | O_TRUNC | O_TEXT | O_EXCL, PERM, - "rfm=stmlf", "ctx=rec", "rat=none", "rop=nlk", - "shr=del,get,put,upd"); -#elif defined (__MINGW32__) +#if defined (__MINGW32__) { TCHAR wpath[GNAT_MAX_PATH_LEN]; @@ -1133,10 +915,7 @@ __gnat_open_append (char *path, int fmode) if (fmode) o_fmode = O_TEXT; -#if defined (VMS) - fd = open (path, O_WRONLY | O_CREAT | O_APPEND | o_fmode, PERM, - "mbc=16", "deq=64", "fop=tef"); -#elif defined (__MINGW32__) +#if defined (__MINGW32__) { TCHAR wpath[GNAT_MAX_PATH_LEN]; @@ -1161,10 +940,7 @@ __gnat_open_new (char *path, int fmode) if (fmode) o_fmode = O_TEXT; -#if defined (VMS) - fd = open (path, O_WRONLY | O_CREAT | O_EXCL | o_fmode, PERM, - "mbc=16", "deq=64", "fop=tef"); -#elif defined (__MINGW32__) +#if defined (__MINGW32__) { TCHAR wpath[GNAT_MAX_PATH_LEN]; @@ -1178,9 +954,7 @@ __gnat_open_new (char *path, int fmode) return fd < 0 ? -1 : fd; } -/* Open a new temp file. Return error (-1) if the file already exists. - Special options for VMS allow the file to be shared between parent and child - processes, however they really slow down output. Used in gnatchop. */ +/* Open a new temp file. Return error (-1) if the file already exists. */ int __gnat_open_new_temp (char *path, int fmode) @@ -1205,17 +979,7 @@ __gnat_open_new_temp (char *path, int fmode) if (fmode) o_fmode = O_TEXT; -#if defined (VMS) - /* Passing rfm=stmlf for binary files seems questionable since it results - in having an extraneous line feed added after every call to CRTL write, - so pass rfm=udf (aka undefined) instead. */ - fd = open (path, O_WRONLY | O_CREAT | O_EXCL | o_fmode, PERM, - fmode ? "rfm=stmlf" : "rfm=udf", "ctx=rec", "rat=none", - "shr=del,get,put,upd", "mbc=16", "deq=64", "fop=tef"); -#else fd = GNAT_OPEN (path, O_WRONLY | O_CREAT | O_EXCL | o_fmode, PERM); -#endif - return fd < 0 ? -1 : fd; } @@ -1224,9 +988,7 @@ __gnat_open (char *path, int fmode) { int fd; -#if defined (VMS) - fd = open (path, fmode, PERM, "mbc=16", "deq=64", "fop=tef"); -#elif defined (__MINGW32__) +#if defined (__MINGW32__) { TCHAR wpath[GNAT_MAX_PATH_LEN]; @@ -1295,12 +1057,7 @@ __gnat_stat_to_attr (int fd, char* name, struct file_attributes* attr) if (ret != 0) { attr->timestamp = (OS_Time)-1; } else { -#ifdef VMS - /* VMS has file versioning. */ - attr->timestamp = (OS_Time)statbuf.st_ctime; -#else attr->timestamp = (OS_Time)statbuf.st_mtime; -#endif } } @@ -1660,168 +1417,6 @@ __gnat_set_file_time_name (char *name, time_t time_stamp) CloseHandle (h); return; -#elif defined (VMS) - struct FAB fab; - struct NAM nam; - - struct - { - unsigned long long backup, create, expire, revise; - unsigned int uic; - union - { - unsigned short value; - struct - { - unsigned system : 4; - unsigned owner : 4; - unsigned group : 4; - unsigned world : 4; - } bits; - } prot; - } Fat = { 0, 0, 0, 0, 0, { 0 }}; - - ATRDEF atrlst[] - = { - { ATR$S_CREDATE, ATR$C_CREDATE, &Fat.create }, - { ATR$S_REVDATE, ATR$C_REVDATE, &Fat.revise }, - { ATR$S_EXPDATE, ATR$C_EXPDATE, &Fat.expire }, - { ATR$S_BAKDATE, ATR$C_BAKDATE, &Fat.backup }, - { ATR$S_FPRO, ATR$C_FPRO, &Fat.prot }, - { ATR$S_UIC, ATR$C_UIC, &Fat.uic }, - { 0, 0, 0} - }; - - FIBDEF fib; - struct dsc$descriptor_fib fibdsc = {sizeof (fib), (void *) &fib}; - - struct IOSB iosb; - - unsigned long long newtime; - unsigned long long revtime; - long status; - short chan; - - struct vstring file; - struct dsc$descriptor_s filedsc - = {NAM$C_MAXRSS, DSC$K_DTYPE_T, DSC$K_CLASS_S, (void *) file.string}; - struct vstring device; - struct dsc$descriptor_s devicedsc - = {NAM$C_MAXRSS, DSC$K_DTYPE_T, DSC$K_CLASS_S, (void *) device.string}; - struct vstring timev; - struct dsc$descriptor_s timedsc - = {NAM$C_MAXRSS, DSC$K_DTYPE_T, DSC$K_CLASS_S, (void *) timev.string}; - struct vstring result; - struct dsc$descriptor_s resultdsc - = {NAM$C_MAXRSS, DSC$K_DTYPE_VT, DSC$K_CLASS_VS, (void *) result.string}; - - /* Convert parameter name (a file spec) to host file form. Note that this - is needed on VMS to prepare for subsequent calls to VMS RMS library - routines. Note that it would not work to call __gnat_to_host_dir_spec - as was done in a previous version, since this fails silently unless - the feature logical DECC$EFS_CHARSET is enabled, in which case a DNF - (directory not found) condition is signalled. */ - tryfile = (char *) __gnat_to_host_file_spec (name); - - /* Allocate and initialize a FAB and NAM structures. */ - fab = cc$rms_fab; - nam = cc$rms_nam; - - nam.nam$l_esa = file.string; - nam.nam$b_ess = NAM$C_MAXRSS; - nam.nam$l_rsa = result.string; - nam.nam$b_rss = NAM$C_MAXRSS; - fab.fab$l_fna = tryfile; - fab.fab$b_fns = strlen (tryfile); - fab.fab$l_nam = &nam; - - /* Validate filespec syntax and device existence. */ - status = SYS$PARSE (&fab, 0, 0); - if ((status & 1) != 1) - LIB$SIGNAL (status); - - file.string[nam.nam$b_esl] = 0; - - /* Find matching filespec. */ - status = SYS$SEARCH (&fab, 0, 0); - if ((status & 1) != 1) - LIB$SIGNAL (status); - - file.string[nam.nam$b_esl] = 0; - result.string[result.length=nam.nam$b_rsl] = 0; - - /* Get the device name and assign an IO channel. */ - strncpy (device.string, nam.nam$l_dev, nam.nam$b_dev); - devicedsc.dsc$w_length = nam.nam$b_dev; - chan = 0; - status = SYS$ASSIGN (&devicedsc, &chan, 0, 0, 0); - if ((status & 1) != 1) - LIB$SIGNAL (status); - - /* Initialize the FIB and fill in the directory id field. */ - memset (&fib, 0, sizeof (fib)); - fib.fib$w_did[0] = nam.nam$w_did[0]; - fib.fib$w_did[1] = nam.nam$w_did[1]; - fib.fib$w_did[2] = nam.nam$w_did[2]; - fib.fib$l_acctl = 0; - fib.fib$l_wcc = 0; - strcpy (file.string, (strrchr (result.string, ']') + 1)); - filedsc.dsc$w_length = strlen (file.string); - result.string[result.length = 0] = 0; - - /* Open and close the file to fill in the attributes. */ - status - = SYS$QIOW (0, chan, IO$_ACCESS|IO$M_ACCESS, &iosb, 0, 0, - &fibdsc, &filedsc, &result.length, &resultdsc, &atrlst, 0); - if ((status & 1) != 1) - LIB$SIGNAL (status); - if ((iosb.status & 1) != 1) - LIB$SIGNAL (iosb.status); - - result.string[result.length] = 0; - status = SYS$QIOW (0, chan, IO$_DEACCESS, &iosb, 0, 0, &fibdsc, 0, 0, 0, - &atrlst, 0); - if ((status & 1) != 1) - LIB$SIGNAL (status); - if ((iosb.status & 1) != 1) - LIB$SIGNAL (iosb.status); - - { - time_t t; - - /* Set creation time to requested time. */ - unix_time_to_vms (time_stamp, newtime); - - t = time ((time_t) 0); - - /* Set revision time to now in local time. */ - unix_time_to_vms (t, revtime); - } - - /* Reopen the file, modify the times and then close. */ - fib.fib$l_acctl = FIB$M_WRITE; - status - = SYS$QIOW (0, chan, IO$_ACCESS|IO$M_ACCESS, &iosb, 0, 0, - &fibdsc, &filedsc, &result.length, &resultdsc, &atrlst, 0); - if ((status & 1) != 1) - LIB$SIGNAL (status); - if ((iosb.status & 1) != 1) - LIB$SIGNAL (iosb.status); - - Fat.create = newtime; - Fat.revise = revtime; - - status = SYS$QIOW (0, chan, IO$_DEACCESS, &iosb, 0, 0, - &fibdsc, 0, 0, 0, &atrlst, 0); - if ((status & 1) != 1) - LIB$SIGNAL (status); - if ((iosb.status & 1) != 1) - LIB$SIGNAL (iosb.status); - - /* Deassign the channel and exit. */ - status = SYS$DASSGN (chan); - if ((status & 1) != 1) - LIB$SIGNAL (status); #else struct utimbuf utimbuf; time_t t; @@ -2605,11 +2200,7 @@ __gnat_portable_spawn (char *args[] ATTRIBUTE_UNUSED) { /* The child. */ if (execv (args[0], MAYBE_TO_PTR32 (args)) != 0) -#if defined (VMS) - return -1; /* execv is in parent context on VMS. */ -#else _exit (1); -#endif } /* The parent. */ @@ -2683,15 +2274,6 @@ __gnat_number_of_cpus (void) GetSystemInfo (&sysinfo); cores = (int) sysinfo.dwNumberOfProcessors; -#elif defined (VMS) - int code = SYI$_ACTIVECPU_CNT; - unsigned int res; - int status; - - status = LIB$GETSYI (&code, &res); - if ((status & 1) != 0) - cores = res; - #elif defined (_WRS_CONFIG_SMP) unsigned int vxCpuConfiguredGet (void); @@ -2934,11 +2516,7 @@ __gnat_portable_no_block_spawn (char *args[] ATTRIBUTE_UNUSED) { /* The child. */ if (execv (args[0], MAYBE_TO_PTR32 (args)) != 0) -#if defined (VMS) - return -1; /* execv is in parent context on VMS. */ -#else _exit (1); -#endif } return pid; @@ -3155,12 +2733,8 @@ __gnat_locate_exec_on_path (char *exec_name) return __gnat_locate_exec (exec_name, apath_val); #else - -#ifdef VMS - char *path_val = "/VAXC$PATH"; -#else char *path_val = getenv ("PATH"); -#endif + if (path_val == NULL) return NULL; apath_val = (char *) alloca (strlen (path_val) + 1); strcpy (apath_val, path_val); @@ -3168,492 +2742,8 @@ __gnat_locate_exec_on_path (char *exec_name) #endif } -#ifdef VMS - -/* These functions are used to translate to and from VMS and Unix syntax - file, directory and path specifications. */ - -#define MAXPATH 256 -#define MAXNAMES 256 -#define NEW_CANONICAL_FILELIST_INCREMENT 64 - -static char new_canonical_dirspec [MAXPATH]; -static char new_canonical_filespec [MAXPATH]; -static char new_canonical_pathspec [MAXNAMES*MAXPATH]; -static unsigned new_canonical_filelist_index; -static unsigned new_canonical_filelist_in_use; -static unsigned new_canonical_filelist_allocated; -static char **new_canonical_filelist; -static char new_host_pathspec [MAXNAMES*MAXPATH]; -static char new_host_dirspec [MAXPATH]; -static char new_host_filespec [MAXPATH]; - -/* Routine is called repeatedly by decc$from_vms via - __gnat_to_canonical_file_list_init until it returns 0 or the expansion - runs out. */ - -static int -wildcard_translate_unix (char *name) -{ - char *ver; - char buff [MAXPATH]; - - strncpy (buff, name, MAXPATH); - buff [MAXPATH - 1] = (char) 0; - ver = strrchr (buff, '.'); - - /* Chop off the version. */ - if (ver) - *ver = 0; - - /* Dynamically extend the allocation by the increment. */ - if (new_canonical_filelist_in_use == new_canonical_filelist_allocated) - { - new_canonical_filelist_allocated += NEW_CANONICAL_FILELIST_INCREMENT; - new_canonical_filelist = (char **) xrealloc - (new_canonical_filelist, - new_canonical_filelist_allocated * sizeof (char *)); - } - - new_canonical_filelist[new_canonical_filelist_in_use++] = xstrdup (buff); - - return 1; -} - -/* Translate a wildcard VMS file spec into a list of Unix file specs. First do - full translation and copy the results into a list (_init), then return them - one at a time (_next). If onlydirs set, only expand directory files. */ - -int -__gnat_to_canonical_file_list_init (char *filespec, int onlydirs) -{ - int len; - char buff [MAXPATH]; - - len = strlen (filespec); - strncpy (buff, filespec, MAXPATH); - - /* Only look for directories */ - if (onlydirs && !strstr (&buff [len-5], "*.dir")) - strncat (buff, "*.dir", MAXPATH); - - buff [MAXPATH - 1] = (char) 0; - - decc$from_vms (buff, wildcard_translate_unix, 1); - - /* Remove the .dir extension. */ - if (onlydirs) - { - int i; - char *ext; - - for (i = 0; i < new_canonical_filelist_in_use; i++) - { - ext = strstr (new_canonical_filelist[i], ".dir"); - if (ext) - *ext = 0; - } - } - - return new_canonical_filelist_in_use; -} - -/* Return the next filespec in the list. */ - -char * -__gnat_to_canonical_file_list_next (void) -{ - return new_canonical_filelist[new_canonical_filelist_index++]; -} - -/* Free storage used in the wildcard expansion. */ - -void -__gnat_to_canonical_file_list_free (void) -{ - int i; - - for (i = 0; i < new_canonical_filelist_in_use; i++) - free (new_canonical_filelist[i]); - - free (new_canonical_filelist); - - new_canonical_filelist_in_use = 0; - new_canonical_filelist_allocated = 0; - new_canonical_filelist_index = 0; - new_canonical_filelist = 0; -} - -/* The functional equivalent of decc$translate_vms routine. - Designed to produce the same output, but is protected against - malformed paths (original version ACCVIOs in this case) and - does not require VMS-specific DECC RTL. */ - -#define NAM$C_MAXRSS 1024 - -char * -__gnat_translate_vms (char *src) -{ - static char retbuf [NAM$C_MAXRSS + 1]; - char *srcendpos, *pos1, *pos2, *retpos; - int disp, path_present = 0; - - if (!src) - return NULL; - - srcendpos = strchr (src, '\0'); - retpos = retbuf; - - /* Look for the node and/or device in front of the path. */ - pos1 = src; - pos2 = strchr (pos1, ':'); - - if (pos2 && (pos2 < srcendpos) && (*(pos2 + 1) == ':')) - { - /* There is a node name. "node_name::" becomes "node_name!". */ - disp = pos2 - pos1; - strncpy (retbuf, pos1, disp); - retpos [disp] = '!'; - retpos = retpos + disp + 1; - pos1 = pos2 + 2; - pos2 = strchr (pos1, ':'); - } - - if (pos2) - { - /* There is a device name. "dev_name:" becomes "/dev_name/". */ - *(retpos++) = '/'; - disp = pos2 - pos1; - strncpy (retpos, pos1, disp); - retpos = retpos + disp; - pos1 = pos2 + 1; - *(retpos++) = '/'; - } - else - /* No explicit device; we must look ahead and prepend /sys$disk/ if - the path is absolute. */ - if ((*pos1 == '[' || *pos1 == '<') && (pos1 < srcendpos) - && !strchr (".-]>", *(pos1 + 1))) - { - strncpy (retpos, "/sys$disk/", 10); - retpos += 10; - } - - /* Process the path part. */ - while (*pos1 == '[' || *pos1 == '<') - { - path_present++; - pos1++; - if (*pos1 == ']' || *pos1 == '>') - { - /* Special case, [] translates to '.'. */ - *(retpos++) = '.'; - pos1++; - } - else - { - /* '[000000' means root dir. It can be present in the middle of - the path due to expansion of logical devices, in which case - we skip it. */ - if (!strncmp (pos1, "000000", 6) && path_present > 1 && - (*(pos1 + 6) == ']' || *(pos1 + 6) == '>' || *(pos1 + 6) == '.')) - { - pos1 += 6; - if (*pos1 == '.') pos1++; - } - else if (*pos1 == '.') - { - /* Relative path. */ - *(retpos++) = '.'; - } - - /* There is a qualified path. */ - while (*pos1 && *pos1 != ']' && *pos1 != '>') - { - switch (*pos1) - { - case '.': - /* '.' is used to separate directories. Replace it with '/' - but only if there isn't already '/' just before. */ - if (*(retpos - 1) != '/') - *(retpos++) = '/'; - pos1++; - if (pos1 + 1 < srcendpos - && *pos1 == '.' - && *(pos1 + 1) == '.') - { - /* Ellipsis refers to entire subtree; replace - with '**'. */ - *(retpos++) = '*'; - *(retpos++) = '*'; - *(retpos++) = '/'; - pos1 += 2; - } - break; - case '-' : - /* When after '.' '[' '<' is equivalent to Unix ".." but - there may be several in a row. */ - if (*(pos1 - 1) == '.' || *(pos1 - 1) == '[' || - *(pos1 - 1) == '<') - { - while (*pos1 == '-') - { - pos1++; - *(retpos++) = '.'; - *(retpos++) = '.'; - *(retpos++) = '/'; - } - retpos--; - break; - } - /* Otherwise fall through to default. */ - default: - *(retpos++) = *(pos1++); - } - } - pos1++; - } - } - - if (pos1 < srcendpos) - { - /* Now add the actual file name, until the version suffix if any */ - if (path_present) - *(retpos++) = '/'; - pos2 = strchr (pos1, ';'); - disp = pos2? (pos2 - pos1) : (srcendpos - pos1); - strncpy (retpos, pos1, disp); - retpos += disp; - if (pos2 && pos2 < srcendpos) - { - /* There is a non-empty version suffix. ";<ver>" becomes ".<ver>" */ - *retpos++ = '.'; - disp = srcendpos - pos2 - 1; - strncpy (retpos, pos2 + 1, disp); - retpos += disp; - } - } - - *retpos = '\0'; - - return retbuf; -} - -/* Translate a VMS syntax directory specification in to Unix syntax. If - PREFIXFLAG is set, append an underscore "/". If no indicators of VMS syntax - found, return input string. Also translate a dirname that contains no - slashes, in case it's a logical name. */ - -char * -__gnat_to_canonical_dir_spec (char *dirspec, int prefixflag) -{ - int len; - - strcpy (new_canonical_dirspec, ""); - if (strlen (dirspec)) - { - char *dirspec1; - - if (strchr (dirspec, ']') || strchr (dirspec, ':')) - { - strncpy (new_canonical_dirspec, - __gnat_translate_vms (dirspec), - MAXPATH); - } - else if (!strchr (dirspec, '/') && (dirspec1 = getenv (dirspec)) != 0) - { - strncpy (new_canonical_dirspec, - __gnat_translate_vms (dirspec1), - MAXPATH); - } - else - { - strncpy (new_canonical_dirspec, dirspec, MAXPATH); - } - } - - len = strlen (new_canonical_dirspec); - if (prefixflag && new_canonical_dirspec [len-1] != '/') - strncat (new_canonical_dirspec, "/", MAXPATH); - - new_canonical_dirspec [MAXPATH - 1] = (char) 0; - - return new_canonical_dirspec; - -} - -/* Translate a VMS syntax file specification into Unix syntax. - If no indicators of VMS syntax found, check if it's an uppercase - alphanumeric_ name and if so try it out as an environment - variable (logical name). If all else fails return the - input string. */ - -char * -__gnat_to_canonical_file_spec (char *filespec) -{ - char *filespec1; - - strncpy (new_canonical_filespec, "", MAXPATH); - - if (strchr (filespec, ']') || strchr (filespec, ':')) - { - char *tspec = (char *) __gnat_translate_vms (filespec); - - if (tspec != (char *) -1) - strncpy (new_canonical_filespec, tspec, MAXPATH); - } - else if ((strlen (filespec) == strspn (filespec, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_")) - && (filespec1 = getenv (filespec))) - { - char *tspec = (char *) __gnat_translate_vms (filespec1); - - if (tspec != (char *) -1) - strncpy (new_canonical_filespec, tspec, MAXPATH); - } - else - { - strncpy (new_canonical_filespec, filespec, MAXPATH); - } - - new_canonical_filespec [MAXPATH - 1] = (char) 0; - - return new_canonical_filespec; -} - -/* Translate a VMS syntax path specification into Unix syntax. - If no indicators of VMS syntax found, return input string. */ - -char * -__gnat_to_canonical_path_spec (char *pathspec) -{ - char *curr, *next, buff [MAXPATH]; - - if (pathspec == 0) - return pathspec; - - /* If there are /'s, assume it's a Unix path spec and return. */ - if (strchr (pathspec, '/')) - return pathspec; - - new_canonical_pathspec[0] = 0; - curr = pathspec; - - for (;;) - { - next = strchr (curr, ','); - if (next == 0) - next = strchr (curr, 0); - - strncpy (buff, curr, next - curr); - buff[next - curr] = 0; - - /* Check for wildcards and expand if present. */ - if (strchr (buff, '*') || strchr (buff, '%') || strstr (buff, "...")) - { - int i, dirs; - - dirs = __gnat_to_canonical_file_list_init (buff, 1); - for (i = 0; i < dirs; i++) - { - char *next_dir; - - next_dir = __gnat_to_canonical_file_list_next (); - strncat (new_canonical_pathspec, next_dir, MAXPATH); - - /* Don't append the separator after the last expansion. */ - if (i+1 < dirs) - strncat (new_canonical_pathspec, ":", MAXPATH); - } - - __gnat_to_canonical_file_list_free (); - } - else - strncat (new_canonical_pathspec, - __gnat_to_canonical_dir_spec (buff, 0), MAXPATH); - - if (*next == 0) - break; - - strncat (new_canonical_pathspec, ":", MAXPATH); - curr = next + 1; - } - - new_canonical_pathspec [MAXPATH - 1] = (char) 0; - - return new_canonical_pathspec; -} - -static char filename_buff [MAXPATH]; - -static int -translate_unix (char *name, int type ATTRIBUTE_UNUSED) -{ - strncpy (filename_buff, name, MAXPATH); - filename_buff [MAXPATH - 1] = (char) 0; - return 0; -} - -/* Translate a Unix syntax directory specification into VMS syntax. The - PREFIXFLAG has no effect, but is kept for symmetry with - to_canonical_dir_spec. If indicators of VMS syntax found, return input - string. */ - -char * -__gnat_to_host_dir_spec (char *dirspec, int prefixflag ATTRIBUTE_UNUSED) -{ - int len = strlen (dirspec); - - strncpy (new_host_dirspec, dirspec, MAXPATH); - new_host_dirspec [MAXPATH - 1] = (char) 0; - - if (strchr (new_host_dirspec, ']') || strchr (new_host_dirspec, ':')) - return new_host_dirspec; - - while (len > 1 && new_host_dirspec[len - 1] == '/') - { - new_host_dirspec[len - 1] = 0; - len--; - } - - decc$to_vms (new_host_dirspec, translate_unix, 1, 2); - strncpy (new_host_dirspec, filename_buff, MAXPATH); - new_host_dirspec [MAXPATH - 1] = (char) 0; - - return new_host_dirspec; -} - -/* Translate a Unix syntax file specification into VMS syntax. - If indicators of VMS syntax found, return input string. */ - -char * -__gnat_to_host_file_spec (char *filespec) -{ - strncpy (new_host_filespec, "", MAXPATH); - if (strchr (filespec, ']') || strchr (filespec, ':')) - { - strncpy (new_host_filespec, filespec, MAXPATH); - } - else - { - decc$to_vms (filespec, translate_unix, 1, 1); - strncpy (new_host_filespec, filename_buff, MAXPATH); - } - - new_host_filespec [MAXPATH - 1] = (char) 0; - - return new_host_filespec; -} - -void -__gnat_adjust_os_resource_limits (void) -{ - SYS$ADJWSL (131072, 0); -} - -#else /* VMS */ - -/* Dummy functions for Osint import for non-VMS systems. */ +/* Dummy functions for Osint import for non-VMS systems. + ??? To be removed. */ int __gnat_to_canonical_file_list_init (char *dirspec ATTRIBUTE_UNUSED, @@ -3709,8 +2799,6 @@ __gnat_adjust_os_resource_limits (void) { } -#endif - #if defined (__mips_vxworks) int _flush_cache (void) @@ -3719,35 +2807,6 @@ _flush_cache (void) } #endif -#if defined (IS_CROSS) \ - || (! ((defined (sparc) || defined (i386)) && defined (sun) \ - && defined (__SVR4)) \ - && ! (defined (linux) && (defined (i386) || defined (__x86_64__))) \ - && ! (defined (linux) && defined (__ia64__)) \ - && ! (defined (linux) && defined (powerpc)) \ - && ! defined (__FreeBSD__) \ - && ! defined (__Lynx__) \ - && ! defined (__hpux__) \ - && ! defined (__APPLE__) \ - && ! defined (_AIX) \ - && ! defined (VMS) \ - && ! defined (__MINGW32__)) - -/* Dummy function to satisfy g-trasym.o. See the preprocessor conditional - just above for a list of native platforms that provide a non-dummy - version of this procedure in libaddr2line.a. */ - -void -convert_addresses (const char *file_name ATTRIBUTE_UNUSED, - void *addrs ATTRIBUTE_UNUSED, - int n_addr ATTRIBUTE_UNUSED, - void *buf ATTRIBUTE_UNUSED, - int *len ATTRIBUTE_UNUSED) -{ - *len = 0; -} -#endif - #if defined (_WIN32) int __gnat_argument_needs_quote = 1; #else @@ -3788,7 +2847,7 @@ int __gnat_copy_attribs (char *from ATTRIBUTE_UNUSED, char *to ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { -#if defined (VMS) || (defined (__vxworks) && _WRS_VXWORKS_MAJOR < 6) || \ +#if (defined (__vxworks) && _WRS_VXWORKS_MAJOR < 6) || \ defined (__nucleus__) return -1; @@ -3931,11 +2990,7 @@ __gnat_set_close_on_exec (int fd ATTRIBUTE_UNUSED, int __gnat_binder_supports_auto_init (void) { -#ifdef VMS - return 0; -#else - return 1; -#endif + return 1; } /* Indicates that Stand-Alone Libraries are automatically initialized through @@ -3943,7 +2998,7 @@ __gnat_binder_supports_auto_init (void) int __gnat_sals_init_using_constructors (void) { -#if defined (__vxworks) || defined (__Lynx__) || defined (VMS) +#if defined (__vxworks) || defined (__Lynx__) return 0; #else return 1; |