/*}}}*/
-/*{{{int my_mkdir(char *,mode_t)*/
+/*{{{int my_mkdir(char *,Mode_t)*/
int
-my_mkdir(char *dir, mode_t mode)
+my_mkdir(char *dir, Mode_t mode)
{
STRLEN dirlen = strlen(dir);
static void pipe_and_fork(char **cmargv);
/*{{{ void getredirection(int *ac, char ***av)*/
-void
+static void
getredirection(int *ac, char ***av)
/*
* Process vms redirection arg's. Exit if any error is seen.
/*}}}*/
/***** End of code taken from Mark Pizzolato's argproc.c package *****/
+
+/* OS-specific initialization at image activation (not thread startup) */
+/*{{{void vms_image_init(int *, char ***)*/
+void
+vms_image_init(int *argcp, char ***argvp)
+{
+ unsigned long int *mask, iosb[2], i;
+ unsigned short int dummy;
+ union prvdef iprv;
+ struct itmlst_3 jpilist[2] = { {sizeof iprv, JPI$_IMAGPRIV, &iprv, &dummy},
+ { 0, 0, 0, 0} };
+
+ _ckvmssts(sys$getjpiw(0,NULL,NULL,jpilist,iosb,NULL,NULL));
+ _ckvmssts(iosb[0]);
+ mask = (unsigned long int *) &iprv; /* Quick change of view */;
+ for (i = 0; i < (sizeof iprv + sizeof(unsigned long int) - 1) / sizeof(unsigned long int); i++) {
+ if (mask[i]) { /* Running image installed with privs? */
+ _ckvmssts(sys$setprv(0,&iprv,0,NULL)); /* Turn 'em off. */
+ tainting = TRUE;
+ break;
+ }
+ }
+ getredirection(argcp,argvp);
+ return;
+}
+/*}}}*/
+
+
/* trim_unixpath()
* Trim Unix-style prefix off filespec, so it looks like what a shell
* glob expansion would return (i.e. from specified prefix on, not
}
/*}}}*/
+#if __VMS_VER < 70000000 || __DECC_VER < 50200000
+/* Signal handling routines, pulled into the core from POSIX.xs.
+ *
+ * We need these for threads, so they've been rolled into the core,
+ * rather than left in POSIX.xs.
+ *
+ * (DRS, Oct 23, 1997)
+ */
+
+/* sigset_t is atomic under VMS, so these routines are easy */
+int my_sigemptyset(sigset_t *set) {
+ if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
+ *set = 0; return 0;
+}
+int my_sigfillset(sigset_t *set) {
+ int i;
+ if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
+ for (i = 0; i < NSIG; i++) *set |= (1 << i);
+ return 0;
+}
+int my_sigaddset(sigset_t *set, int sig) {
+ if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
+ if (sig > NSIG) { SETERRNO(EINVAL,LIB$_INVARG); return -1; }
+ *set |= (1 << (sig - 1));
+ return 0;
+}
+int my_sigdelset(sigset_t *set, int sig) {
+ if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
+ if (sig > NSIG) { SETERRNO(EINVAL,LIB$_INVARG); return -1; }
+ *set &= ~(1 << (sig - 1));
+ return 0;
+}
+int my_sigismember(sigset_t *set, int sig) {
+ if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
+ if (sig > NSIG) { SETERRNO(EINVAL,LIB$_INVARG); return -1; }
+ *set & (1 << (sig - 1));
+}
+int my_sigprocmask(int how, sigset_t *set, sigset_t *oset) {
+ sigset_t tempmask;
+
+ /* If set and oset are both null, then things are badky wrong. Bail */
+ if ((oset == NULL) && (set == NULL)) {
+ set_errno(EFAULT); set_vaxc_errno(SS$_ACCVIO);
+ return -1;
+ }
+
+ /* If set's null, then we're just handling a fetch. */
+ if (set == NULL) {
+ tempmask = sigblock(0);
+ } else {
+ switch (how) {
+ case SIG_SETMASK:
+ tempmask = sigsetmask(*set);
+ break;
+ case SIG_BLOCK:
+ tempmask = sigblock(*set);
+ break;
+ case SIG_UNBLOCK:
+ tempmask = sigblock(0);
+ sigsetmask(*oset & ~tempmask);
+ break;
+ default:
+ set_errno(EINVAL); set_vaxc_errno(LIB$_INVARG);
+ return -1;
+ }
+ }
+
+ /* Did they pass us an oset? If so, stick our holding mask into it */
+ if (oset)
+ *oset = tempmask;
+
+ return 0;
+}
/* Used for UTC calculation in my_gmtime(), my_localtime(), my_time(),
* my_utime(), and flex_stat(), all of which operate on UTC unless
#define localtime(t) my_localtime(t)
#define time(t) my_time(t)
+#endif /* VMS VER < 7.0 || Dec C < 5.2
/* my_utime - update modification time of a file
* calling sequence is identical to POSIX utime(), but under
*/
lowbit = (utimes->modtime & 1) ? secscale : 0;
unixtime = (long int) utimes->modtime;
-# ifdef VMSISH_TIME
+#if defined(VMSISH_TIME) && (__VMS_VER < 70000000 || __DECC_VER < 50200000)
if (!VMSISH_TIME) { /* Input was UTC; convert to local for sys svc */
if (!gmtime_emulation_type) (void) time(NULL); /* Initialize UTC */
unixtime += utc_offset_secs;
# else
if (1) {
# endif
+#if __VMS_VER < 70000000 || __DECC_VER < 50200000
if (!gmtime_emulation_type) (void)time(NULL);
statbufp->st_mtime -= utc_offset_secs;
statbufp->st_atime -= utc_offset_secs;
statbufp->st_ctime -= utc_offset_secs;
+#endif
}
return 0;
}
# else
if (1) {
# endif
+#if __VMS_VER < 70000000 || __DECC_VER < 50200000
if (!gmtime_emulation_type) (void)time(NULL);
statbufp->st_mtime -= utc_offset_secs;
statbufp->st_atime -= utc_offset_secs;
statbufp->st_ctime -= utc_offset_secs;
+#endif
}
}
return retval;