From: Jarkko Hietaniemi Date: Wed, 16 May 2001 13:00:12 +0000 (+0000) Subject: DG-UX threading patches, including a README.dgux, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8e9464f100f3a92c77a6886c84855b4d1f587e2d;p=p5sagit%2Fp5-mst-13.2.git DG-UX threading patches, including a README.dgux, from Takis Psarogiannakopoulos. p4raw-id: //depot/perl@10121 --- diff --git a/README.dgux b/README.dgux new file mode 100644 index 0000000..7ff0534 --- /dev/null +++ b/README.dgux @@ -0,0 +1,121 @@ +If you read this file _as_is_, just ignore the funny characters you +see. It is written in the POD format (see perlpod manpage) which is +specially designed to be readable as is. + +=head1 NAME + +perldgux - Perl under DG/UX. + +=head1 SYNOPSIS + +One can read this document in the following formats: + + man perldgux + view perl perldgux + explorer perldgux.html + info perldgux + +to list some (not all may be available simultaneously), or it may +be read I: as F. + +=cut + +Contents + + perldgux - Perl under DG/UX. + + NAME + SYNOPSIS + DESCRIPTION + BUILD + - Non-threaded Case + - Threaded Case + - Testing + - Installing the built perl + AUTHOR + SEE ALSO + +=head1 DESCRIPTION + +Perl 5.7/8.x for DG/UX ix86 R4.20MU0x + +=head1 BUILD + +=head2 Non-threaded Case + +Just run ./Configure script from the top directory. +Then give "make" to compile. + +=head2 Threaded Case + +If you are using as compiler GCC-2.95.x rev(DG/UX) +an easy solution for configuring perl in your DG/UX +machine is to run the command: + +./Configure -Dusethreads -Duse5005threads -des + +This will automatically accept all the defaults and +in particular /usr/local/ as installation directory. +Note that GCC-2.95.x rev(DG/UX) knows the switch +-pthread whcih allows it to link correctly DG/UX's +-lthread library. + +If you want to change the installtion directory or +have a standard DG/UX with C compiler GCC-2.7.2.x +then you have no choice than to do an interactive +build by issuing the command: + +./Configure -Dusethreads -Duse5005threads + +In particular with GCC-2.7.2.x accept all the defaults +and *watch* out for the message: + +==== +Any additional ld flags (NOT including libraries)? [ -pthread] +==== + +Instead of -pthread put here -lthread. CGCC-2.7.2.x +that comes with the DG/UX OS does NOT know the -pthread +switch. So your build will fail if you choose the defaults. +After configuration is done correctly give "make" to compile. + +=head2 Testing + +Issuing a "make test" will run all the tests. +If the test lib/ftmp-security gives you as a result +something like + +===== +lib/ftmp-security....File::Temp::_gettemp: +Parent directory (/tmp/) is not safe (sticky bit not set +when world writable?) at lib/ftmp-security.t line 100 +===== + +don't panic and just set the sticky bit in your /tmp +directory by doing the following as root: + +cd / +chmod +t /tmp (=set the sticky bit to /tmp). + +Then rerun the tests. This time all must be OK. + +=head2 Installing the built perl + +Run the command "make install" + +=head1 AUTHOR + +Takis Psarogiannakopoulos +Universirty of Cambridge +Centre for Mathematical Sciences +Department of Pure Mathematics +Wilberforce road +Cambridge CB3 0WB , UK +email + +=head1 SEE ALSO + +perl(1). + +=cut + diff --git a/config_h.SH b/config_h.SH index bc6b650..2ae994c 100644 --- a/config_h.SH +++ b/config_h.SH @@ -1064,6 +1064,14 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un */ #define OSNAME "$osname" /**/ +/* OSVERSION: + * + * This symbol contains the version of the operating system, as determined + * by Configure. You shouldn't rely on it too much; the specific + * feature tests from Configure are generally more reliable. + */ +#define OSVERSION "$osvers" /**/ + /* MEM_ALIGNBYTES: * This symbol contains the number of bytes required to align a * double, or a long double when applicable. Usual values are 2, diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs index cb2e395..c3b94eb 100644 --- a/ext/Thread/Thread.xs +++ b/ext/Thread/Thread.xs @@ -280,6 +280,10 @@ newthread (pTHX_ SV *startsv, AV *initargs, char *classname) attr_inited = 1; err = pthread_attr_init(&attr); # ifdef PTHREAD_ATTR_SETDETACHSTATE +#ifdef DGUX + if (err == 0) + err = pthread_attr_setstacksize(&attr, (1024*16)); +#endif if (err == 0) err = PTHREAD_ATTR_SETDETACHSTATE(&attr, attr_joinable); diff --git a/hints/dgux.sh b/hints/dgux.sh index 9a6f7a4..4f5e03e 100644 --- a/hints/dgux.sh +++ b/hints/dgux.sh @@ -1,7 +1,7 @@ -# $Id: dgux.sh,v 1.8 1996-11-29 18:16:43-05 roderick Exp $ +# $Id: dgux.sh,v 1.9 2001-05-07 00:06:00-05 Takis Exp $ -# This is a hints file for DGUX, which is Data General's Unix. It was -# originally developed with version 5.4.3.10 of the OS, and then was +# This is a hints file for DGUX, which is EMC's Data General's Unix. It +# was originally developed with version 5.4.3.10 of the OS, and then was # later updated running under version 4.11.2 (running on m88k hardware). # The gross features should work with versions going back to 2.nil but # some tweaking will probably be necessary. @@ -16,57 +16,76 @@ # # -Roderick Schertler -# Here are the things from some old DGUX hints files which are different -# from what's in here now. I don't know the exact reasons that most of -# these settings were in the hints files, presumably they can be chalked -# up to old Configure inadequacies and changes in the OS headers and the -# like. These settings might make a good place to start looking if you -# have problems. -# -# This was specified the the 4.036 hints file. That hints file didn't -# say what version of the OS it was developed using. -# -# cppstdin='/lib/cpp' -# -# The 4.036 and 5.001 hints files both contained these. The 5.001 hints -# file said it was developed with version 2.01 of DGUX. -# -# gidtype='gid_t' -# groupstype='gid_t' -# uidtype='uid_t' -# d_index='define' -# cc='gcc' -# -# These were peculiar to the 5.001 hints file. -# -# ccflags='-D_POSIX_SOURCE -D_DGUX_SOURCE' -# -# # an ugly hack, since the Configure test for "gcc -P -" hangs. -# # can't just use 'cppstdin', since our DG has a broken cppstdin :-( -# cppstdin=`cd ..; pwd`/cppstdin -# cpprun=`cd ..; pwd`/cppstdin -# -# One last note: The 5.001 hints file said "you don't want to use -# /usr/ucb/cc" in the place at which it set cc to gcc. That in -# particular baffles me, as I used to have 2.01 loaded and my memory -# is telling me that even then /usr/ucb was a symlink to /usr/bin. - - # The standard system compiler is gcc, but invoking it as cc changes its # behavior. I have to pick one name or the other so I can get the # dynamic loading switches right (they vary depending on this). I'm # picking gcc because there's no way to get at the optimization options # and so on when you call it cc. -case $cc in - '') - cc=gcc - case $optimize in - '') optimize=-O2;; - esac - ;; + +########################################## +# Modified by Takis Psarogiannakopoulos +# Universirty of Cambridge +# Centre for Mathematical Sciences +# Department of Pure Mathematics +# Wilberforce road +# Cambridge CB3 0WB , UK +# e-mail +# Use GCC-2.95.2/3 rev (DG/UX) for threads +# This compiler supports the -pthread switch +# to link correctly DG/UX 's -lthread. +########################################### + +cc=gcc +ccflags="-DDGUX -D_DGUX_SOURCE" +# Debug build with GNU as,ld and -gstabs+ +# ccflags="-DDGUX -D_DGUX_SOURCE -gstabs+" +# Dummy ; always compile with -O2 on GCC 2.95.2/3 rev (DG/UX) +optimize="-mno-legend -O2" + +archname="ix86-dgux" +libpth="/usr/lib" + +##################################### +# +# Change this if you want. +# prefix =/usr/local +##################################### + +prefix=/usr/local +perlpath="$prefix/bin/perl57" +startperl="#! $prefix/bin/perl57" +privlib="$prefix/lib/perl57" +man1dir="$prefix/man/man1" +man3dir="$prefix/man/man3" + +sitearch="$prefix/lib/perl57/$archname" +sitelib="$prefix/lib/perl57" + +#Do not overwrite by default /usr/bin/perl of DG/UX +installusrbinperl="$undef" + +# Configure may fail to find lstat() +# function in . +d_lstat=define + +# Internal malloc is needed for correct operation +# of perl-5.7.x +# DG/UX native malloc is causing problems. +# Some perl tests they failing badly. +# I have no time to investigate more. +# + +case "$usemymalloc" in +'') usemymalloc='y' ;; esac -usevfork=true +case "$uselongdouble" in +'') uselongdouble='y' ;; +esac + +#### No for threads ???? ##### +#usevfork=true +usevfork=false # DG has this thing set up with symlinks which point to different places # depending on environment variables (see elink(5)) and the compiler and @@ -117,20 +136,99 @@ done plibpth="$plibpth $sde_path/$sde/usr/lib" unset sde_path default_sde sde +##################################### +# +##################################### + +libperl="libperl57.so" + # Many functions (eg, gethostent(), killpg(), getpriority(), setruid() # dbm_*(), and plenty more) are defined in -ldgc. Usually you don't # need to know this (it seems that libdgc.so is searched automatically # by ld), but Configure needs to check it otherwise it will report all # those functions as missing. -libswanted="dgc $libswanted" + +##################################### +# +##################################### + +# libswanted="dgc gdbm $libswanted" +#libswanted="dbm posix $libswanted" +# Remove malloc since we use the internal perl one. +libswanted="dbm posix resolv socket nsl dl m" + +##################################### +# +##################################### + +mydomain='.localhost' +cf_by=`(whoami) 2>/dev/null` +cf_email="$cf_by@localhost" # Dynamic loading works using the dlopen() functions. Note that dlfcn.h # used to be broken, it declared _dl*() rather than dl*(). This was the # case up to 3.10, it has been fixed in 4.11. I'm not sure if it was # fixed in 4.10. If you have the older header just ignore the warnings # (since pointers and integers have the same format on m88k). -usedl=true + +# usedl=true +usedl=false + # For cc rather than gcc the flags would be `-K PIC' for compiling and # -G for loading. I haven't tested this. -cccdlflags=-fpic -lddlflags=-shared + +##################################### +# +# Use -fPIC instead -fpic +##################################### + +cccdlflags=-fPIC +#We must use gcc +ld="gcc" +lddlflags="-shared" + +############################################################################ +# DGUX Posix 4A Draft 10 Thread support +# +# use Configure -Dusethreads to enable +############################################################################ + +cat > UU/usethreads.cbu <<'EOCBU' +case "$usethreads" in +$define|true|[yY]*) + ccflags="$ccflags" + shift + # DG/UX's sched_yield is in -lrte + # Remove malloc since we use the internal perl one. + libswanted="dbm posix resolv socket nsl dl m rte" + archname="ix86-dgux-thread" + sitearch="$prefix/lib/perl57/$archname" + sitelib="$prefix/lib/perl57" + case "$cc" in + *gcc*) + #### Use GCC -2.95.2/3 rev (DG/UX) and -pthread + #### Otherwise take out the switch -pthread + #### And add manually the -D_POSIX4A_DRAFT10_SOURCE flag. + ld="gcc" + ccflags="$ccflags -D_POSIX4A_DRAFT10_SOURCE" + # Debug build : use -DS flag on command line perl + # ccflags="$ccflags -DDEBUGGING -D_POSIX4A_DRAFT10_SOURCE -pthread" + cccdlflags='-fPIC' + lddlflags="-shared" + #### Use GCC -2.95.2/3 rev (DG/UX) and -pthread + #### Otherwise take out the switch -pthread + #### And add manually the -lthread library. + ldflags="$ldflags -pthread" + ;; + + *) + echo "Not supported DG/UX cc and threads !" + ;; + esac +esac +EOCBU + +# "./Configure -d" can't figure this out easily +d_suidsafe='define' + +################################################### diff --git a/perl.c b/perl.c index 0151338..1b60d66 100644 --- a/perl.c +++ b/perl.c @@ -2287,9 +2287,22 @@ Perl_moreswitches(pTHX_ char *s) s++; return s; case 'v': +#if !defined(DGUX) PerlIO_printf(PerlIO_stdout(), Perl_form(aTHX_ "\nThis is perl, v%"VDf" built for %s", PL_patchlevel, ARCHNAME)); +#else /* DGUX */ +/* Adjust verbose output as in the perl that ships with the DG/UX OS from EMC */ + PerlIO_printf(PerlIO_stdout(), + Perl_form(aTHX_ "\nThis is perl, version %vd\n", PL_patchlevel)); + PerlIO_printf(PerlIO_stdout(), + Perl_form(aTHX_ " built under %s at %s %s\n", + OSNAME, __DATE__, __TIME__)); + PerlIO_printf(PerlIO_stdout(), + Perl_form(aTHX_ " OS Specific Release: %s\n", + OSVERSION)); +#endif /* !DGUX */ + #if defined(LOCAL_PATCH_COUNT) if (LOCAL_PATCH_COUNT > 0) PerlIO_printf(PerlIO_stdout(),