This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.003: [changes beteween cumulative patches and tarball release]
[perl5.git] / vms / vmsish.h
index 65f182c..0685985 100644 (file)
@@ -3,7 +3,7 @@
  * VMS-specific C header file for perl5.
  *
  * Last revised: 01-Oct-1995 by Charles Bailey  bailey@genetics.upenn.edu
- * Version: 5.2.b1
+ * Version: 5.1.6
  */
 
 #ifndef __vmsish_h_included
 #include <unixio.h>
 #include <unixlib.h>
 #include <file.h>  /* it's not <sys/file.h>, so don't use I_SYS_FILE */
+
+/* Our own contribution to PerlShr's global symbols . . . */
+#ifdef EMBED
+#  define my_trnlnm            Perl_my_trnlnm
+#  define my_getenv            Perl_my_getenv
+#  define my_crypt             Perl_my_crypt
+#  define waitpid              Perl_waitpid
+#  define my_gconvert          Perl_my_gconvert
+#  define do_rmdir             Perl_do_rmdir
+#  define kill_file            Perl_kill_file
+#  define my_utime             Perl_my_utime
+#  define fileify_dirspec      Perl_fileify_dirspec
+#  define fileify_dirspec_ts   Perl_fileify_dirspec_ts
+#  define pathify_dirspec      Perl_pathify_dirspec
+#  define pathify_dirspec_ts   Perl_pathify_dirspec_ts
+#  define tounixspec           Perl_tounixspec
+#  define tounixspec_ts                Perl_tounixspec_ts
+#  define tovmsspec            Perl_tovmsspec
+#  define tovmsspec_ts         Perl_tovmsspec_ts
+#  define tounixpath           Perl_tounixpath
+#  define tounixpath_ts                Perl_tounixpath_ts
+#  define tovmspath            Perl_tovmspath
+#  define tovmspath_ts         Perl_tovmspath_ts
+#  define getredirection       Perl_getredirection
+#  define opendir              Perl_opendir
+#  define readdir              Perl_readdir
+#  define telldir              Perl_telldir
+#  define seekdir              Perl_seekdir
+#  define closedir             Perl_closedir
+#  define vmsreaddirversions   Perl_vmsreaddirversions
+#  define getredirection       Perl_getredirection
+#  define my_gmtime            Perl_my_gmtime
+#  define cando_by_name                Perl_cando_by_name
+#  define flex_fstat           Perl_flex_fstat
+#  define flex_stat            Perl_flex_stat
+#  define trim_unixpath                Perl_trim_unixpath
+#  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_fwrite            Perl_my_fwrite
+#  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_getlogin          Perl_my_getlogin
+#  define rmscopy              Perl_rmscopy
+#  define init_os_extras       Perl_init_os_extras
+#endif
+
+/* Delete if at all possible, changing protections if necessary. */
 #define unlink kill_file
 
 /*  The VMS C RTL has vfork() but not fork().  Both actually work in a way
 #endif
 
 /* Handy way to vet calls to VMS system services and RTL routines. */
-#define _ckvmssts(call) do { register unsigned long int __ckvms_sts; \
+#define _ckvmssts(call) STMT_START { register unsigned long int __ckvms_sts; \
   if (!((__ckvms_sts=(call))&1)) { \
   set_errno(EVMSERR); set_vaxc_errno(__ckvms_sts); \
   croak("Fatal VMS error (status=%d) at %s, line %d", \
-  __ckvms_sts,__FILE__,__LINE__); } } while (0);
+  __ckvms_sts,__FILE__,__LINE__); } } STMT_END
 
 #ifdef VMS_DO_SOCKETS
 #include "sockadapt.h"
 #endif
 
+#define BIT_BUCKET "_NLA0:"
+#define PERL_SYS_INIT(c,v)  getredirection((c),(v))
+#define PERL_SYS_TERM()
+#define dXSUB_SYS int dummy
 #define HAS_KILL
 #define HAS_WAIT
 
@@ -177,10 +232,19 @@ struct tms {
 #define DYNAMIC_ENV_FETCH 1
 #define ENV_HV_NAME "%EnV%VmS%"
 
+/* Thin jacket around cuserid() tomatch Unix' calling sequence */
+#define getlogin my_getlogin
+
+/* Ditto for sys$hash_passwrod() . . . */
+#define crypt  my_crypt
+
 /* 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)
 
+/* By default, flush data all the way to disk, not just to RMS buffers */
+#define Fflush(fp) ((fflush(fp) || fsync(fileno(fp))) ? EOF : 0)
+
 /* Setup for the dirent routines:
  * opendir(), closedir(), readdir(), seekdir(), telldir(), and
  * vmsreaddirversions(), and preprocessor stuff on which these depend:
@@ -228,7 +292,14 @@ struct passwd {
 
 /* Our own stat_t substitute, since we play with st_dev and st_ino -
  * we want atomic types so Unix-bound code which compares these fields
- * for two files will work most of the time under VMS
+ * for two files will work most of the time under VMS.
+ * N.B. 1. The st_ino hack assumes that sizeof(unsigned short[3]) ==
+ * sizeof(unsigned) + sizeof(unsigned short).  We can't use a union type
+ * to map the unsigned int we want and the unsigned short[3] the CRTL
+ * returns into the same member, since gcc has different ideas than DECC
+ * and VAXC about sizing union types.
+ * N.B 2. The routine cando() in vms.c assumes that &stat.st_ino is the
+ * address of a FID.
  */
 /* First, grab the system types, so we don't clobber them later */
 #include <stat.h>
@@ -247,10 +318,8 @@ struct passwd {
 struct mystat
 {
         char *st_devnam;  /* pointer to device name */
-        union {
-          unsigned short fid[3];
-          unsigned long st_ino_mostly;
-        } st_inode_u;
+        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 */
@@ -265,14 +334,10 @@ struct mystat
         char   st_fab_fsz;     /* fixed header size */
         unsigned st_dev;       /* encoded device name */
 };
-#ifdef st_ino
-#  undef st_ino
-#endif
-#define st_ino st_inode_u.st_ino_mostly
 #define stat mystat
 typedef unsigned mydev_t;
 #define dev_t mydev_t
-typedef unsigned long myino_t;
+typedef unsigned myino_t;
 #define ino_t myino_t
 #if defined(__DECC) || defined(__DECCXX)
 #  pragma __member_alignment __restore
@@ -294,8 +359,11 @@ typedef unsigned long myino_t;
  * __VMS_PROTOTYPES__ and __VMS_SEPYTOTORP__ lines, and must be in the form
  *    <data type><TAB>name<WHITESPACE>_((<prototype args>));
  */
-typedef char  __VMS_PROTOTYPES__; /* prototype section start marker */
+/* prototype section start marker; `typedef' passes through cpp */
+typedef char  __VMS_PROTOTYPES__;
+int    my_trnlnm _((char *, char *, unsigned long int));
 char * my_getenv _((char *));
+char * my_crypt _((const char *, const char *));
 unsigned long int      waitpid _((unsigned long int, int *, int));
 char * my_gconvert _((double, int, int, char *));
 int    do_rmdir _((char *));
@@ -335,8 +403,11 @@ struct passwd *    my_getpwnam _((char *name));
 struct passwd *        my_getpwuid _((Uid_t uid));
 struct passwd *        my_getpwent _(());
 void   my_endpwent _(());
+char * my_getlogin _(());
+int    rmscopy _((char *, char *, int));
 void   init_os_extras _(());
-typedef char __VMS_SEPYTOTORP__; /* prototype section end marker */
+typedef char __VMS_SEPYTOTORP__;
+/* prototype section end marker; `typedef' passes through cpp */
 
 #ifndef VMS_DO_SOCKETS
 /* This relies on tricks in perl.h to pick up that these manifest constants
@@ -349,4 +420,6 @@ typedef char __VMS_SEPYTOTORP__; /* prototype section end marker */
 #undef HAS_NTOHL
 #endif
 
+#define TMPPATH "sys$scratch:perl-eXXXXXX"
+
 #endif  /* __vmsish_h_included */