This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Eek. #25783 broke all pre-v8.2 VMS builds. Undo all the bits
[perl5.git] / vms / vmsish.h
index 8d2a628..69b4bf1 100644 (file)
@@ -2,8 +2,12 @@
  *
  * VMS-specific C header file for perl5.
  *
- * Last revised: 16-Sep-1998 by Charles Bailey  bailey@newman.upenn.edu
+ * revised: 16-Sep-1998 by Charles Bailey  bailey@newman.upenn.edu
  * Version: 5.5.2
+ *
+ * Last revised: 10-Oct-2005 by John Malmberg (HP OpenVMS) wb8twy@qsl.net
+ *                          Add SYMLINK support, and updated Craig Berry's
+ *                          largefile support.
  */
 
 #ifndef __vmsish_h_included
  * ADDRCONSTEXT,NEEDCONSTEXT: initialization of data with non-constant values
  *                            (e.g. pointer fields of descriptors)
  */
-#ifdef __DECC
-#  pragma message disable (ADDRCONSTEXT,NEEDCONSTEXT)
-#endif
-#ifdef __DECCXX 
+#if defined(__DECC) || defined(__DECCXX)
 #  pragma message disable (ADDRCONSTEXT,NEEDCONSTEXT)
 #endif
 
 #include <unixio.h>
 #include <unixlib.h>
 #include <file.h>  /* it's not <sys/file.h>, so don't use I_SYS_FILE */
-#if defined(__DECC) && defined(__DECC_VER) && __DECC_VER > 20000000
-#  include <unistd.h> /* DECC has this; VAXC and gcc don't */
-#endif
-#ifdef __DECCXX 
-#  include <unistd.h> /* DECC has this; VAXC and gcc don't */
-#endif
-
-/* VAXC doesn't have a unary plus operator, so we need to get there indirectly */
-#if defined(VAXC) && !defined(__DECC)
-#  define NO_UNARY_PLUS
+#if (defined(__DECC) && defined(__DECC_VER) && __DECC_VER > 20000000) || defined(__DECCXX)
+#  include <unistd.h> /* DECC has this; gcc doesn't */
 #endif
 
 #ifdef NO_PERL_TYPEDEFS /* a2p; we don't want Perl's special routines */
 #define HAS_GETENV_SV
 #define HAS_GETENV_LEN
 
+/* All this stiff is for the x2P programs. Hopefully they'll still work */
+#if defined(PERL_FOR_X2P)
+#ifndef aTHX_
+#define aTHX_
+#endif
+#ifndef pTHX_
+#define pTHX_
+#endif
+#ifndef pTHX
+#define pTHX
+#endif
+#endif
+
 #ifndef DONT_MASK_RTL_CALLS
 #  ifdef getenv
 #    undef getenv
 #  endif
   /* getenv used for regular logical names */
-#  define getenv(v) my_getenv(v,TRUE)
+#  define getenv(v) Perl_my_getenv(aTHX_ v,TRUE)
 #endif
 #ifdef getenv_len
 #  undef getenv_len
 #endif
-#define getenv_len(v,l) my_getenv_len(v,l,TRUE)
+#define getenv_len(v,l) Perl_my_getenv_len(aTHX_ v,l,TRUE)
 
 /* DECC introduces this routine in the RTL as of VMS 7.0; for now,
  * we'll use ours, since it gives us the full VMS exit status. */
 #define DONT_DECLARE_STD 1
 
 /* Our own contribution to PerlShr's global symbols . . . */
-#define my_getenv_len          Perl_my_getenv_len
 #define prime_env_iter Perl_prime_env_iter
-#define vmssetenv              Perl_vmssetenv
+#define vms_image_init Perl_vms_image_init
+#define my_tmpfile             Perl_my_tmpfile
+#define vmstrnenv              Perl_vmstrnenv            
 #if !defined(PERL_IMPLICIT_CONTEXT)
+#define my_getenv_len          Perl_my_getenv_len
+#define vmssetenv              Perl_vmssetenv
 #define my_trnlnm              Perl_my_trnlnm
-#define vmstrnenv              Perl_vmstrnenv            
 #define my_setenv              Perl_my_setenv
 #define my_getenv              Perl_my_getenv
 #define tounixspec             Perl_tounixspec
 #define trim_unixpath          Perl_trim_unixpath
 #define opendir                        Perl_opendir
 #define rmscopy                        Perl_rmscopy
+#define my_mkdir               Perl_my_mkdir
+#define vms_do_aexec           Perl_vms_do_aexec
+#define vms_do_exec            Perl_vms_do_exec
+#define my_waitpid             Perl_my_waitpid
+#define my_crypt               Perl_my_crypt
+#define kill_file              Perl_kill_file
+#define my_utime               Perl_my_utime
+#define my_chdir               Perl_my_chdir
+#define do_aspawn              Perl_do_aspawn
+#define seekdir                        Perl_seekdir
+#define my_gmtime              Perl_my_gmtime
+#define my_localtime           Perl_my_localtime
+#define my_time                        Perl_my_time
+#define do_spawn               Perl_do_spawn
+#define flex_fstat             Perl_flex_fstat
+#define flex_stat              Perl_flex_stat
+#define flex_lstat             Perl_flex_lstat
+#define cando_by_name          Perl_cando_by_name
+#define my_getpwnam            Perl_my_getpwnam
+#define my_getpwuid            Perl_my_getpwuid
+#define my_flush               Perl_my_flush
+#define readdir                        Perl_readdir
+#define readdir_r              Perl_readdir_r
 #else
+#define my_getenv_len(a,b,c)   Perl_my_getenv_len(aTHX_ a,b,c)
+#define vmssetenv(a,b,c)       Perl_vmssetenv(aTHX_ a,b,c)
 #define my_trnlnm(a,b,c)       Perl_my_trnlnm(aTHX_ a,b,c)
-#define vmstrnenv(a,b,c,d,e)   Perl_vmstrnenv(aTHX_ a,b,c,d,e)
 #define my_setenv(a,b)         Perl_my_setenv(aTHX_ a,b)
 #define my_getenv(a,b)         Perl_my_getenv(aTHX_ a,b)
 #define tounixspec(a,b)                Perl_tounixspec(aTHX_ a,b)
 #define trim_unixpath(a,b,c)   Perl_trim_unixpath(aTHX_ a,b,c)
 #define opendir(a)             Perl_opendir(aTHX_ a)
 #define rmscopy(a,b,c)         Perl_rmscopy(aTHX_ a,b,c)
+#define my_mkdir(a,b)          Perl_my_mkdir(aTHX_ a,b)
+#define vms_do_aexec(a,b,c)    Perl_vms_do_aexec(aTHX_ a,b,c)
+#define vms_do_exec(a)         Perl_vms_do_exec(aTHX_ a)
+#define my_waitpid(a,b,c)      Perl_my_waitpid(aTHX_ a,b,c)
+#define my_crypt(a,b)          Perl_my_crypt(aTHX_ a,b)
+#define kill_file(a)           Perl_kill_file(aTHX_ a)
+#define my_utime(a,b)          Perl_my_utime(aTHX_ a,b)
+#define my_chdir(a)            Perl_my_chdir(aTHX_ a)
+#define do_aspawn(a,b,c)       Perl_do_aspawn(aTHX_ a,b,c)
+#define seekdir(a,b)           Perl_seekdir(aTHX_ a,b)
+#define my_gmtime(a)           Perl_my_gmtime(aTHX_ a)
+#define my_localtime(a)                Perl_my_localtime(aTHX_ a)
+#define my_time(a)             Perl_my_time(aTHX_ a)
+#define do_spawn(a)            Perl_do_spawn(aTHX_ a)
+#define flex_fstat(a,b)                Perl_flex_fstat(aTHX_ a,b)
+#define cando_by_name(a,b,c)   Perl_cando_by_name(aTHX_ a,b,c)
+#define flex_stat(a,b)         Perl_flex_stat(aTHX_ a,b)
+#define my_getpwnam(a)         Perl_my_getpwnam(aTHX_ a)
+#define my_getpwuid(a)         Perl_my_getpwuid(aTHX_ a)
+#define my_flush(a)            Perl_my_flush(aTHX_ a)
+#define readdir(a)             Perl_readdir(aTHX_ a)
+#define readdir_r(a,b,c)       Perl_readdir_r(aTHX_ a,b,c)
 #endif
-#define my_crypt               Perl_my_crypt
-#define my_waitpid             Perl_my_waitpid
 #define my_gconvert            Perl_my_gconvert
-#define kill_file              Perl_kill_file
-#define my_mkdir               Perl_my_mkdir
-#define my_chdir               Perl_my_chdir
-#define my_tmpfile             Perl_my_tmpfile
-#define my_utime               Perl_my_utime
-#define vms_image_init Perl_vms_image_init
-#define readdir                Perl_readdir
-#define telldir                Perl_telldir
-#define seekdir                Perl_seekdir
+#define telldir                        Perl_telldir
 #define closedir               Perl_closedir
 #define vmsreaddirversions     Perl_vmsreaddirversions
-#define my_gmtime              Perl_my_gmtime
-#define my_localtime           Perl_my_localtime
-#define my_time                Perl_my_time
 #define my_sigemptyset        Perl_my_sigemptyset
 #define my_sigfillset         Perl_my_sigfillset
 #define my_sigaddset          Perl_my_sigaddset
 #define my_sigdelset          Perl_my_sigdelset
 #define my_sigismember        Perl_my_sigismember
 #define my_sigprocmask        Perl_my_sigprocmask
-#define cando_by_name          Perl_cando_by_name
-#define flex_fstat             Perl_flex_fstat
-#define flex_stat              Perl_flex_stat
 #define my_vfork               Perl_my_vfork
-#define vms_do_aexec           Perl_vms_do_aexec
-#define vms_do_exec            Perl_vms_do_exec
-#define do_aspawn              Perl_do_aspawn
-#define do_spawn               Perl_do_spawn
+#define my_fdopen               Perl_my_fdopen
+#define my_fclose               Perl_my_fclose
 #define my_fwrite              Perl_my_fwrite
-#define my_flush               Perl_my_flush
-#define my_getpwnam            Perl_my_getpwnam
-#define my_getpwuid            Perl_my_getpwuid
-#define my_getpwent            Perl_my_getpwent
-#define my_endpwent            Perl_my_endpwent
+#define my_getpwent()          Perl_my_getpwent(aTHX)
+#define my_endpwent()          Perl_my_endpwent(aTHX)
 #define my_getlogin            Perl_my_getlogin
-#define init_os_extras Perl_init_os_extras
+#define init_os_extras         Perl_init_os_extras
+#define vms_realpath(a, b)     Perl_vms_realpath(aTHX_ a,b)
+#define vms_case_tolerant(a)   Perl_vms_case_tolerant(a)
 
 /* Delete if at all possible, changing protections if necessary. */
 #define unlink kill_file
  * from a specific directory to permit creation of files).
  */
 #ifndef DONT_MASK_RTL_CALLS
-#  define tmpfile my_tmpfile
+#  define tmpfile Perl_my_tmpfile
 #endif
 
 
 #define COMPLEX_STATUS 1       /* We track both "POSIX" and VMS values */
 
 #define HINT_V_VMSISH          24
-#define HINT_M_VMSISH_HUSHED   0x20000000 /* stifle error msgs on exit */
 #define HINT_M_VMSISH_STATUS   0x40000000 /* system, $? return VMS status */
 #define HINT_M_VMSISH_TIME     0x80000000 /* times are local, not UTC */
 #define NATIVE_HINTS           (PL_hints >> HINT_V_VMSISH)  /* used in op.c */
 
 #define TEST_VMSISH(h) (PL_curcop->op_private & ((h) >> HINT_V_VMSISH))
-#define VMSISH_HUSHED  TEST_VMSISH(HINT_M_VMSISH_HUSHED)
 #define VMSISH_STATUS  TEST_VMSISH(HINT_M_VMSISH_STATUS)
 #define VMSISH_TIME    TEST_VMSISH(HINT_M_VMSISH_TIME)
 
+/* VMS-specific data storage */
+
+#define HAVE_INTERP_INTERN
+struct interp_intern {
+    int    hushed;
+    int           posix_exit;
+    double inv_rand_max;
+};
+#define VMSISH_HUSHED     (PL_sys_intern.hushed)
+#define MY_INV_RAND_MAX   (PL_sys_intern.inv_rand_max)
+#define MY_POSIX_EXIT  (PL_sys_intern.posix_exit)
+
 /* Flags for vmstrnenv() */
 #define PERL__TRNENV_SECURE 0x01
+#define PERL__TRNENV_JOIN_SEARCHLIST 0x02
 
 /* Handy way to vet calls to VMS system services and RTL routines. */
 #define _ckvmssts(call) STMT_START { register unsigned long int __ckvms_sts; \
 #define _ckvmssts_noperl(call) STMT_START { register unsigned long int __ckvms_sts; \
   if (!((__ckvms_sts=(call))&1)) { \
   set_errno(EVMSERR); set_vaxc_errno(__ckvms_sts); \
-  fprintf(Perl_debug_log,"Fatal VMS error (status=%d) at %s, line %d", \
+  fprintf(stderr,"Fatal VMS error (status=%d) at %s, line %d", \
   __ckvms_sts,__FILE__,__LINE__); lib$signal(__ckvms_sts); } } STMT_END
 
 #ifdef VMS_DO_SOCKETS
 #define PERL_SOCK_SYSWRITE_IS_SEND
 #endif
 
+#if __CRTL_VER < 70000000
 #define BIT_BUCKET "_NLA0:"
-#define PERL_SYS_INIT(c,v)     vms_image_init((c),(v)); MALLOC_INIT
+#else
+#define BIT_BUCKET "/dev/null"
+#endif
+#define PERL_SYS_INIT(c,v)     MALLOC_CHECK_TAINT2(*c,*v) vms_image_init((c),(v)); MALLOC_INIT
 #define PERL_SYS_TERM()                OP_REFCNT_TERM; MALLOC_TERM
 #define dXSUB_SYS
 #define HAS_KILL
  *     This symbol, if defined, indicates that the program is running under
  *     VMS.  It's a symbol automagically defined by all VMS C compilers I've seen.
  * Just in case, however . . . */
+/* Note that code really should be using __VMS to comply with ANSI */
 #ifndef VMS
 #define VMS            /**/
 #endif
  *     This symbol, if defined, indicates that the ioctl() routine is
  *     available to set I/O characteristics
  */
+#if defined(__CRTL_VER) && __CRTL_VER >= 70000000
+#define        HAS_IOCTL               /**/
+#else
 #undef HAS_IOCTL               /**/
+#endif
  
 /* HAS_UTIME:
  *     This symbol, if defined, indicates that the routine utime() is
 *      This symbol is defined if this system has a stat structure declaring
 *      st_rdev
 *      VMS: Field exists in POSIXish version of struct stat(), but is not used.
+*
+*  No definition of what value an operating system or file system should
+*  put in the st_rdev field has been found by me so far.  Examination of
+*  LINUX source code indicates that the value is both very platform and
+*  file system specific, with many filesystems just putting 1 or 0 in it.
+*  J. Malmberg.
 */
 #undef USE_STAT_RDEV           /**/
 
  */
 #define fwrite1 my_fwrite
 
+
+#ifndef DONT_MASK_RTL_CALLS
+#  define fwrite my_fwrite     /* for PerlSIO_fwrite */
+#  define fdopen my_fdopen
+#  define fclose my_fclose
+#endif
+
+
 /* By default, flush data all the way to disk, not just to RMS buffers */
 #define Fflush(fp) my_flush(fp)
 
 /* Use our own rmdir() */
+#ifndef DONT_MASK_RTL_CALLS
 #define rmdir(name) do_rmdir(name)
+#endif
 
 /* Assorted fiddling with sigs . . . */
 # include <signal.h>
 #define ABORT() abort()
-    /* VAXC's signal.h doesn't #define SIG_ERR, but provides BADSIG instead. */
-#if !defined(SIG_ERR) && defined(BADSIG)
-#  define SIG_ERR BADSIG
-#endif
-
 
 /* Used with our my_utime() routine in vms.c */
 struct utimbuf {
@@ -463,7 +529,19 @@ struct utimbuf {
 #  define sa_mask sv_mask
 #  define sigsuspend(set) sigpause(*set)
 #  define sigpending(a) (not_here("sigpending"),0)
+#else
+/*
+ * The C RTL's sigaction fails to check for invalid signal numbers so we 
+ * help it out a bit.
+ */
+#  ifndef DONT_MASK_RTL_CALLS
+#    define sigaction(a,b,c) Perl_my_sigaction(aTHX_ a,b,c)
+#  endif
 #endif
+#ifdef KILL_BY_SIGPRC
+#  define kill  Perl_my_kill
+#endif
+
 
 /* VMS doesn't use a real sys_nerr, but we need this when scanning for error
  * messages in text strings . . .
@@ -473,7 +551,6 @@ struct utimbuf {
 
 /* Look up new %ENV values on the fly */
 #define DYNAMIC_ENV_FETCH 1
-#define ENV_HV_NAME "%EnV%VmS%"
   /* Special getenv function for retrieving %ENV elements. */
 #define ENVgetenv(v) my_getenv(v,FALSE)
 #define ENVgetenv_len(v,l) my_getenv_len(v,l,FALSE)
@@ -482,26 +559,31 @@ struct utimbuf {
 /* Thin jacket around cuserid() to match Unix' calling sequence */
 #define getlogin my_getlogin
 
-/* Ditto for sys$hash_passwrod() . . . */
-#define crypt  my_crypt
+/* Ditto for sys$hash_password() . . . */
+#define crypt(a,b)  Perl_my_crypt(aTHX_ a,b)
 
 /* Tweak arg to mkdir & chdir first, so we can tolerate trailing /. */
-#define Mkdir(dir,mode) my_mkdir((dir),(mode))
+#define Mkdir(dir,mode) Perl_my_mkdir(aTHX_ (dir),(mode))
 #define Chdir(dir) my_chdir((dir))
 
 /* Use our own stat() clones, which handle Unix-style directory names */
 #define Stat(name,bufptr) flex_stat(name,bufptr)
-#define Fstat(fd,bufptr) flex_fstat(fd,bufptr)
+#define Fstat(fd,bufptr) Perl_flex_fstat(aTHX_ fd,bufptr)
+#ifndef DONT_MASK_RTL_CALLS
+#define lstat(name, bufptr) Perl_flex_lstat(name, bufptr)
+#endif
 
 /* Setup for the dirent routines:
  * opendir(), closedir(), readdir(), seekdir(), telldir(), and
  * vmsreaddirversions(), and preprocessor stuff on which these depend:
  *    Written by Rich $alz, <rsalz@bbn.com> in August, 1990.
+ *
  */
+
     /* Data structure returned by READDIR(). */
 struct dirent {
     char       d_name[256];            /* File name            */
-    int                d_namlen;                       /* Length of d_name */
+    int                d_namlen;               /* Length of d_name */
     int                vms_verscount;          /* Number of versions   */
     int                vms_versions[20];       /* Version numbers      */
 };
@@ -515,8 +597,10 @@ typedef struct _dirdesc {
     char                       *pattern;
     struct dirent              entry;
     struct dsc$descriptor_s    pat;
+    void                       *mutex;
 } DIR;
 
+
 #define rewinddir(dirp)                seekdir((dirp), 0)
 
 /* used for our emulation of getpw* */
@@ -552,44 +636,52 @@ struct passwd {
 #include <stat.h>
 /* Since we've got to match the size of the CRTL's stat_t, we need
  * to mimic DECC's alignment settings.
+ *
+ * The simplest thing is to just put a wrapper around the stat structure
+ * supplied by the CRTL and use #defines to redirect references to the
+ * members to the real names.
  */
+
 #if defined(__DECC) || defined(__DECCXX)
 #  pragma __member_alignment __save
-#  pragma __nomember_alignment
+#  pragma member_alignment
 #endif
-#if defined(__DECC) 
-#  pragma __message __save
-#  pragma __message disable (__MISALGNDSTRCT)
-#  pragma __message disable (__MISALGNDMEM)
+
+typedef unsigned mydev_t;
+#ifndef _LARGEFILE
+typedef unsigned myino_t;
+#else
+typedef __ino64_t myino_t;
 #endif
+
 struct mystat
 {
-        char *st_devnam;  /* pointer to device name */
-        unsigned st_ino;    /* hack - CRTL uses unsigned short[3] for */
-        unsigned short rvn; /* FID (num,seq,rvn) */
-        unsigned short st_mode;        /* file "mode" i.e. prot, dir, reg, etc. */
-        int    st_nlink;       /* for compatibility - not really used */
-        unsigned st_uid;       /* from ACP - QIO uic field */
-        unsigned short st_gid; /* group number extracted from st_uid */
-        dev_t   st_rdev;       /* for compatibility - always zero */
-        off_t   st_size;       /* file size in bytes */
-        unsigned st_atime;     /* file access time; always same as st_mtime */
-        unsigned st_mtime;     /* last modification time */
-        unsigned st_ctime;     /* file creation time */
-        char   st_fab_rfm;     /* record format */
-        char   st_fab_rat;     /* record attributes */
-        char   st_fab_fsz;     /* fixed header size */
-        unsigned st_dev;       /* encoded device name */
-        /* Pad struct out to integral number of longwords, since DECC 5.6/VAX
-         * has a bug in dealing with offsets in structs in which are embedded
-         * other structs whose size is an odd number of bytes.  (An even
-         * number of bytes is enough to make it happy, but we go for natural
-         * alignment anyhow.)
-         */
-        char   st_fill1[sizeof(void *) - (3*sizeof(unsigned short) + 3*sizeof(char))%sizeof(void *)];
+    struct stat crtl_stat;
+    myino_t st_ino;
+#ifndef _LARGEFILE
+    unsigned rvn; /* FID (num,seq,rvn) + pad */
+#endif
+    mydev_t st_dev;
+    char st_devnam[256]; /* Cache the (short) VMS name */
 };
-typedef unsigned mydev_t;
-typedef unsigned myino_t;
+
+#define st_mode crtl_stat.st_mode
+#define st_nlink crtl_stat.st_nlink
+#define st_uid crtl_stat.st_uid
+#define st_gid crtl_stat.st_gid
+#define st_rdev crtl_stat.st_rdev
+#define st_size crtl_stat.st_size
+#define st_atime crtl_stat.st_atime
+#define st_mtime crtl_stat.st_mtime
+#define st_ctime crtl_stat.st_ctime
+#define st_fab_rfm crtl_stat.st_fab_rfm
+#define st_fab_rat crtl_stat.st_fab_rat
+#define st_fab_fsz crtl_stat.st_fab_fsz
+#define st_fab_mrs crtl_stat_st_fab_mrs
+
+#if defined(__DECC) || defined(__DECCXX)
+#  pragma __member_alignment __restore
+#endif
 
 /*
  * DEC C previous to 6.0 corrupts the behavior of the /prefix
@@ -617,12 +709,6 @@ typedef unsigned myino_t;
 #  define dev_t mydev_t
 #  define ino_t myino_t
 #endif
-#if defined(__DECC) || defined(__DECCXX)
-#  pragma __member_alignment __restore
-#endif
-#if defined(__DECC) 
-#  pragma __message __restore
-#endif
 /* Cons up a 'delete' bit for testing access */
 #define S_IDUSR (S_IWUSR | S_IXUSR)
 #define S_IDGRP (S_IWGRP | S_IXGRP)
@@ -659,73 +745,90 @@ typedef unsigned myino_t;
 #endif
 
 void   prime_env_iter (void);
-void   init_os_extras ();
+void   init_os_extras (void);
+int    Perl_vms_status_to_unix(int vms_status, int child_flag);
+int    Perl_unix_status_to_vms(int unix_status);
 /* prototype section start marker; `typedef' passes through cpp */
 typedef char  __VMS_PROTOTYPES__;
+int    Perl_vmstrnenv (const char *, char *, unsigned long int, struct dsc$descriptor_s **, unsigned long int);
+char * Perl_vms_realpath (pTHX_ const char *, char *);
 #if !defined(PERL_IMPLICIT_CONTEXT)
+int    Perl_vms_case_tolerant(void);
 char * Perl_my_getenv (const char *, bool);
-int    Perl_vmstrnenv (const char *, char *, unsigned long int, struct dsc$descriptor_s **, unsigned long int);
 int    Perl_my_trnlnm (const char *, char *, unsigned long int);
-char * Perl_tounixspec (char *, char *);
-char * Perl_tounixspec_ts (char *, char *);
-char * Perl_tovmsspec (char *, char *);
-char * Perl_tovmsspec_ts (char *, char *);
-char * Perl_tounixpath (char *, char *);
-char * Perl_tounixpath_ts (char *, char *);
-char * Perl_tovmspath (char *, char *);
-char * Perl_tovmspath_ts (char *, char *);
-int    Perl_do_rmdir (char *);
-char * Perl_fileify_dirspec (char *, char *);
-char * Perl_fileify_dirspec_ts (char *, char *);
-char * Perl_pathify_dirspec (char *, char *);
-char * Perl_pathify_dirspec_ts (char *, char *);
-char * Perl_rmsexpand (char *, char *, char *, unsigned);
-char * Perl_rmsexpand_ts (char *, char *, char *, unsigned);
-int    Perl_trim_unixpath (char *, char*, int);
-DIR *  Perl_opendir (char *);
-int    Perl_rmscopy (char *, char *, int);
+char * Perl_tounixspec (const char *, char *);
+char * Perl_tounixspec_ts (const char *, char *);
+char * Perl_tovmsspec (const char *, char *);
+char * Perl_tovmsspec_ts (const char *, char *);
+char * Perl_tounixpath (const char *, char *);
+char * Perl_tounixpath_ts (const char *, char *);
+char * Perl_tovmspath (const char *, char *);
+char * Perl_tovmspath_ts (const char *, char *);
+int    Perl_do_rmdir (const char *);
+char * Perl_fileify_dirspec (const char *, char *);
+char * Perl_fileify_dirspec_ts (const char *, char *);
+char * Perl_pathify_dirspec (const char *, char *);
+char * Perl_pathify_dirspec_ts (const char *, char *);
+char * Perl_rmsexpand (const char *, char *, const char *, unsigned);
+char * Perl_rmsexpand_ts (const char *, char *, const char *, unsigned);
+int    Perl_trim_unixpath (char *, const char*, int);
+DIR  * Perl_opendir (const char *);
+int    Perl_rmscopy (const char *, const char *, int);
+int    Perl_my_mkdir (const char *, Mode_t);
+bool   Perl_vms_do_aexec (SV *, SV **, SV **);
 #else
-int    Perl_vmstrnenv (pTHX_ const char *, char *, unsigned long int, struct dsc$descriptor_s **, unsigned long int);
 char * Perl_my_getenv (pTHX_ const char *, bool);
 int    Perl_my_trnlnm (pTHX_ const char *, char *, unsigned long int);
-char * Perl_tounixspec (pTHX_ char *, char *);
-char * Perl_tounixspec_ts (pTHX_ char *, char *);
-char * Perl_tovmsspec (pTHX_ char *, char *);
-char * Perl_tovmsspec_ts (pTHX_ char *, char *);
-char * Perl_tounixpath (pTHX_ char *, char *);
-char * Perl_tounixpath_ts (pTHX_ char *, char *);
-char * Perl_tovmspath (pTHX_ char *, char *);
-char * Perl_tovmspath_ts (pTHX_ char *, char *);
-int    Perl_do_rmdir (pTHX_ char *);
-char * Perl_fileify_dirspec (pTHX_ char *, char *);
-char * Perl_fileify_dirspec_ts (pTHX_ char *, char *);
-char * Perl_pathify_dirspec (pTHX_ char *, char *);
-char * Perl_pathify_dirspec_ts (pTHX_ char *, char *);
-char * Perl_rmsexpand (pTHX_ char *, char *, char *, unsigned);
-char * Perl_rmsexpand_ts (pTHX_ char *, char *, char *, unsigned);
-int    Perl_trim_unixpath (pTHX_ char *, char*, int);
-DIR *  Perl_opendir (pTHX_ char *);
-int    Perl_rmscopy (pTHX_ char *, char *, int);
-#endif
-char * my_getenv_len (const char *, unsigned long *, bool);
-int    vmssetenv (char *, char *, struct dsc$descriptor_s **);
-char * my_crypt (const char *, const char *);
-Pid_t  my_waitpid (Pid_t, int *, int);
+char * Perl_tounixspec (pTHX_ const char *, char *);
+char * Perl_tounixspec_ts (pTHX_ const char *, char *);
+char * Perl_tovmsspec (pTHX_ const char *, char *);
+char * Perl_tovmsspec_ts (pTHX_ const char *, char *);
+char * Perl_tounixpath (pTHX_ const char *, char *);
+char * Perl_tounixpath_ts (pTHX_ const char *, char *);
+char * Perl_tovmspath (pTHX_ const char *, char *);
+char * Perl_tovmspath_ts (pTHX_ const char *, char *);
+int    Perl_do_rmdir (pTHX_ const char *);
+char * Perl_fileify_dirspec (pTHX_ const char *, char *);
+char * Perl_fileify_dirspec_ts (pTHX_ const char *, char *);
+char * Perl_pathify_dirspec (pTHX_ const char *, char *);
+char * Perl_pathify_dirspec_ts (pTHX_ const char *, char *);
+char * Perl_rmsexpand (pTHX_ const char *, char *, const char *, unsigned);
+char * Perl_rmsexpand_ts (pTHX_ const char *, char *, const char *, unsigned);
+int    Perl_trim_unixpath (pTHX_ char *, const char*, int);
+DIR * Perl_opendir (pTHX_ const char *);
+int    Perl_rmscopy (pTHX_ const char *, const char *, int);
+int    Perl_my_mkdir (pTHX_ const char *, Mode_t);
+bool   Perl_vms_do_aexec (pTHX_ SV *, SV **, SV **);
+#endif
+int    Perl_vms_case_tolerant(void);
+char * Perl_my_getenv_len (pTHX_ const char *, unsigned long *, bool);
+int    Perl_vmssetenv (pTHX_ const char *, const char *, struct dsc$descriptor_s **);
+void   Perl_vmssetuserlnm(pTHX_ const char *name, const char *eqv);
+char * Perl_my_crypt (pTHX_ const char *, const char *);
+Pid_t  Perl_my_waitpid (pTHX_ Pid_t, int *, int);
 char * my_gconvert (double, int, int, char *);
-int    kill_file (char *);
-int    my_mkdir (char *, Mode_t);
-int    my_chdir (char *);
-FILE * my_tmpfile (void);
-int    my_utime (char *, struct utimbuf *);
-void   vms_image_init (int *, char ***);
-struct dirent *        readdir (DIR *);
-long   telldir (DIR *);
-void   seekdir (DIR *, long);
-void   closedir (DIR *);
+int    Perl_kill_file (pTHX_ const char *);
+int    Perl_my_chdir (pTHX_ const char *);
+FILE * Perl_my_tmpfile (void);
+#ifndef HOMEGROWN_POSIX_SIGNALS
+int    Perl_my_sigaction (pTHX_ int, const struct sigaction*, struct sigaction*);
+#endif
+#ifdef KILL_BY_SIGPRC
+unsigned int   Perl_sig_to_vmscondition (int);
+int    Perl_my_kill (int, int);
+void   Perl_csighandler_init (void);
+#endif
+int    Perl_my_utime (pTHX_ const char *, const struct utimbuf *);
+void   Perl_vms_image_init (int *, char ***);
+struct dirent *        Perl_readdir (pTHX_ DIR *);
+int    Perl_readdir_r(pTHX_ DIR *, struct dirent *, struct dirent **);
+long   Perl_telldir (DIR *);
+void   Perl_seekdir (pTHX_ DIR *, long);
+void   Perl_closedir (DIR *);
 void   vmsreaddirversions (DIR *, int);
-struct tm *    my_gmtime (const time_t *);
-struct tm *    my_localtime (const time_t *);
-time_t my_time (time_t *);
+struct tm *    Perl_my_gmtime (pTHX_ const time_t *);
+struct tm *    Perl_my_localtime (pTHX_ const time_t *);
+time_t Perl_my_time (pTHX_ time_t *);
 #ifdef HOMEGROWN_POSIX_SIGNALS
 int     my_sigemptyset (sigset_t *);
 int     my_sigfillset  (sigset_t *);
@@ -734,21 +837,22 @@ int     my_sigdelset   (sigset_t *, int);
 int     my_sigismember (sigset_t *, int);
 int     my_sigprocmask (int, sigset_t *, sigset_t *);
 #endif
-I32    cando_by_name (I32, Uid_t, char *);
-int    flex_fstat (int, Stat_t *);
-int    flex_stat (const char *, Stat_t *);
-int    my_vfork ();
-bool   vms_do_aexec (SV *, SV **, SV **);
-bool   vms_do_exec (char *);
-unsigned long int      do_aspawn (void *, void **, void **);
-unsigned long int      do_spawn (char *);
-int    my_fwrite (void *, size_t, size_t, FILE *);
-int    my_flush (FILE *);
-struct passwd *        my_getpwnam (char *name);
-struct passwd *        my_getpwuid (Uid_t uid);
-struct passwd *        my_getpwent ();
-void   my_endpwent ();
-char * my_getlogin ();
+I32    Perl_cando_by_name (pTHX_ I32, bool, const char *);
+int    Perl_flex_fstat (pTHX_ int, Stat_t *);
+int    Perl_flex_lstat (pTHX_ const char *, Stat_t *);
+int    Perl_flex_stat (pTHX_ const char *, Stat_t *);
+int    my_vfork (void);
+bool   Perl_vms_do_exec (pTHX_ const char *);
+unsigned long int      Perl_do_aspawn (pTHX_ void *, void **, void **);
+unsigned long int      Perl_do_spawn (pTHX_ const char *);
+FILE *  my_fdopen (int, const char *);
+int     my_fclose (FILE *);
+int    my_fwrite (const void *, size_t, size_t, FILE *);
+int    Perl_my_flush (pTHX_ FILE *);
+struct passwd *        Perl_my_getpwnam (pTHX_ const char *name);
+struct passwd *        Perl_my_getpwuid (pTHX_ Uid_t uid);
+void   Perl_my_endpwent (pTHX);
+char * my_getlogin (void);
 typedef char __VMS_SEPYTOTORP__;
 /* prototype section end marker; `typedef' passes through cpp */
 
@@ -785,4 +889,9 @@ typedef char __VMS_SEPYTOTORP__;
 
 #define NO_ENVIRON_ARRAY
 
+/* RMSEXPAND options */
+#define PERL_RMSEXPAND_M_VMS           0x02 /* Force output to VMS format */
+#define PERL_RMSEXPAND_M_LONG          0x04 /* Expand to long name format */
+#define PERL_RMSEXPAND_M_SYMLINK       0x20 /* Use symbolic link, not target */
+
 #endif  /* __vmsish_h_included */