meissner@dg-rtp.dg.com (Michael Meissner) (12/05/89)
I sent this off to Larry, but thought others might be interested. This patch file contains the changes necessary to run perl 3.00 (patch level 6) under Data General's UNIX (DG/UX) which runs on our Motorola 88100 platform. I compiled it in revision 4.20 of DG/UX with the supplied GNU C compiler (revision 1.35). The changes below include: 1) Mapping getpgrp to getpgrp2 and setpgrp to setpgrp2 (DG/UX attempts to support both System V and Berkeley, but the different semantics of process groups required different kernel entry points). Note this is probably a hard spot for all System V systems, whose setpgrp takes no arguments. 2) Including the include file utime.h if it exists (the current standard for the 88100 specifies that utime takes a four word structure instead of the traditional two word structure). 3) Support was added to call strerror (from ANSI) if it exists, rather than using sys_errlist and sys_nerr. If mkdir and rmdir aren't supplied, it will still reference sys_errlist directly, as I was not sure what the intent of the code is. 4) I declared all of variables that GNU C complained were live across a call to setjmp as volatile if __STDC__ is defined (ANSI C says that local variables which are not declared volatile may be trashed when longjmp unwinds the stack). If this was not done, perl would segfault if it was optimized. 5) I fixed a call to signal in stab.c which passed a (int (*)()) pointer to signal, even if VOIDSIG was defined. 6) I also tried to fix all references to errno to support errno being a macro (which ANSI allows, but it is not a concern for DG/UX). I may have missed a few though. *** Configure.orig Mon Dec 4 19:08:03 1989 --- Configure Mon Dec 4 19:02:29 1989 *************** *** 1,5 **** --- 1,7 ---- #! /bin/sh # + # Changes made by Data General, December, 1989. + # # If these # comments don't work, trim them. Don't worry about any other # shell scripts, Configure will trim # comments from them for you. # *************** *** 115,120 **** --- 117,123 ---- d_getgrps='' d_gethent='' d_getpgrp='' + d_getpgrp2='' d_getprior='' d_htonl='' d_index='' *************** *** 132,137 **** --- 135,141 ---- d_setegid='' d_seteuid='' d_setpgrp='' + d_setpgrp2='' d_setprior='' d_setregid='' d_setresgid='' *************** *** 170,175 **** --- 174,180 ---- d_pwchange='' d_pwclass='' d_pwexpire='' + d_strerror='' i_sysdir='' i_sysioctl='' i_varargs='' *************** *** 208,213 **** --- 213,219 ---- defvoidused='' lib='' privlib='' + i_utime='' CONFIG='' : set package name package=perl *************** *** 245,251 **** attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc" attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX" attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386" ! attrlist="$attrlist i186" pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb" d_newshome="/usr/NeWS" defvoidused=7 --- 251,257 ---- attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc" attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX" attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386" ! attrlist="$attrlist i186 __m88k__ m88k DGUX __DGUX__" pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb" d_newshome="/usr/NeWS" defvoidused=7 *************** *** 1572,1577 **** --- 1578,1593 ---- echo "No dirent.h found." fi + : see if this is DG/UX with a funky utime.h + echo " " + if $test -r /usr/include/utime.h ; then + i_utime="$define" + echo "utime.h found." + else + i_utime="$undef" + echo "No utime.h found." + fi + : now see if they want to do setuid emulation case "$d_dosuid" in '') dflt=n;; *************** *** 1636,1641 **** --- 1652,1661 ---- set getpgrp d_getpgrp eval $inlibc + : see if getpgrp2 exists + set getpgrp2 d_getpgrp2 + eval $inlibc + : see if getpriority exists set getpriority d_getprior eval $inlibc *************** *** 1644,1649 **** --- 1664,1679 ---- set htonl d_htonl eval $inlibc + if $test "d_htonl" != "define"; then + if $test -r /usr/include/netinet/in.h ; then + if $contains htonl /usr/include/netinet/in.h >/dev/null 2>&1 ; then + d_htonl='define' + echo "htonl exists as a macro (must be big endian)" + fi + fi + fi + + : index or strcpy echo " " case "$d_index" in *************** *** 1792,1797 **** --- 1822,1831 ---- set setpgrp d_setpgrp eval $inlibc + : see if setpgrp2 exists + set setpgrp2 d_setpgrp2 + eval $inlibc + : see if setpriority exists set setpriority d_setprior eval $inlibc *************** *** 1923,1928 **** --- 1957,1966 ---- fi $rm -f try.* + : see if strerror exists + set strerror d_strerror + eval $inlibc + : see if symlink exists set symlink d_symlink eval $inlibc *************** *** 2439,2444 **** --- 2477,2483 ---- d_getgrps='$d_getgrps' d_gethent='$d_gethent' d_getpgrp='$d_getpgrp' + d_getpgrp2='$d_getpgrp2' d_getprior='$d_getprior' d_htonl='$d_htonl' d_index='$d_index' *************** *** 2456,2461 **** --- 2495,2501 ---- d_setegid='$d_setegid' d_seteuid='$d_seteuid' d_setpgrp='$d_setpgrp' + d_setpgrp2='$d_setpgrp2' d_setprior='$d_setprior' d_setregid='$d_setregid' d_setresgid='$d_setresgid' *************** *** 2476,2481 **** --- 2516,2522 ---- i_systime='$i_systime' i_timetoo='$i_timetoo' i_systimetoo='$i_systimetoo' + i_utime='$i_utime' d_varargs='$d_varargs' d_vfork='$d_vfork' d_voidsig='$d_voidsig' *************** *** 2496,2501 **** --- 2537,2543 ---- d_pwexpire='$d_pwexpire' i_sysdir='$i_sysdir' i_sysioctl='$i_sysioctl' + d_strerror='$d_strerror' i_varargs='$i_varargs' i_vfork='$i_vfork' intsize='$intsize' *** cmd.c.orig Mon Dec 4 19:08:05 1989 --- cmd.c Mon Dec 4 18:58:15 1989 *************** *** 1,3 **** --- 1,5 ---- + /* Changes made by Data General, December, 1989. */ + /* $Header: cmd.c,v 3.0.1.3 89/11/17 15:04:36 lwall Locked $ * * Copyright (c) 1989, Larry Wall *************** *** 32,37 **** --- 34,47 ---- void grow_dlevel(); + #ifdef __STDC__ + #define VOLATILE volatile + #define VREG + #else + #define VOLATILE + #define VREG register + #endif + /* This is the main command loop. We try to spend as much time in this loop * as possible, so lots of optimizations do their activities in here. This * means things get a little sloppy. *************** *** 47,66 **** int gimme; int sp; { ! SPAT *oldspat; ! int oldsave; int aryoptsave; #ifdef DEBUGGING ! int olddlevel; int entdlevel; #endif ! register STR *retstr = &str_undef; register char *tmps; ! register int cmdflags; ! register int match; ! register char *go_to = goto_targ; ! register int newsp = -2; ! register STR **st = stack->ary_array; FILE *fp; ARRAY *ar; --- 57,76 ---- int gimme; int sp; { ! SPAT *VOLATILE oldspat; ! VOLATILE int oldsave; int aryoptsave; #ifdef DEBUGGING ! VOLATILE int olddlevel; int entdlevel; #endif ! VREG STR *VOLATILE retstr = &str_undef; register char *tmps; ! VREG int VOLATILE cmdflags; ! VREG int VOLATILE match; ! VREG char *VOLATILE go_to = goto_targ; ! VREG int VOLATILE newsp = -2; ! VREG STR **VOLATILE st = stack->ary_array; FILE *fp; ARRAY *ar; *** config.h.SH.orig Mon Dec 4 19:08:06 1989 --- config.h.SH Mon Dec 4 19:02:59 1989 *************** *** 1,3 **** --- 1,6 ---- + + : Changes made by Data General, December, 1989. + case $CONFIG in '') if test ! -f config.sh; then *************** *** 167,172 **** --- 170,187 ---- */ #$d_getpgrp GETPGRP /**/ + /* GETPGRP2: + * This symbol, if defined, indicates that the getpgrp2() routine is + * available to get the current process group. + */ + #$d_getpgrp2 GETPGRP2 /**/ + + #ifdef GETPGRP2 + #ifndef GETPGRP + #define GETPGRP + #endif + #endif + /* GETPRIORITY: * This symbol, if defined, indicates that the getpriority() routine is * available to get a process's priority. *************** *** 294,299 **** --- 309,326 ---- */ #$d_setpgrp SETPGRP /**/ + /* SETPGRP2: + * This symbol, if defined, indicates that the setpgrp2() routine is + * available to set the current process group. + */ + #$d_setpgrp2 SETPGRP2 /**/ + + #ifdef SETPGRP2 + #ifndef SETPGRP + #define SETPGRP + #endif + #endif + /* SETPRIORITY: * This symbol, if defined, indicates that the setpriority() routine is * available to set a process's priority. *************** *** 379,384 **** --- 406,417 ---- */ #$d_symlink SYMLINK /**/ + /* STRERROR: + * This symbol, if defined, indicates that the ANSI standard function + * strerror is available to decode errno. + */ + #$d_strerror STRERROR /**/ + /* SYSCALL: * This symbol, if defined, indicates that the syscall routine is available * to call arbitrary system calls. If undefined, that's tough. *************** *** 406,411 **** --- 439,450 ---- #$i_systime I_SYSTIME /**/ #$i_timetoo I_TIMETOO /**/ #$i_systimetoo I_SYSTIMETOO /**/ + + /* I_UTIME: + * This symbol, if defined, indicates to the C program that it should + * include utime.h. + */ + #$i_utime I_UTIME /**/ /* VARARGS: * This symbol, if defined, indicates to the C program that it should *** doio.c.orig Mon Dec 4 19:08:08 1989 --- doio.c Mon Dec 4 19:03:27 1989 *************** *** 1,3 **** --- 1,5 ---- + /* Changes made by Data General, December, 1989. */ + /* $Header: doio.c,v 3.0.1.3 89/11/17 15:13:06 lwall Locked $ * * Copyright (c) 1989, Larry Wall *************** *** 43,48 **** --- 45,53 ---- #ifdef I_GRP #include <grp.h> #endif + #ifdef I_UTIME + #include <utime.h> + #endif extern int errno; *************** *** 1915,1927 **** taintproper("Insecure dependency in utime"); #endif if (items > 2) { struct { ! long atime, ! mtime; } utbuf; ! utbuf.atime = (long)str_gnum(st[++sp]); /* time accessed */ ! utbuf.mtime = (long)str_gnum(st[++sp]); /* time modified */ items -= 2; #ifndef lint tot = items; --- 1920,1940 ---- taintproper("Insecure dependency in utime"); #endif if (items > 2) { + #ifdef I_UTIME + struct utimbuf utbuf; + #else struct { ! long actime, ! modtime, ! acusec, /* not used in normal UNIX'es */ ! modusec; } utbuf; + #endif ! utbuf.actime = (long)str_gnum(st[++sp]); /* time accessed */ ! utbuf.modtime = (long)str_gnum(st[++sp]); /* time modified */ ! utbuf.acusec = 0; ! utbuf.modusec = 0; items -= 2; #ifndef lint tot = items; *** eval.c.orig Mon Dec 4 19:08:11 1989 --- eval.c Mon Dec 4 19:03:38 1989 *************** *** 1,3 **** --- 1,5 ---- + /* Changes made by Data General, December, 1989. */ + /* $Header: eval.c,v 3.0.1.2 89/11/17 15:19:34 lwall Locked $ * * Copyright (c) 1989, Larry Wall *************** *** 29,34 **** --- 31,44 ---- # include <vfork.h> #endif + #ifdef GETPGRP2 /* For DG/UX, which also supports the */ + #define getpgrp getpgrp2 /* system V getgrp without args. */ + #endif + + #ifdef SETPGRP2 /* For DG/UX, which also supports the */ + #define setpgrp setpgrp2 /* system V setpgrp without args. */ + #endif + extern int errno; #ifdef VOIDSIG *************** *** 49,57 **** double sin(), cos(), atan2(), pow(); char *getlogin(); ! ! extern int sys_nerr; ! extern char *sys_errlist[]; int eval(arg,gimme,sp) --- 59,65 ---- double sin(), cos(), atan2(), pow(); char *getlogin(); ! char *strerror(); int eval(arg,gimme,sp) *************** *** 1469,1474 **** --- 1477,1484 ---- (void)strcpy(tmps2," 2>&1"); rsfp = mypopen(buf,"r"); if (rsfp) { + extern int sys_nerr; + extern char *sys_errlist[]; *buf = '\0'; tmps2 = fgets(buf,sizeof buf,rsfp); (void)mypclose(rsfp); *** stab.c.orig Mon Dec 4 19:08:12 1989 --- stab.c Mon Dec 4 19:03:58 1989 *************** *** 1,3 **** --- 1,5 ---- + /* Changes made by Data General, December, 1989. */ + /* $Header: stab.c,v 3.0.1.2 89/11/17 15:35:37 lwall Locked $ * * Copyright (c) 1989, Larry Wall *************** *** 26,34 **** SIG_NAME,0 }; ! extern int errno; ! extern int sys_nerr; ! extern char *sys_errlist[]; STR * stab_str(str) --- 28,49 ---- SIG_NAME,0 }; ! #ifdef VOIDSIG ! #define sig_handler_type void ! #else ! #define sig_handler_type int ! #endif ! ! #include <errno.h> ! ! #ifndef errno ! extern int errno; /* ANSI allows errno to be an lvalue expr */ ! #endif ! ! static char *strerror_string; ! static int strerror_len; ! ! extern char *strerror(); STR * stab_str(str) *************** *** 142,150 **** str_set(stab_val(stab),ofmt); break; case '!': str_numset(stab_val(stab), (double)errno); ! str_set(stab_val(stab), ! errno < 0 || errno >= sys_nerr ? "(unknown)" : sys_errlist[errno]); stab_val(stab)->str_nok = 1; /* what a wonderful hack! */ break; case '<': --- 157,183 ---- str_set(stab_val(stab),ofmt); break; case '!': + #ifdef STRERROR str_numset(stab_val(stab), (double)errno); ! ! { /* error message string may be temporary under ANSI */ ! char *p = strerror(errno); ! int len = strlen(p); ! if (strerror_string == (char *)0) ! strerror_string = savestr(p); ! else if (len > strerror_len) { ! Renew(strerror_string,len,char); ! strcpy(strerror_string, p); ! } ! ! else strcpy(strerror_string, p); ! ! strerror_len = len; ! str_set(stab_val(stab), strerror_string); ! } ! #else ! str_set(stab_val(stab), strerror(errno)); ! #endif stab_val(stab)->str_nok = 1; /* what a wonderful hack! */ break; case '<': *************** *** 189,195 **** STAB *stab = mstr->str_u.str_stab; char *s; int i; ! static int sighandler(); switch (mstr->str_rare) { case 'E': --- 222,228 ---- STAB *stab = mstr->str_u.str_stab; char *s; int i; ! static sig_handler_type sighandler(); switch (mstr->str_rare) { case 'E': *************** *** 422,428 **** return 0; } ! static int sighandler(sig) int sig; { --- 455,461 ---- return 0; } ! static sig_handler_type sighandler(sig) int sig; { *** util.c.orig Mon Dec 4 19:08:14 1989 --- util.c Mon Dec 4 19:04:09 1989 *************** *** 1,3 **** --- 1,5 ---- + /* Changes made by Data General, December, 1989. */ + /* $Header: util.c,v 3.0.1.2 89/11/17 15:46:35 lwall Locked $ * * Copyright (c) 1989, Larry Wall *************** *** 1235,1237 **** --- 1237,1253 ---- return 0; } #endif /* MEMCMP */ + + #ifndef STRERROR + + extern int sys_nerr; + extern char *sys_errlist[]; + + char * + strerror (err) + int err; + { + return errno < 0 || errno >= sys_nerr ? "(unknown)" : sys_errlist[errno]); + } + #endif /* STRERROR */ + *** perl.h.orig Mon Dec 4 19:08:15 1989 --- perl.h Mon Dec 4 19:04:40 1989 *************** *** 1,3 **** --- 1,5 ---- + /* Changes made by Data General, December, 1989. */ + /* $Header: perl.h,v 3.0.1.3 89/11/17 15:28:57 lwall Locked $ * * Copyright (c) 1989, Larry Wall *************** *** 44,50 **** --- 46,58 ---- #endif #ifdef MEMCPY + #ifndef memcpy + #ifdef __STDC__ + extern void *memcpy(), *memset(); + #else extern char *memcpy(), *memset(); + #endif + #endif #define bcopy(s1,s2,l) memcpy(s2,s1,l) #define bzero(s,l) memset(s,0,l) #endif *** perly.c.orig Mon Dec 4 19:08:17 1989 --- perly.c Mon Dec 4 18:59:12 1989 *************** *** 1,3 **** --- 1,5 ---- + /* Changes made by Data General, December, 1989. */ + char rcsid[] = "$Header: perly.c,v 3.0.1.2 89/11/17 15:34:42 lwall Locked $\nPatch level: ###\n"; /* * Copyright (c) 1989, Larry Wall *************** *** 22,27 **** --- 24,31 ---- #include "perly.h" #include "patchlevel.h" + #include <errno.h> + #ifdef IAMSUID #ifndef DOSUID #define DOSUID *************** *** 292,299 **** else rsfp = fopen(argv[0],"r"); if (rsfp == Nullfp) { ! extern char *sys_errlist[]; extern int errno; #ifdef DOSUID #ifndef IAMSUID /* in case script is not readable before setuid */ --- 296,304 ---- else rsfp = fopen(argv[0],"r"); if (rsfp == Nullfp) { ! #ifndef errno extern int errno; + #endif #ifdef DOSUID #ifndef IAMSUID /* in case script is not readable before setuid */ *************** *** 306,312 **** #endif #endif fatal("Can't open perl script \"%s\": %s\n", ! filename, sys_errlist[errno]); } str_free(str); /* free -I directories */ --- 311,317 ---- #endif #endif fatal("Can't open perl script \"%s\": %s\n", ! filename, strerror(errno)); } str_free(str); /* free -I directories */ *************** *** 702,707 **** --- 707,718 ---- /* this routine is in perly.c by virtue of being sort of an alternate main() */ + #ifdef __STDC__ + #define VOLATILE volatile + #else + #define VOLATILE + #endif + int do_eval(str,optype,stash,gimme,arglast) STR *str; *************** *** 722,728 **** SPAT *oldspat = curspat; static char *last_eval = Nullch; static CMD *last_root = Nullcmd; ! int sp = arglast[0]; tmps_base = tmps_max; if (curstash != stash) { --- 733,739 ---- SPAT *oldspat = curspat; static char *last_eval = Nullch; static CMD *last_root = Nullcmd; ! int VOLATILE sp = arglast[0]; tmps_base = tmps_max; if (curstash != stash) { -- Michael Meissner, Data General. Until 12/15: meissner@dg-rtp.DG.COM After 12/15: meissner@osf.org