From 05954a8b9f14e33d62acd061f4cdda5f0cfd0ec0 Mon Sep 17 00:00:00 2001 From: Paul Green Date: Fri, 4 Nov 2011 15:19:28 -0400 Subject: [PATCH] Build perl using the dynamic linking capabilities of OpenVOS Release 17.1. Remove private copies of some POSIX functions that are now implemented by OpenVOS. --- hints/vos.sh | 118 +++++++---------------------- vos/syslog.h | 75 ------------------- vos/vos.c | 241 +---------------------------------------------------------- vos/vosish.h | 6 -- 4 files changed, 27 insertions(+), 413 deletions(-) delete mode 100644 vos/syslog.h diff --git a/hints/vos.sh b/hints/vos.sh index f08ba0b..0a3a677 100644 --- a/hints/vos.sh +++ b/hints/vos.sh @@ -1,54 +1,48 @@ -# $Id: vos.sh,v 1.0 2001-12-11 09:30:00-05 Green Exp $ - -# This is a hints file for Stratus VOS, using the POSIX environment -# in VOS 14.4.0 and higher. +# This is a hints file for Stratus OpenVOS, using the POSIX environment +# found in VOS 17.1.0 and higher. # -# VOS POSIX is based on POSIX.1-1996 and contains elements of +# OpenVOS POSIX is based on POSIX.1-1996 and contains elements of # POSIX.1-2001. It ships with gcc as the standard compiler. # # Paul Green (Paul.Green@stratus.com) # C compiler and default options. cc=gcc -ccflags="-D_SVID_SOURCE -D_POSIX_C_SOURCE=200112L -D_VOS_EXTENDED_NAMES" +ccflags="-D_XOPEN_SOURCE=700 -D_VOS_EXTENDED_NAMES" +ccdlflags="-Wl,-rpath,$shrpdir" +cccdlflags="-fPIC" # Make command. make="/system/gnu_library/bin/gmake" # indented to not put it into config.sh _make="/system/gnu_library/bin/gmake" -# Architecture name -if test `uname -m` = i786; then - archname="i786" -else - archname="hppa1.1" +# Check for the minimum acceptable release of OpenVOS (17.1.0). +if test `uname -r | sed -e 's/OpenVOS Release //' -e 's/VOS Release //'` \< "17.1.0"; then +cat >&4 < UU/cc.cbu <<'EOCBU' -# This script UU/cc.cbu will get 'called-back' by Configure after it -# has prompted the user for the C compiler to use. - -# Compile and run the a test case to see if bug gnu_g++-220 is -# present. If so, lower the optimization level when compiling -# pp_pack.c. This works around a bug in unpack. - -echo " " -echo "Testing whether bug gnu_g++-220 is fixed in your compiler..." - -# Try compiling the test case. -if $cc -o t001 -O $ccflags $ldflags ../hints/t001.c; then - gccbug=`$run ./t001` - if [ "X$gccversion" = "X" ]; then - # Done too late in Configure if hinted - gccversion=`$cc -dumpversion` - fi - case "$gccbug" in - *fails*) cat >&4 <> config.sh ;; - *) echo "You specified pp_pack_cflags yourself, so we'll go with your value." >&4 ;; - esac - ;; - *) echo "Your compiler is ok." >&4 - ;; - esac -else - echo " " - echo "*** WHOA THERE!!! ***" >&4 - echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4 - case "$knowitall" in - '') - echo " You'd better start hunting for one and let me know about it." >&4 - exit 1 - ;; - esac -fi - -$rm -f t001$_o t001$_exe t001.kp -EOCBU - - -# VOS 14.7 has minimal support for dynamic linking. Too minimal for perl. -usedl="undef" diff --git a/vos/syslog.h b/vos/syslog.h deleted file mode 100644 index 1916fc1..0000000 --- a/vos/syslog.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Beginning of modification history */ -/* Written 02-08-13 by PG */ -/* End of modification history */ - -/* This header conforms to IEEE Std 1003.1-2001 */ - -#ifndef _INCLUDED_SYSLOG_H -#define _INCLUDED_SYSLOG_H - -/* values of the "logopt" option of openlog */ - -#define LOG_PID 1 -#define LOG_CONS 2 -#define LOG_NDELAY 4 -#define LOG_ODELAY 8 -#define LOG_NOWAIT 16 - -/* values of the "facility" argument of openlog - and of the "priority" argument of syslog */ - -#define LOG_KERN 0 -#define LOG_USER (1<<3) -#define LOG_MAIL (2<<3) -#define LOG_NEWS (3<<3) -#define LOG_UUCP (4<<3) -#define LOG_DAEMON (5<<3) -#define LOG_AUTH (6<<3) -#define LOG_CRON (7<<3) -#define LOG_LPR (8<<3) -#define LOG_LOCAL0 (9<<3) -#define LOG_LOCAL1 (10<<3) -#define LOG_LOCAL2 (11<<3) -#define LOG_LOCAL3 (12<<3) -#define LOG_LOCAL4 (13<<3) -#define LOG_LOCAL5 (14<<3) -#define LOG_LOCAL6 (15<<3) -#define LOG_LOCAL7 (16<<3) - -/* macro for constructing "maskpri" arg to setlogmask */ - -#define LOG_MASK(p) (1 << (p)) - -/* values of the "priority" argument of syslog */ - -#define LOG_EMERG 0 -#define LOG_ALERT 1 -#define LOG_CRIT 2 -#define LOG_ERR 3 -#define LOG_WARNING 4 -#define LOG_NOTICE 5 -#define LOG_INFO 6 -#define LOG_DEBUG 7 - -#undef __P -#ifdef __PROTOTYPES__ -#define __P(args) args -#else -#define __P(args) () -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -extern void closelog __P((void)); -extern void openlog __P((const char *ident, int logopt, - int facility)); -extern int setlogmask __P((int maskpri)); -extern void syslog __P((int priority, const char * message, ...)); - -#ifdef __cplusplus -} -#endif - -#endif /* _INCLUDED_SYSLOG_H */ diff --git a/vos/vos.c b/vos/vos.c index 612b693..0b3c334 100644 --- a/vos/vos.c +++ b/vos/vos.c @@ -8,6 +8,8 @@ add syslog entries. */ /* Modified 08-02-04 by Paul Green (Paul.Green@stratus.com) to open the syslog file in the working dir. */ +/* Modified 11-10-17 by Paul Green to remove the dummy copies + of socketpair() and the syslog functions. */ /* End of modification history */ #include @@ -18,8 +20,6 @@ #include #include -#include "vos/syslog.h" - /* VOS doesn't supply a truncate function, so we build one up from the available POSIX functions. */ @@ -35,18 +35,6 @@ truncate(const char *path, off_t len) return code; } -/* VOS doesn't implement AF_UNIX (AF_LOCAL) style sockets, and - the perl emulation of them hangs on VOS (due to stcp-1257), - so we supply this version that always fails. */ - -int -socketpair (int family, int type, int protocol, int fd[2]) { - fd[0] = 0; - fd[1] = 0; - errno = ENOSYS; - return -1; -} - /* Supply a private version of the power function that returns 1 for x**0. This avoids c-1471. Abigail's Japh tests depend on this fix. We leave all the other cases to the VOS C @@ -65,228 +53,3 @@ double x, y; return(s_crt_pow(&x,&y)); } - -/* entries */ - -extern void s$log_system_message ( -/* char_varying (256) *message_text, - char_varying (66) *module_name, - short int *error_code */ ); - -/* constants */ - -#define ALL_PRIORITIES 255 /* 8 priorities, all enabled */ -#define BUFFER_LEN 256 -#define IDENT_LEN 64 -#define MSG_LEN 256 -#define PATH_LEN 257 - -/* static */ - -int vos_syslog_facility = LOG_USER>>3; -int vos_syslog_fd = -1; -int vos_syslog_logopt = 0; -char vos_syslog_ident[IDENT_LEN] = ""; -int vos_syslog_ident_len = 0; -int vos_syslog_mask = ALL_PRIORITIES; -char vos_syslog_path[PATH_LEN] = "syslog"; - -char vos_syslog_facility_name [17][10] = { - "[KERN] ", /* LOG_KERN */ - "[USER] ", /* LOG_USER */ - "[MAIL] ", /* LOG_MAIL */ - "[NEWS] ", /* LOG_NEWS */ - "[UUCP] ", /* LOG_UUCP */ - "[DAEMON] ", /* LOG_DAEMON */ - "[AUTH] ", /* LOG_AUTH */ - "[CRON] ", /* LOG_CRON */ - "[LPR] ", /* LOG_LPR */ - "[LOCAL0] ", /* LOG_LOCAL0 */ - "[LOCAL1] ", /* LOG_LOCAL1 */ - "[LOCAL2] ", /* LOG_LOCAL2 */ - "[LOCAL3] ", /* LOG_LOCAL3 */ - "[LOCAL4] ", /* LOG_LOCAL4 */ - "[LOCAL5] ", /* LOG_LOCAL5 */ - "[LOCAL6] ", /* LOG_LOCAL6 */ - "[LOCAL7] "}; /* LOG_LOCAL7 */ - -/* syslog functions */ - -static void open_syslog (void) -{ - if (vos_syslog_fd >= 0) - return; - - vos_syslog_fd = open (vos_syslog_path, O_RDWR | O_CREAT | O_APPEND, 0777); - if (vos_syslog_fd < 0) - fprintf (stderr, "Unable to open %s (errno=%d, os_errno=%d)\n", - vos_syslog_path, errno, os_errno); -} - -void closelog (void) -{ - if (vos_syslog_fd >= 0) - close (vos_syslog_fd); - - vos_syslog_facility = LOG_USER>>3; - vos_syslog_fd = -1; - vos_syslog_logopt = 0; - vos_syslog_ident[0] = '\0'; - vos_syslog_ident_len = 0; - vos_syslog_mask = ALL_PRIORITIES; - return; -} - -void openlog (const char *ident, int logopt, int facility) -{ -int n; - - if (ident != NULL) - { - strncpy (vos_syslog_ident, ident, sizeof (vos_syslog_ident)); - n = IDENT_LEN - - strnlen (vos_syslog_ident, sizeof (vos_syslog_ident)); - strncat (vos_syslog_ident, ": ", n); - vos_syslog_ident_len = strnlen (vos_syslog_ident, - sizeof (vos_syslog_ident)); - } - - vos_syslog_logopt = logopt; - vos_syslog_facility = facility>>3; - - if ((logopt & LOG_NDELAY) == LOG_NDELAY) - open_syslog (); - - return; -} - -int setlogmask (int maskpri) -{ -int old_mask; - - old_mask = vos_syslog_mask; - - if (maskpri > 0) - vos_syslog_mask = maskpri; - - return old_mask; -} - -void syslog (int priority, const char *format, ...) -{ -va_list ap; -int bare_facility; -int bare_priority; -int buffer_n; -char buffer[BUFFER_LEN]; -short int code; -char_varying(MSG_LEN) message; -char_varying(66) module_name; -int n; -int pid_n; -char pid_string[32]; -int r; -int user_n; -char user_string[256]; - - /* Calculate priority and facility value. */ - - bare_priority = priority & 3; - bare_facility = priority >> 3; - - /* If the priority is not set in the mask, do not log the - message. */ - - if ((vos_syslog_mask & LOG_MASK(bare_priority)) == 0) - return; - - /* Output facility name. */ - - if (bare_facility == 0) - bare_facility = vos_syslog_facility; - - strcpy (buffer, vos_syslog_facility_name[bare_facility]); - - /* Output priority value. */ - - /* TBD */ - - /* Output identity string. */ - - buffer_n = BUFFER_LEN - strlen (buffer); - strncat (buffer, vos_syslog_ident, buffer_n); - - /* Output process ID. */ - - if ((vos_syslog_logopt & LOG_PID) == LOG_PID) - { - pid_n = snprintf (pid_string, sizeof (pid_string), - "PID=0x%x ", getpid ()); - if (pid_n) - { - buffer_n = BUFFER_LEN - strlen (buffer); - strncat (buffer, pid_string, buffer_n); - } - } - - /* Output formatted message. */ - - va_start (ap, format); - user_n = vsnprintf (user_string, sizeof (user_string), format, ap); - va_end (ap); - - /* Ensure string ends in a newline. */ - - if (user_n > 0) - { - if (user_n >= sizeof (user_string)) - user_n = sizeof (user_string) - 1; - - /* arrays are zero-origin.... */ - - if (user_string [user_n-1] != '\n') - { - user_string [user_n-1] = '\n'; - user_string [user_n++] = '\0'; - } - } - else - { - user_string [0] = '\n'; - user_string [1] = '\0'; - user_n = 1; - } - - buffer_n = BUFFER_LEN - strnlen (buffer, sizeof (buffer)); - strncat (buffer, user_string, buffer_n); - - /* If the log is not open, try to open it now. */ - - if (vos_syslog_fd < 0) - open_syslog (); - - /* Try to write the message to the syslog file. */ - - if (vos_syslog_fd < 0) - r = -1; - else - { - buffer_n = strnlen (buffer, sizeof (buffer)); - r = write (vos_syslog_fd, buffer, buffer_n); - } - - /* If we were unable to write to the log and if LOG_CONS is - set, send it to the console. */ - - if (r < 0) - if ((vos_syslog_logopt & LOG_CONS) == LOG_CONS) - { - strcpy_vstr_nstr (&message, "syslog: "); - n = MSG_LEN - sizeof ("syslog: "); - strncat_vstr_nstr (&message, buffer, n); - strcpy_vstr_nstr (&module_name, ""); - s$log_system_message (&message, &module_name, &code); - } - - return; -} diff --git a/vos/vosish.h b/vos/vosish.h index c9e3765..36b3b41 100644 --- a/vos/vosish.h +++ b/vos/vosish.h @@ -8,11 +8,5 @@ is a work-around for posix-1302. */ #undef SA_SIGINFO -/* The following declaration is an avoidance for posix-950. */ -extern int ioctl (int fd, int request, ...); - /* Specify a prototype for truncate() since we are supplying one. */ extern int truncate (const char *path, off_t len); - -/* Specify a prototype for socketpair() since we supplying one. */ -extern int socketpair (int family, int type, int protocol, int fd[2]); -- 2.7.4