Commit | Line | Data |
a0d0e21e |
1 | /* vmsish.h |
2 | * |
3 | * VMS-specific C header file for perl5. |
4 | * |
aa689395 |
5 | * Last revised: 18-Feb-1997 by Charles Bailey bailey@genetics.upenn.edu |
6 | * Version: 5.3.28 |
a0d0e21e |
7 | */ |
8 | |
9 | #ifndef __vmsish_h_included |
10 | #define __vmsish_h_included |
11 | |
12 | #include <descrip.h> /* for dirent struct definitions */ |
748a9306 |
13 | #include <libdef.h> /* status codes for various places */ |
14 | #include <rmsdef.h> /* at which errno and vaxc$errno are */ |
15 | #include <ssdef.h> /* explicitly set in the perl source code */ |
4fdae800 |
16 | #include <stsdef.h> /* bitmasks for exit status testing */ |
748a9306 |
17 | |
4633a7c4 |
18 | /* Suppress compiler warnings from DECC for VMS-specific extensions: |
36477c24 |
19 | * GLOBALEXT, NOSHAREEXT, READONLYEXT: global[dr]ef declarations |
e518068a |
20 | * ADDRCONSTEXT,NEEDCONSTEXT: initialization of data with non-constant values |
21 | * (e.g. pointer fields of descriptors) |
22 | */ |
23 | #ifdef __DECC |
36477c24 |
24 | # pragma message disable (GLOBALEXT,NOSHAREEXT,READONLYEXT,ADDRCONSTEXT,NEEDCONSTEXT) |
e518068a |
25 | #endif |
26 | |
748a9306 |
27 | /* DEC's C compilers and gcc use incompatible definitions of _to(upp|low)er() */ |
28 | #ifdef _toupper |
29 | # undef _toupper |
30 | #endif |
31 | #define _toupper(c) (((c) < 'a' || (c) > 'z') ? (c) : (c) & ~040) |
32 | #ifdef _tolower |
33 | # undef _tolower |
34 | #endif |
35 | #define _tolower(c) (((c) < 'A' || (c) > 'Z') ? (c) : (c) | 040) |
4633a7c4 |
36 | /* DECC 1.3 has a funny definition of abs; it's fixed in DECC 4.0, so this |
37 | * can go away once DECC 1.3 isn't in use any more. */ |
38 | #if defined(__ALPHA) && defined(__DECC) |
39 | #undef abs |
40 | #define abs(__x) __ABS(__x) |
41 | #undef labs |
42 | #define labs(__x) __LABS(__x) |
43 | #endif /* __ALPHA && __DECC */ |
a0d0e21e |
44 | |
45 | /* Assorted things to look like Unix */ |
46 | #ifdef __GNUC__ |
47 | #ifndef _IOLBF /* gcc's stdio.h doesn't define this */ |
48 | #define _IOLBF 1 |
49 | #endif |
748a9306 |
50 | #endif |
a0d0e21e |
51 | #include <processes.h> /* for vfork() */ |
52 | #include <unixio.h> |
a0d0e21e |
53 | #include <unixlib.h> |
54 | #include <file.h> /* it's not <sys/file.h>, so don't use I_SYS_FILE */ |
774d564b |
55 | #if defined(__DECC) && defined(__DECC_VER) && __DECC_VER > 20000000 |
bbce6d69 |
56 | # include <unistd.h> /* DECC has this; VAXC and gcc don't */ |
57 | #endif |
bf109933 |
58 | |
aa689395 |
59 | #ifdef NO_PERL_TYPEDEFS /* a2p; we don't want Perl's special routines */ |
60 | # define DONT_MASK_RTL_CALLS |
61 | #endif |
62 | |
63 | /* defined for vms.c so we can see CRTL | defined for a2p */ |
64 | #ifndef DONT_MASK_RTL_CALLS |
65 | # ifdef getenv |
66 | # undef getenv |
67 | # endif |
68 | # define getenv(v) my_getenv(v) /* getenv used for regular logical names */ |
69 | #endif |
70 | |
4fdae800 |
71 | /* DECC introduces this routine in the RTL as of VMS 7.0; for now, |
72 | * we'll use ours, since it gives us the full VMS exit status. */ |
73 | #ifdef __PID_T |
74 | # define Pid_t pid_t |
75 | #else |
76 | # define Pid_t unsigned int |
77 | #endif |
78 | #define waitpid my_waitpid |
79 | |
bf109933 |
80 | /* Our own contribution to PerlShr's global symbols . . . */ |
81 | #ifdef EMBED |
82 | # define my_trnlnm Perl_my_trnlnm |
83 | # define my_getenv Perl_my_getenv |
94c456c4 |
84 | # define prime_env_iter Perl_prime_env_iter |
85 | # define my_setenv Perl_my_setenv |
bf109933 |
86 | # define my_crypt Perl_my_crypt |
4fdae800 |
87 | # define my_waitpid Perl_my_waitpid |
bf109933 |
88 | # define my_gconvert Perl_my_gconvert |
89 | # define do_rmdir Perl_do_rmdir |
90 | # define kill_file Perl_kill_file |
8cc95fdb |
91 | # define my_mkdir Perl_my_mkdir |
bf109933 |
92 | # define my_utime Perl_my_utime |
bbce6d69 |
93 | # define rmsexpand Perl_rmsexpand |
94 | # define rmsexpand_ts Perl_rmsexpand_ts |
bf109933 |
95 | # define fileify_dirspec Perl_fileify_dirspec |
96 | # define fileify_dirspec_ts Perl_fileify_dirspec_ts |
97 | # define pathify_dirspec Perl_pathify_dirspec |
98 | # define pathify_dirspec_ts Perl_pathify_dirspec_ts |
99 | # define tounixspec Perl_tounixspec |
100 | # define tounixspec_ts Perl_tounixspec_ts |
101 | # define tovmsspec Perl_tovmsspec |
102 | # define tovmsspec_ts Perl_tovmsspec_ts |
103 | # define tounixpath Perl_tounixpath |
104 | # define tounixpath_ts Perl_tounixpath_ts |
105 | # define tovmspath Perl_tovmspath |
106 | # define tovmspath_ts Perl_tovmspath_ts |
84902520 |
107 | # define vms_image_init Perl_vms_image_init |
bf109933 |
108 | # define opendir Perl_opendir |
109 | # define readdir Perl_readdir |
110 | # define telldir Perl_telldir |
111 | # define seekdir Perl_seekdir |
112 | # define closedir Perl_closedir |
113 | # define vmsreaddirversions Perl_vmsreaddirversions |
7b62b82b |
114 | #if __VMS_VER < 70000000 || __DECC_VER < 50200000 |
bf109933 |
115 | # define my_gmtime Perl_my_gmtime |
ff0cee69 |
116 | # define my_localtime Perl_my_localtime |
117 | # define my_time Perl_my_time |
5b411029 |
118 | # define my_sigemptyset Perl_my_sigemptyset |
119 | # define my_sigfillset Perl_my_sigfillset |
120 | # define my_sigaddset Perl_my_sigaddset |
121 | # define my_sigdelset Perl_my_sigdelset |
122 | # define my_sigismember Perl_my_sigismember |
123 | # define my_sigprocmask Perl_my_sigprocmask |
7b62b82b |
124 | #endif |
bf109933 |
125 | # define cando_by_name Perl_cando_by_name |
126 | # define flex_fstat Perl_flex_fstat |
127 | # define flex_stat Perl_flex_stat |
128 | # define trim_unixpath Perl_trim_unixpath |
0414b1a0 |
129 | # define my_vfork Perl_my_vfork |
bf109933 |
130 | # define vms_do_aexec Perl_vms_do_aexec |
131 | # define vms_do_exec Perl_vms_do_exec |
132 | # define do_aspawn Perl_do_aspawn |
133 | # define do_spawn Perl_do_spawn |
134 | # define my_fwrite Perl_my_fwrite |
d27fe803 |
135 | # define my_flush Perl_my_flush |
0414b1a0 |
136 | # define my_binmode Perl_my_binmode |
bf109933 |
137 | # define my_getpwnam Perl_my_getpwnam |
138 | # define my_getpwuid Perl_my_getpwuid |
139 | # define my_getpwent Perl_my_getpwent |
140 | # define my_endpwent Perl_my_endpwent |
141 | # define my_getlogin Perl_my_getlogin |
142 | # define rmscopy Perl_rmscopy |
143 | # define init_os_extras Perl_init_os_extras |
144 | #endif |
145 | |
146 | /* Delete if at all possible, changing protections if necessary. */ |
748a9306 |
147 | #define unlink kill_file |
148 | |
0414b1a0 |
149 | /* |
150 | * Intercept calls to fork, so we know whether subsequent calls to |
151 | * exec should be handled in VMSish or Unixish style. |
152 | */ |
153 | #define fork my_vfork |
aa689395 |
154 | #ifndef DONT_MASK_RTL_CALLS /* #defined in vms.c so we see real vfork */ |
0414b1a0 |
155 | # ifdef vfork |
156 | # undef vfork |
157 | # endif |
158 | # define vfork my_vfork |
159 | #endif |
160 | |
161 | /* BIG_TIME: |
162 | * This symbol is defined if Time_t is an unsigned type on this system. |
163 | */ |
164 | #define BIG_TIME |
165 | |
166 | /* USE_STAT_RDEV: |
167 | * This symbol is defined if this system has a stat structure declaring |
168 | * st_rdev |
e518068a |
169 | */ |
0414b1a0 |
170 | #define USE_STAT_RDEV /**/ |
171 | |
172 | /* ACME_MESS: |
173 | * This symbol, if defined, indicates that error messages should be |
174 | * should be generated in a format that allows the use of the Acme |
175 | * GUI/editor's autofind feature. |
176 | */ |
177 | #undef ACME_MESS /**/ |
e518068a |
178 | |
44a8e56a |
179 | /* ALTERNATE_SHEBANG: |
180 | * This symbol, if defined, contains a "magic" string which may be used |
181 | * as the first line of a Perl program designed to be executed directly |
182 | * by name, instead of the standard Unix #!. If ALTERNATE_SHEBANG |
183 | * begins with a character other then #, then Perl will only treat |
184 | * it as a command line if if finds the string "perl" in the first |
185 | * word; otherwise it's treated as the first line of code in the script. |
186 | * (IOW, Perl won't hand off to another interpreter via an alternate |
187 | * shebang sequence that might be legal Perl code.) |
188 | */ |
189 | #define ALTERNATE_SHEBANG "$" |
190 | |
748a9306 |
191 | /* Macros to set errno using the VAX thread-safe calls, if present */ |
192 | #if (defined(__DECC) || defined(__DECCXX)) && !defined(__ALPHA) |
193 | # define set_errno(v) (cma$tis_errno_set_value(v)) |
774d564b |
194 | void cma$tis_errno_set_value(int __value); /* missing in some errno.h */ |
748a9306 |
195 | # define set_vaxc_errno(v) (vaxc$errno = (v)) |
196 | #else |
197 | # define set_errno(v) (errno = (v)) |
198 | # define set_vaxc_errno(v) (vaxc$errno = (v)) |
199 | #endif |
200 | |
ff0cee69 |
201 | /* Support for 'vmsish' behaviors enabled with C<use vmsish> pragma */ |
202 | |
203 | #define COMPLEX_STATUS 1 /* We track both "POSIX" and VMS values */ |
204 | |
aa689395 |
205 | #define HINT_V_VMSISH 24 |
ff0cee69 |
206 | #define HINT_M_VMSISH_STATUS 0x01000000 /* system, $? return VMS status */ |
207 | #define HINT_M_VMSISH_EXIT 0x02000000 /* exit(1) ==> SS$_NORMAL */ |
208 | #define HINT_M_VMSISH_TIME 0x04000000 /* times are local, not UTC */ |
aa689395 |
209 | #define NATIVE_HINTS (hints >> HINT_V_VMSISH) /* used in op.c */ |
ff0cee69 |
210 | |
aa689395 |
211 | #define TEST_VMSISH(h) (curcop->op_private & ((h) >> HINT_V_VMSISH)) |
ff0cee69 |
212 | #define VMSISH_STATUS TEST_VMSISH(HINT_M_VMSISH_STATUS) |
213 | #define VMSISH_EXIT TEST_VMSISH(HINT_M_VMSISH_EXIT) |
214 | #define VMSISH_TIME TEST_VMSISH(HINT_M_VMSISH_TIME) |
215 | |
748a9306 |
216 | /* Handy way to vet calls to VMS system services and RTL routines. */ |
bf109933 |
217 | #define _ckvmssts(call) STMT_START { register unsigned long int __ckvms_sts; \ |
748a9306 |
218 | if (!((__ckvms_sts=(call))&1)) { \ |
219 | set_errno(EVMSERR); set_vaxc_errno(__ckvms_sts); \ |
e518068a |
220 | croak("Fatal VMS error (status=%d) at %s, line %d", \ |
bf109933 |
221 | __ckvms_sts,__FILE__,__LINE__); } } STMT_END |
a0d0e21e |
222 | |
0414b1a0 |
223 | /* Same thing, but don't call back to Perl's croak(); useful for errors |
224 | * occurring during startup, before Perl's state is initialized */ |
225 | #define _ckvmssts_noperl(call) STMT_START { register unsigned long int __ckvms_sts; \ |
226 | if (!((__ckvms_sts=(call))&1)) { \ |
227 | set_errno(EVMSERR); set_vaxc_errno(__ckvms_sts); \ |
228 | fprintf(Perl_debug_log,"Fatal VMS error (status=%d) at %s, line %d", \ |
229 | __ckvms_sts,__FILE__,__LINE__); lib$signal(__ckvms_sts); } } STMT_END |
230 | |
a0d0e21e |
231 | #ifdef VMS_DO_SOCKETS |
232 | #include "sockadapt.h" |
233 | #endif |
234 | |
c07a80fd |
235 | #define BIT_BUCKET "_NLA0:" |
18f739ee |
236 | #define PERL_SYS_INIT(c,v) vms_image_init((c),(v)), MALLOC_INIT |
237 | #define PERL_SYS_TERM() MALLOC_TERM |
8cc95fdb |
238 | #define dXSUB_SYS |
a0d0e21e |
239 | #define HAS_KILL |
240 | #define HAS_WAIT |
241 | |
e518068a |
242 | /* VMS: |
243 | * This symbol, if defined, indicates that the program is running under |
244 | * VMS. It's a symbol automagically defined by all VMS C compilers I've seen. |
245 | * Just in case, however . . . */ |
246 | #ifndef VMS |
247 | #define VMS /**/ |
248 | #endif |
249 | |
250 | /* HAS_IOCTL: |
251 | * This symbol, if defined, indicates that the ioctl() routine is |
252 | * available to set I/O characteristics |
a0d0e21e |
253 | */ |
e518068a |
254 | #undef HAS_IOCTL /**/ |
255 | |
256 | /* HAS_UTIME: |
257 | * This symbol, if defined, indicates that the routine utime() is |
258 | * available to update the access and modification times of files. |
259 | */ |
260 | #define HAS_UTIME /**/ |
a0d0e21e |
261 | |
e518068a |
262 | /* HAS_GROUP |
263 | * This symbol, if defined, indicates that the getgrnam(), |
264 | * getgrgid(), and getgrent() routines are available to |
265 | * get group entries. |
266 | */ |
267 | #undef HAS_GROUP /**/ |
268 | |
269 | /* HAS_PASSWD |
270 | * This symbol, if defined, indicates that the getpwnam(), |
271 | * getpwuid(), and getpwent() routines are available to |
272 | * get password entries. |
273 | */ |
274 | #define HAS_PASSWD /**/ |
275 | |
276 | #define HAS_KILL |
277 | #define HAS_WAIT |
278 | |
0414b1a0 |
279 | /* USEMYBINMODE |
280 | * This symbol, if defined, indicates that the program should |
281 | * use the routine my_binmode(FILE *fp, char iotype) to insure |
282 | * that a file is in "binary" mode -- that is, that no translation |
283 | * of bytes occurs on read or write operations. |
284 | */ |
285 | #define USEMYBINMODE |
286 | |
a0d0e21e |
287 | /* |
288 | * fwrite1() should be a routine with the same calling sequence as fwrite(), |
289 | * but which outputs all of the bytes requested as a single stream (unlike |
290 | * fwrite() itself, which on some systems outputs several distinct records |
291 | * if the number_of_items parameter is >1). |
292 | */ |
293 | #define fwrite1 my_fwrite |
294 | |
d27fe803 |
295 | /* By default, flush data all the way to disk, not just to RMS buffers */ |
296 | #define Fflush(fp) my_flush(fp) |
297 | |
a0d0e21e |
298 | /* Use our own rmdir() */ |
299 | #define rmdir(name) do_rmdir(name) |
300 | |
301 | /* Assorted fiddling with sigs . . . */ |
302 | # include <signal.h> |
303 | #define ABORT() abort() |
5f05dabc |
304 | /* VAXC's signal.h doesn't #define SIG_ERR, but provides BADSIG instead. */ |
305 | #if !defined(SIG_ERR) && defined(BADSIG) |
306 | # define SIG_ERR BADSIG |
307 | #endif |
308 | |
a0d0e21e |
309 | |
748a9306 |
310 | /* Used with our my_utime() routine in vms.c */ |
311 | struct utimbuf { |
312 | time_t actime; |
313 | time_t modtime; |
314 | }; |
315 | #define utime my_utime |
316 | |
0414b1a0 |
317 | /* This is what times() returns, but <times.h> calls it tbuffer_t on VMS |
318 | * prior to v7.0. We check the DECC manifest to see whether it's already |
319 | * done this for us, relying on the fact that perl.h #includes <time.h> |
320 | * before it #includes "vmsish.h". |
321 | */ |
a0d0e21e |
322 | |
0414b1a0 |
323 | #ifndef __TMS |
324 | struct tms { |
325 | clock_t tms_utime; /* user time */ |
326 | clock_t tms_stime; /* system time - always 0 on VMS */ |
327 | clock_t tms_cutime; /* user time, children */ |
328 | clock_t tms_cstime; /* system time, children - always 0 on VMS */ |
329 | }; |
5f05dabc |
330 | #else |
331 | /* The new headers change the times() prototype to tms from tbuffer */ |
332 | # define tbuffer_t struct tms |
0414b1a0 |
333 | #endif |
a0d0e21e |
334 | |
e518068a |
335 | /* Prior to VMS 7.0, the CRTL gmtime() routine was a stub which always |
336 | * returned NULL. Substitute our own routine, which uses the logical |
337 | * SYS$TIMEZONE_DIFFERENTIAL, whcih the native UTC support routines |
ff0cee69 |
338 | * in VMS 6.0 or later use. We also add shims for time() and localtime() |
339 | * so we can run on UTC by default. |
e518068a |
340 | */ |
7b62b82b |
341 | #if __VMS_VER < 70000000 || __DECC_VER < 50200000 |
e518068a |
342 | #define gmtime(t) my_gmtime(t) |
ff0cee69 |
343 | #define localtime(t) my_localtime(t) |
344 | #define time(t) my_time(t) |
5b411029 |
345 | #define sigemptyset(t) my_sigemptyset(t) |
346 | #define sigfillset(t) my_sigfillset(t) |
347 | #define sigaddset(t, u) my_sigaddset(t, u) |
348 | #define sigdelset(t, u) my_sigdelset(t, u) |
349 | #define sigismember(t, u) my_sigismember(t, u) |
350 | #define sigprocmask(t, u, v) my_sigprocmask(t, u, v) |
351 | typedef int sigset_t; |
352 | /* The tools for sigprocmask() are there, just not the routine itself */ |
353 | # ifndef SIG_UNBLOCK |
354 | # define SIG_UNBLOCK 1 |
355 | # endif |
356 | # ifndef SIG_BLOCK |
357 | # define SIG_BLOCK 2 |
358 | # endif |
359 | # ifndef SIG_SETMASK |
360 | # define SIG_SETMASK 3 |
361 | # endif |
362 | # define sigaction sigvec |
363 | # define sa_flags sv_onstack |
364 | # define sa_handler sv_handler |
365 | # define sa_mask sv_mask |
366 | # define sigsuspend(set) sigpause(*set) |
367 | # define sigpending(a) (not_here("sigpending"),0) |
7b62b82b |
368 | #endif |
e518068a |
369 | |
a0d0e21e |
370 | /* VMS doesn't use a real sys_nerr, but we need this when scanning for error |
371 | * messages in text strings . . . |
372 | */ |
373 | |
374 | #define sys_nerr EVMSERR /* EVMSERR is as high as we can go. */ |
375 | |
376 | /* Look up new %ENV values on the fly */ |
377 | #define DYNAMIC_ENV_FETCH 1 |
378 | #define ENV_HV_NAME "%EnV%VmS%" |
aa689395 |
379 | /* Special getenv function for retrieving %ENV elements. */ |
380 | #define ENV_getenv(v) my_getenv(v) |
381 | |
a0d0e21e |
382 | |
c07a80fd |
383 | /* Thin jacket around cuserid() tomatch Unix' calling sequence */ |
384 | #define getlogin my_getlogin |
385 | |
386 | /* Ditto for sys$hash_passwrod() . . . */ |
387 | #define crypt my_crypt |
388 | |
8cc95fdb |
389 | /* Tweak arg to mkdir first, so we can tolerate trailing /. */ |
390 | #define Mkdir(dir,mode) my_mkdir((dir),(mode)) |
391 | |
a0d0e21e |
392 | /* Use our own stat() clones, which handle Unix-style directory names */ |
393 | #define Stat(name,bufptr) flex_stat(name,bufptr) |
394 | #define Fstat(fd,bufptr) flex_fstat(fd,bufptr) |
395 | |
396 | /* Setup for the dirent routines: |
397 | * opendir(), closedir(), readdir(), seekdir(), telldir(), and |
398 | * vmsreaddirversions(), and preprocessor stuff on which these depend: |
399 | * Written by Rich $alz, <rsalz@bbn.com> in August, 1990. |
a0d0e21e |
400 | */ |
401 | /* Data structure returned by READDIR(). */ |
402 | struct dirent { |
403 | char d_name[256]; /* File name */ |
404 | int d_namlen; /* Length of d_name */ |
405 | int vms_verscount; /* Number of versions */ |
406 | int vms_versions[20]; /* Version numbers */ |
407 | }; |
408 | |
409 | /* Handle returned by opendir(), used by the other routines. You |
410 | * are not supposed to care what's inside this structure. */ |
411 | typedef struct _dirdesc { |
412 | long context; |
413 | int vms_wantversions; |
414 | unsigned long int count; |
415 | char *pattern; |
416 | struct dirent entry; |
417 | struct dsc$descriptor_s pat; |
418 | } DIR; |
419 | |
420 | #define rewinddir(dirp) seekdir((dirp), 0) |
421 | |
748a9306 |
422 | /* used for our emulation of getpw* */ |
423 | struct passwd { |
424 | char *pw_name; /* Username */ |
425 | char *pw_passwd; |
426 | Uid_t pw_uid; /* UIC member number */ |
427 | Gid_t pw_gid; /* UIC group number */ |
428 | char *pw_comment; /* Default device/directory (Unix-style) */ |
429 | char *pw_gecos; /* Owner */ |
430 | char *pw_dir; /* Default device/directory (VMS-style) */ |
431 | char *pw_shell; /* Default CLI name (eg. DCL) */ |
432 | }; |
433 | #define pw_unixdir pw_comment /* Default device/directory (Unix-style) */ |
434 | #define getpwnam my_getpwnam |
435 | #define getpwuid my_getpwuid |
436 | #define getpwent my_getpwent |
437 | #define endpwent my_endpwent |
438 | #define setpwent my_endpwent |
439 | |
440 | /* Our own stat_t substitute, since we play with st_dev and st_ino - |
441 | * we want atomic types so Unix-bound code which compares these fields |
c07a80fd |
442 | * for two files will work most of the time under VMS. |
443 | * N.B. 1. The st_ino hack assumes that sizeof(unsigned short[3]) == |
444 | * sizeof(unsigned) + sizeof(unsigned short). We can't use a union type |
445 | * to map the unsigned int we want and the unsigned short[3] the CRTL |
446 | * returns into the same member, since gcc has different ideas than DECC |
447 | * and VAXC about sizing union types. |
448 | * N.B 2. The routine cando() in vms.c assumes that &stat.st_ino is the |
449 | * address of a FID. |
748a9306 |
450 | */ |
451 | /* First, grab the system types, so we don't clobber them later */ |
452 | #include <stat.h> |
453 | /* Since we've got to match the size of the CRTL's stat_t, we need |
454 | * to mimic DECC's alignment settings. |
455 | */ |
456 | #if defined(__DECC) || defined(__DECCXX) |
457 | # pragma __member_alignment __save |
458 | # pragma __nomember_alignment |
459 | #endif |
460 | #if defined(__DECC) |
461 | # pragma __message __save |
462 | # pragma __message disable (__MISALGNDSTRCT) |
463 | # pragma __message disable (__MISALGNDMEM) |
464 | #endif |
465 | struct mystat |
466 | { |
467 | char *st_devnam; /* pointer to device name */ |
c07a80fd |
468 | unsigned st_ino; /* hack - CRTL uses unsigned short[3] for */ |
469 | unsigned short rvn; /* FID (num,seq,rvn) */ |
748a9306 |
470 | unsigned short st_mode; /* file "mode" i.e. prot, dir, reg, etc. */ |
471 | int st_nlink; /* for compatibility - not really used */ |
472 | unsigned st_uid; /* from ACP - QIO uic field */ |
473 | unsigned short st_gid; /* group number extracted from st_uid */ |
474 | dev_t st_rdev; /* for compatibility - always zero */ |
475 | off_t st_size; /* file size in bytes */ |
476 | unsigned st_atime; /* file access time; always same as st_mtime */ |
477 | unsigned st_mtime; /* last modification time */ |
478 | unsigned st_ctime; /* file creation time */ |
479 | char st_fab_rfm; /* record format */ |
480 | char st_fab_rat; /* record attributes */ |
481 | char st_fab_fsz; /* fixed header size */ |
482 | unsigned st_dev; /* encoded device name */ |
483 | }; |
748a9306 |
484 | typedef unsigned mydev_t; |
c07a80fd |
485 | typedef unsigned myino_t; |
aa689395 |
486 | #ifndef DONT_MASK_RTL_CALLS /* defined for vms.c so we can see RTL calls */ |
487 | # ifdef stat |
488 | # undef stat |
489 | # endif |
490 | # define stat mystat |
491 | # define dev_t mydev_t |
492 | # define ino_t myino_t |
493 | #endif |
748a9306 |
494 | #if defined(__DECC) || defined(__DECCXX) |
495 | # pragma __member_alignment __restore |
496 | #endif |
497 | #if defined(__DECC) |
498 | # pragma __message __restore |
499 | #endif |
500 | /* Cons up a 'delete' bit for testing access */ |
501 | #define S_IDUSR (S_IWUSR | S_IXUSR) |
502 | #define S_IDGRP (S_IWGRP | S_IXGRP) |
503 | #define S_IDOTH (S_IWOTH | S_IXOTH) |
a0d0e21e |
504 | |
505 | /* Prototypes for functions unique to vms.c. Don't include replacements |
506 | * for routines in the mainline source files excluded by #ifndef VMS; |
507 | * their prototypes are already in proto.h. |
508 | * |
509 | * In order to keep Gen_ShrFls.Pl happy, functions which are to be made |
510 | * available to images linked to PerlShr.Exe must be declared between the |
511 | * __VMS_PROTOTYPES__ and __VMS_SEPYTOTORP__ lines, and must be in the form |
512 | * <data type><TAB>name<WHITESPACE>_((<prototype args>)); |
513 | */ |
94c456c4 |
514 | |
44a8e56a |
515 | #ifdef NO_PERL_TYPEDEFS |
516 | /* We don't have Perl typedefs available (e.g. when building a2p), so |
517 | we fake them here. N.B. There is *no* guarantee that the faked |
518 | prototypes will actually match the real routines. If you want to |
519 | call Perl routines, include perl.h to get the real typedefs. */ |
520 | # ifndef bool |
521 | # define bool int |
522 | # define __MY_BOOL_TYPE_FAKE |
523 | # endif |
524 | # ifndef I32 |
525 | # define I32 int |
526 | # define __MY_I32_TYPE_FAKE |
527 | # endif |
528 | # ifndef SV |
529 | # define SV void /* Since we only see SV * in prototypes */ |
530 | # define __MY_SV_TYPE_FAKE |
531 | # endif |
532 | #endif |
533 | |
94c456c4 |
534 | void prime_env_iter _((void)); |
94c456c4 |
535 | void init_os_extras _(()); |
c07a80fd |
536 | /* prototype section start marker; `typedef' passes through cpp */ |
537 | typedef char __VMS_PROTOTYPES__; |
538 | int my_trnlnm _((char *, char *, unsigned long int)); |
a0d0e21e |
539 | char * my_getenv _((char *)); |
c07a80fd |
540 | char * my_crypt _((const char *, const char *)); |
4fdae800 |
541 | Pid_t my_waitpid _((Pid_t, int *, int)); |
a0d0e21e |
542 | char * my_gconvert _((double, int, int, char *)); |
543 | int do_rmdir _((char *)); |
544 | int kill_file _((char *)); |
84902520 |
545 | int my_mkdir _((char *, Mode_t)); |
748a9306 |
546 | int my_utime _((char *, struct utimbuf *)); |
bbce6d69 |
547 | char * rmsexpand _((char *, char *, char *, unsigned)); |
548 | char * rmsexpand_ts _((char *, char *, char *, unsigned)); |
a0d0e21e |
549 | char * fileify_dirspec _((char *, char *)); |
550 | char * fileify_dirspec_ts _((char *, char *)); |
551 | char * pathify_dirspec _((char *, char *)); |
552 | char * pathify_dirspec_ts _((char *, char *)); |
553 | char * tounixspec _((char *, char *)); |
554 | char * tounixspec_ts _((char *, char *)); |
555 | char * tovmsspec _((char *, char *)); |
556 | char * tovmsspec_ts _((char *, char *)); |
557 | char * tounixpath _((char *, char *)); |
558 | char * tounixpath_ts _((char *, char *)); |
559 | char * tovmspath _((char *, char *)); |
560 | char * tovmspath_ts _((char *, char *)); |
84902520 |
561 | void vms_image_init _((int *, char ***)); |
a0d0e21e |
562 | DIR * opendir _((char *)); |
563 | struct dirent * readdir _((DIR *)); |
564 | long telldir _((DIR *)); |
565 | void seekdir _((DIR *, long)); |
566 | void closedir _((DIR *)); |
567 | void vmsreaddirversions _((DIR *, int)); |
7b62b82b |
568 | #ifdef my_gmtime |
ff0cee69 |
569 | struct tm * my_gmtime _((const time_t *)); |
570 | struct tm * my_localtime _((const time_t *)); |
571 | time_t my_time _((time_t *)); |
7b62b82b |
572 | #endif /* We're assuming these three come as a package */ |
5b411029 |
573 | /* We're just gonna assume that if we've got an antique here that we */ |
574 | /* need the signal functions */ |
575 | #if __VMS_VER < 70000000 || __DECC_VER < 50200000 |
576 | int my_sigemptyset _((sigset_t *)); |
577 | int my_sigfillset _((sigset_t *)); |
578 | int my_sigaddset _((sigset_t *, int)); |
579 | int my_sigdelset _((sigset_t *, int)); |
580 | int my_sigismember _((sigset_t *, int)); |
581 | int my_sigprocmask _((int, sigset_t *, sigset_t *)); |
582 | #endif |
748a9306 |
583 | I32 cando_by_name _((I32, I32, char *)); |
aa689395 |
584 | int flex_fstat _((int, struct mystat *)); |
585 | int flex_stat _((char *, struct mystat *)); |
f86702cc |
586 | int trim_unixpath _((char *, char*, int)); |
0414b1a0 |
587 | int my_vfork _(()); |
748a9306 |
588 | bool vms_do_aexec _((SV *, SV **, SV **)); |
a0d0e21e |
589 | bool vms_do_exec _((char *)); |
748a9306 |
590 | unsigned long int do_aspawn _((SV *, SV **, SV **)); |
a0d0e21e |
591 | unsigned long int do_spawn _((char *)); |
592 | int my_fwrite _((void *, size_t, size_t, FILE *)); |
d27fe803 |
593 | int my_flush _((FILE *)); |
0414b1a0 |
594 | FILE * my_binmode _((FILE *, char)); |
748a9306 |
595 | struct passwd * my_getpwnam _((char *name)); |
596 | struct passwd * my_getpwuid _((Uid_t uid)); |
597 | struct passwd * my_getpwent _(()); |
598 | void my_endpwent _(()); |
c07a80fd |
599 | char * my_getlogin _(()); |
bf109933 |
600 | int rmscopy _((char *, char *, int)); |
c07a80fd |
601 | typedef char __VMS_SEPYTOTORP__; |
602 | /* prototype section end marker; `typedef' passes through cpp */ |
a0d0e21e |
603 | |
44a8e56a |
604 | #ifdef NO_PERL_TYPEDEFS /* We'll try not to scramble later files */ |
605 | # ifdef __MY_BOOL_TYPE_FAKE |
606 | # undef bool |
607 | # undef __MY_BOOL_TYPE_FAKE |
608 | # endif |
609 | # ifdef __MY_I32_TYPE_FAKE |
610 | # undef I32 |
611 | # undef __MY_I32_TYPE_FAKE |
612 | # endif |
613 | # ifdef __MY_SV_TYPE_FAKE |
614 | # undef SV |
615 | # undef __MY_SV_TYPE_FAKE |
616 | # endif |
617 | #endif |
618 | |
a0d0e21e |
619 | #ifndef VMS_DO_SOCKETS |
748a9306 |
620 | /* This relies on tricks in perl.h to pick up that these manifest constants |
621 | * are undefined and set up conversion routines. It will then redefine |
622 | * these manifest constants, so the actual values will match config.h |
623 | */ |
624 | #undef HAS_HTONS |
625 | #undef HAS_NTOHS |
626 | #undef HAS_HTONL |
627 | #undef HAS_NTOHL |
a0d0e21e |
628 | #endif |
629 | |
482b294c |
630 | #define TMPPATH "sys$scratch:perl-eXXXXXX" |
631 | |
a0d0e21e |
632 | #endif /* __vmsish_h_included */ |