From 1cfa4ec74d4933da0d98282eed6171cc7ac307b6 Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Thu, 15 Oct 1998 03:09:58 +0000 Subject: [PATCH] check in all confperl changes as of change#1964 into cfgperl p4raw-link: @1964 on //depot/confperl: 2d85315bb227e0962a693eaaadc3f40ca2fbf49b p4raw-id: //depot/cfgperl@1971 --- Configure | 156 +++++++++++++++++++++++++++++----------- MANIFEST | 1 + Makefile.SH | 1 + config_h.SH | 53 +++++++------- ext/DynaLoader/dl_vmesa.xs | 173 +++++++++++++++++++++++++++++++++++++++++++++ ext/Thread/Thread.xs | 21 ++++-- gv.c | 5 +- hints/hpux.sh | 22 ++---- hints/irix_6.sh | 2 +- hints/linux.sh | 21 ++++++ hints/os390.sh | 3 + op.c | 5 +- thread.h | 40 +++++------ x2p/Makefile.SH | 3 +- 14 files changed, 386 insertions(+), 120 deletions(-) create mode 100644 ext/DynaLoader/dl_vmesa.xs diff --git a/Configure b/Configure index de6c3d2..450c8a6 100755 --- a/Configure +++ b/Configure @@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $ # -# Generated on Wed Sep 30 02:04:24 EET DST 1998 [metaconfig 3.0 PL70] +# Generated on Wed Oct 14 17:00:29 EET DST 1998 [metaconfig 3.0 PL70] # (with additional metaconfig patches by jhi@iki.fi) cat >/tmp/c1$$ <testcpp.c ABC.XYZ EOT cd .. -echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin +if test ! -f cppstdin; then + echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin +else + echo "Keeping your $hint cppstdin wrapper." +fi chmod 755 cppstdin wrapper=`pwd`/cppstdin ok='false' @@ -3822,7 +3830,8 @@ case "$libswanted" in esac for thislib in $libswanted; do - if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then + if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; + $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then echo "Found -l$thislib (shared)." case " $dflt " in *"-l$thislib "*);; @@ -8151,42 +8160,6 @@ eval $inlibc set poll d_poll eval $inlibc - -: see whether the various POSIXish _yields exist within given cccmd -$cat >try.c < -main() { - YIELD(); - exit(0); -} -EOP -: see if pthread_yield exists within given cccmd, -: if we do not usethreads this may well end up undef. -set try -DYIELD=pthread_yield -if eval $compile; then - val="$define" - echo 'pthread_yield() found.' >&4 -else - val="$undef" - echo 'pthread_yield() NOT found.' >&4 -fi -set d_pthread_yield -eval $setvar - -: see if sched_yield exists within given cccmd, -: if we do not usethreads this may well end up undef. -set try -DYIELD=sched_yield -if eval $compile; then - val="$define" - echo 'sched_yield() found.' >&4 -else - val="$undef" - echo 'sched_yield() NOT found.' >&4 -fi -set d_sched_yield -eval $setvar -$rm -f try try.* - : test whether pthreads are created in joinable -- aka undetached -- state if test "X$usethreads" = "X$define"; then echo $n "Checking whether pthreads are created joinable. $c" >&4 @@ -10552,6 +10525,37 @@ rp="What is the type of process ids on this system?" set pid_t pidtype int stdio.h sys/types.h eval $typedef_ask + +: see whether the state of pthread_attr_setdetachstate is an int pointer +$cat >try.c < +main() { + pthread_attr_t attr; + int state = 0; + pthread_attr_init(&attr); +#ifdef POINTER + pthread_attr_setdetachstate(&attr, &state); +#else + pthread_attr_setdetachstate(&attr, state); +#endif +} +EOP +set try +if eval $compile; then + val="$undef" +else + set try -DPOINTER + if eval $compile; then + val="$define" + else + val="$undef" + fi +fi +set pthread_setdetachstate_pointer +eval $setvar + +$rm -f try try.* + : check for length of pointer echo " " case "$ptrsize" in @@ -10628,6 +10632,69 @@ else fi $rm -f foo* bar* + +: see whether the various POSIXish _yields exist within given cccmd +$cat >try.c < +#include +main() { +#ifdef SCHED_YIELD + sched_yield(); +#else +#ifdef PTHREAD_YIELD + pthread_yield(); +#else +#ifdef PTHREAD_YIELD_NULL + pthread_yield(NULL); +#endif +#endif +#endif +} +EOP +: see if sched_yield exists +set try -DSCHED_YIELD +if eval $compile; then + val="$define" + echo 'sched_yield() found.' >&4 + sched_yield='sched_yield()' +else + val="$undef" + echo 'sched_yield() NOT found.' >&4 +fi +set d_sched_yield +eval $setvar + +: see if pthread_yield exists +set try -DPTHREAD_YIELD +if eval $compile; then + val="$define" + case "$sched_yield" in + '') sched_yield='pthread_yield()' ;; + esac +else + set try -DPTHREAD_YIELD_NULL + if eval $compile; then + val="$define" + case "$sched_yield" in + '') sched_yield='pthread_yield(NULL)' ;; + esac + else + val="$undef" + fi +fi +case "$val" in +$define) echo 'pthread_yield() found.' >&4 ;; +*) echo 'pthread_yield() NOT found.' >&4 ;; +esac +set d_pthread_yield +eval $setvar + +case "$sched_yield" in +'') sched_yield=undef ;; +esac + +$rm -f try try.* + : see if sys/select.h has to be included set sys/select.h i_sysselct eval $inhdr @@ -10804,8 +10871,8 @@ EOM : The first arg can be int, unsigned, or size_t : The last arg may or may not be 'const' val='' - for xxx in 'fd_set *' 'int *'; do - for nfd in 'int' 'size_t' 'unsigned' ; do + for xxx in 'fd_set *' 'int *' 'void *'; do + for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do for tmo in 'struct timeval *' 'const struct timeval *'; do case "$val" in '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));" @@ -12469,6 +12536,7 @@ i_values='$i_values' i_varargs='$i_varargs' i_varhdr='$i_varhdr' i_vfork='$i_vfork' +ignore_versioned_solibs='$ignore_versioned_solibs' incpath='$incpath' inews='$inews' installarchlib='$installarchlib' @@ -12568,6 +12636,7 @@ prefixexp='$prefixexp' privlib='$privlib' privlibexp='$privlibexp' prototype='$prototype' +pthread_setdetachstate_pointer='$pthread_setdetachstate_pointer' ptrsize='$ptrsize' randbits='$randbits' randfunc='$randfunc' @@ -12577,6 +12646,7 @@ rd_nodata='$rd_nodata' rm='$rm' rmail='$rmail' runnm='$runnm' +sched_yield='$sched_yield' scriptdir='$scriptdir' scriptdirexp='$scriptdirexp' sed='$sed' diff --git a/MANIFEST b/MANIFEST index a2d35e9..600c73d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -206,6 +206,7 @@ ext/DynaLoader/dl_mpeix.xs MPE/iX implementation ext/DynaLoader/dl_next.xs Next implementation ext/DynaLoader/dl_none.xs Stub implementation ext/DynaLoader/dl_vms.xs VMS implementation +ext/DynaLoader/dl_vmesa.xs VM/ESA implementation ext/DynaLoader/dlutils.c Dynamic loader utilities for dl_*.xs files ext/Errno/ChangeLog Errno perl module change log ext/Errno/Errno_pm.PL Errno perl module create script diff --git a/Makefile.SH b/Makefile.SH index d39934f..f1035a1 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -513,6 +513,7 @@ _mopup: rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c rm -f perl.exp ext.libs -rm -f perl.export perl.dll perl.libexp perl.map perl.def + -rm -f perl.loadmap miniperl.loadmap perl.prelmap miniperl.prelmap rm -f perl suidperl miniperl $(LIBPERL) # Do not 'make _tidy' directly. diff --git a/config_h.SH b/config_h.SH index a8da853..5dc8c3f 100644 --- a/config_h.SH +++ b/config_h.SH @@ -55,21 +55,6 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- #define BIN "$bin" /**/ #define BIN_EXP "$binexp" /**/ -/* CPPSTDIN: - * This symbol contains the first part of the string which will invoke - * the C preprocessor on the standard input and produce to standard - * output. Typical value of "cc -E" or "/lib/cpp", but it can also - * call a wrapper. See CPPRUN. - */ -/* CPPMINUS: - * This symbol contains the second part of the string which will invoke - * the C preprocessor on the standard input and produce to standard - * output. This symbol will have the value "-" if CPPSTDIN needs a minus - * to specify standard input, otherwise the value is "". - */ -#define CPPSTDIN "$cppstdin" -#define CPPMINUS "$cppminus" - /* HAS_ALARM: * This symbol, if defined, indicates that the alarm routine is * available. @@ -1429,6 +1414,21 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- #include "Bletch: How does this C preprocessor catenate tokens?" #endif +/* CPPSTDIN: + * This symbol contains the first part of the string which will invoke + * the C preprocessor on the standard input and produce to standard + * output. Typical value of "cc -E" or "/lib/cpp", but it can also + * call a wrapper. See CPPRUN. + */ +/* CPPMINUS: + * This symbol contains the second part of the string which will invoke + * the C preprocessor on the standard input and produce to standard + * output. This symbol will have the value "-" if CPPSTDIN needs a minus + * to specify standard input, otherwise the value is "". + */ +#define CPPSTDIN "$cppstdin" +#define CPPMINUS "$cppminus" + /* HAS_ACCESS: * This manifest constant lets the C program know that the access() * system call is available to check for accessibility using real UID/GID. @@ -2267,18 +2267,12 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #define ARCHNAME "$archname" /**/ -/* HAS_PTHREAD_YIELD: - * This symbol, if defined, indicates that the pthread_yield - * routine is available to yield the execution of the current - * thread. - */ -/* HAS_SCHED_YIELD: - * This symbol, if defined, indicates that the sched_yield - * routine is available to yield the execution of the current - * thread. +/* SCHED_YIELD: + * This symbol defines the way to yield the execution of + * the current thread. Known ways are sched_yield, + * pthread_yield, and pthread_yield with NULL. */ -#$d_pthread_yield HAS_PTHREAD_YIELD /**/ -#$d_sched_yield HAS_SCHED_YIELD /**/ +#define SCHED_YIELD $sched_yield /**/ /* PTHREADS_CREATED_JOINABLE: * This symbol, if defined, indicates that pthreads are created @@ -2286,6 +2280,13 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #$d_pthreads_created_joinable PTHREADS_CREATED_JOINABLE /**/ +/* PTHREAD_SETDETACHSTATE_POINTER: + * This symbol, if defined, indicates that the second argument of + * pthread_attr_setdetachstate is a pointer to an int, as opposed + * to an int. + */ +#$pthread_setdetachstate_pointer PTHREAD_SETDETACHSTATE_POINTER /**/ + /* MULTIPLICITY: * This symbol, if defined, indicates that Perl should * be built to use multiplicity. diff --git a/ext/DynaLoader/dl_vmesa.xs b/ext/DynaLoader/dl_vmesa.xs new file mode 100644 index 0000000..34d4ddd --- /dev/null +++ b/ext/DynaLoader/dl_vmesa.xs @@ -0,0 +1,173 @@ +/* dl_vmesa.xs + * + * Platform: VM/ESA, possibly others which use dllload etc. + * Author: Neale Ferguson (neale@mailbox.tabnsw.com.au) + * Created: 23rd Septemer, 1998 + * + * + */ + +/* Porting notes: + + + Definition of VM/ESA dynamic Linking functions + ============================================== + In order to make this implementation easier to understand here is a + quick definition of the VM/ESA Dynamic Linking functions which are + used here. + + dlopen + ------ + void * + dlopen(const char *path) + + This function takes the name of a dynamic object file and returns + a descriptor which can be used by dlsym later. It returns NULL on + error. + + + dllsym + ------ + void * + dlsym(void *handle, char *symbol) + + Takes the handle returned from dlopen and the name of a symbol to + get the address of. If the symbol was found a pointer is + returned. It returns NULL on error. + + dlerror + ------- + char * dlerror() + + Returns a null-terminated string which describes the last error + that occurred with the other dll functions. After each call to + dlerror the error message will be reset to a null pointer. The + SaveError function is used to save the error as soo as it happens. + + + Return Types + ============ + In this implementation the two functions, dl_load_file & + dl_find_symbol, return void *. This is because the underlying SunOS + dynamic linker calls also return void *. This is not necessarily + the case for all architectures. For example, some implementation + will want to return a char * for dl_load_file. + + If void * is not appropriate for your architecture, you will have to + change the void * to whatever you require. If you are not certain of + how Perl handles C data types, I suggest you start by consulting + Dean Roerich's Perl 5 API document. Also, have a look in the typemap + file (in the ext directory) for a fairly comprehensive list of types + that are already supported. If you are completely stuck, I suggest you + post a message to perl5-porters, comp.lang.perl.misc or if you are really + desperate to me. + + Remember when you are making any changes that the return value from + dl_load_file is used as a parameter in the dl_find_symbol + function. Also the return value from find_symbol is used as a parameter + to install_xsub. + + + Dealing with Error Messages + ============================ + In order to make the handling of dynamic linking errors as generic as + possible you should store any error messages associated with your + implementation with the StoreError function. + + In the case of VM/ESA the function dlerror returns the error message + associated with the last dynamic link error. As the VM/ESA dynamic + linker functions return NULL on error every call to a VM/ESA dynamic + dynamic link routine is coded like this + + RETVAL = dlopen(filename) ; + if (RETVAL == NULL) + SaveError("%s",dlerror()) ; + + Note that SaveError() takes a printf format string. Use a "%s" as + the first parameter if the error may contain and % characters. + +*/ + +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" +#include + + +#include "dlutils.c" /* SaveError() etc */ + + +static void +dl_private_init() +{ + (void)dl_generic_private_init(); +} + +MODULE = DynaLoader PACKAGE = DynaLoader + +BOOT: + (void)dl_private_init(); + + +void * +dl_load_file(filename, flags=0) + char * filename + int flags + CODE: + if (flags & 0x01) + warn("Can't make loaded symbols global on this platform while loading %s",filename); + DLDEBUG(1,PerlIO_printf(PerlIO_stderr(), "dl_load_file(%s,%x):\n", filename,flags)); + RETVAL = dlopen(filename) ; + DLDEBUG(2,PerlIO_printf(PerlIO_stderr(), " libref=%lx\n", (unsigned long) RETVAL)); + ST(0) = sv_newmortal() ; + if (RETVAL == NULL) + SaveError("%s",dlerror()) ; + else + sv_setiv( ST(0), (IV)RETVAL); + + +void * +dl_find_symbol(libhandle, symbolname) + void * libhandle + char * symbolname + CODE: + DLDEBUG(2, PerlIO_printf(PerlIO_stderr(), + "dl_find_symbol(handle=%lx, symbol=%s)\n", + (unsigned long) libhandle, symbolname)); + RETVAL = dlsym(libhandle, symbolname); + DLDEBUG(2, PerlIO_printf(PerlIO_stderr(), + " symbolref = %lx\n", (unsigned long) RETVAL)); + ST(0) = sv_newmortal() ; + if (RETVAL == NULL) + SaveError("%s",dlerror()) ; + else + sv_setiv( ST(0), (IV)RETVAL); + + +void +dl_undef_symbols() + PPCODE: + + + +# These functions should not need changing on any platform: + +void +dl_install_xsub(perl_name, symref, filename="$Package") + char * perl_name + void * symref + char * filename + CODE: + DLDEBUG(2,PerlIO_printf(PerlIO_stderr(), "dl_install_xsub(name=%s, symref=%lx)\n", + perl_name, (unsigned long) symref)); + ST(0)=sv_2mortal(newRV((SV*)newXS(perl_name, (void(*)_((CV *)))symref, filename))); + + +char * +dl_error() + CODE: + RETVAL = LastError ; + OUTPUT: + RETVAL + +# end. diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs index a4bff69..84f9f57 100644 --- a/ext/Thread/Thread.xs +++ b/ext/Thread/Thread.xs @@ -230,7 +230,10 @@ newthread (SV *startsv, AV *initargs, char *classname) static int attr_inited = 0; sigset_t fullmask, oldmask; #endif - +#ifdef PTHREAD_SETDETACHSTATE_ARG2_POINTER + static int attr_joinable = ATTR_JOINABLE; +#endif + savethread = thr; thr = new_struct_thread(thr); SPAGAIN; @@ -264,14 +267,24 @@ newthread (SV *startsv, AV *initargs, char *classname) #ifdef OLD_PTHREADS_API #ifdef VMS /* This is available with the old pthreads API, but only with */ -/* DecThreads (VMS and Digital Unix) */ +/* DecThreads (VMS and Digital Unix (which has and uses the new one)) */ if (err == 0) err = pthread_attr_setdetach_np(&attr, ATTR_JOINABLE); #endif -#else +#else /* !defined(VMS) */ +#ifdef ATTR_JOINABLE if (err == 0) err = pthread_attr_setdetachstate(&attr, ATTR_JOINABLE); -#endif +#else /* !defined(ATTR_JOINABLE) */ +#ifdef __UNDETACHED + if (err == 0) + err = pthread_attr_setdetachstate(&attr, &__undetached); +#else /* !defined(__UNDETACHED) */ + croak("panic: can't pthread_attr_setdetachstate"); +#endif /* __UNDETACHED */ +#endif /* ATTR_JOINABLE */ +#endif /* VMS */ +#endif /* OLD_PTHREADS_API */ } if (err == 0) #ifdef OLD_PTHREADS_API diff --git a/gv.c b/gv.c index a7e2b80..57e3ff1 100644 --- a/gv.c +++ b/gv.c @@ -122,9 +122,10 @@ gv_init(GV *gv, HV *stash, char *name, STRLEN len, int multi) CvSTASH(GvCV(gv)) = PL_curstash; #ifdef USE_THREADS CvOWNER(GvCV(gv)) = 0; - if (!CvMUTEXP(GvCV(gv))) + if (!CvMUTEXP(GvCV(gv))) { New(666, CvMUTEXP(GvCV(gv)), 1, perl_mutex); - MUTEX_INIT(CvMUTEXP(GvCV(gv))); + MUTEX_INIT(CvMUTEXP(GvCV(gv))); + } #endif /* USE_THREADS */ if (proto) { sv_setpv((SV*)GvCV(gv), proto); diff --git a/hints/hpux.sh b/hints/hpux.sh index 912ec12..c139d46 100644 --- a/hints/hpux.sh +++ b/hints/hpux.sh @@ -160,23 +160,6 @@ if [ "$xxOsRevMajor" -eq 10 -a "X$usethreads" = "X$define" ]; then selecttype='int *' fi -# Under 10.X, a threaded perl can be built, but it needs -# libcma and OLD_PTHREADS_API. Also needs to -# be #included before any other includes (in perl.h) -if [ "$xxOsRevMajor" -eq 10 -a "X$usethreads" = "X$define" ]; then - # HP-UX 10.X uses the old pthreads API - case "$d_oldpthreads" in - '') d_oldpthreads="$define" ;; - esac - # include libcma before all the others - libswanted="cma $libswanted" - # tell perl.h to include before other include files - ccflags="$ccflags -DPTHREAD_H_FIRST" - # CMA redefines select to cma_select, and cma_select expects int * - # instead of fd_set * (just like 9.X) - selecttype='int *' -fi - # Remove bad libraries that will cause problems # (This doesn't remove libraries that don't actually exist) # -lld is unneeded (and I can't figure out what it's used for anyway) @@ -250,4 +233,9 @@ EOM exit 1 fi ccflags="$ccflags +DD64 -D_FILE_OFFSET_BITS=64" + ldflags="$ldflags +DD64" + ld=/usr/bin/ld + set `echo " $libswanted " | sed -e 's@ dl @ @'` + libswanted="$*" + glibpth="/lib/pa20_64" fi diff --git a/hints/irix_6.sh b/hints/irix_6.sh index 0f6637b..515a94f 100644 --- a/hints/irix_6.sh +++ b/hints/irix_6.sh @@ -234,7 +234,7 @@ if [ "X$use64bits" = "X$define" ]; then cat << 'EOM' >&2 You will see a *** WHOA THERE!!! *** message from Configure for -d_open64. Keep the recommended value. See hints/irix6_2.sh +d_open64. Keep the recommended value. See hints/irix6.sh for more information. EOM diff --git a/hints/linux.sh b/hints/linux.sh index 545f50e..b34967b 100644 --- a/hints/linux.sh +++ b/hints/linux.sh @@ -18,6 +18,27 @@ # No version of Linux supports setuid scripts. d_suidsafe='undef' +# Debian and Red Hat, and perhaps other vendors, provide both runtime and +# development packages for some libraries. The runtime packages contain shared +# libraries with version information in their names (e.g., libgdbm.so.1.7.3); +# the development packages supplement this with versionless shared libraries +# (e.g., libgdbm.so). +# +# If you want to link against such a library, you must install the development +# version of the package. +# +# These packages use a -dev naming convention in both Debian and Red Hat: +# libgdbmg1 (non-development version of GNU libc 2-linked GDBM library) +# libgdbmg1-dev (development version of GNU libc 2-linked GDBM library) +# So make sure that for any libraries you wish to link Perl with under +# Debian or Red Hat you have the -dev packages installed. +# +# Some operating systems (e.g., Solaris 2.6) will link to a versioned shared +# library implicitly. For example, on Solaris, `ld foo.o -lgdbm' will find an +# appropriate version of libgdbm, if one is available; Linux, however, doesn't +# do the implicit mapping. +ignore_versioned_solibs='y' + # perl goes into the /usr tree. See the Filesystem Standard # available via anonymous FTP at tsx-11.mit.edu in # /pub/linux/docs/linux-standards/fsstnd. diff --git a/hints/os390.sh b/hints/os390.sh index 1cf945d..d7ade09 100644 --- a/hints/os390.sh +++ b/hints/os390.sh @@ -54,3 +54,6 @@ case "$archname" in esac archobjs=ebcdic.o + +# We have our own cppstdin. +echo 'cat >.$$.c; '"$cc"' -E -Wc,NOLOC ${1+"$@"} .$$.c; rm .$$.c' > cppstdin diff --git a/op.c b/op.c index eb4856e..3e21271 100644 --- a/op.c +++ b/op.c @@ -3832,9 +3832,10 @@ newSUB(I32 floor, OP *o, OP *proto, OP *block) CvSTASH(cv) = PL_curstash; #ifdef USE_THREADS CvOWNER(cv) = 0; - if (!CvMUTEXP(cv)) + if (!CvMUTEXP(cv)) { New(666, CvMUTEXP(cv), 1, perl_mutex); - MUTEX_INIT(CvMUTEXP(cv)); + MUTEX_INIT(CvMUTEXP(cv)); + } #endif /* USE_THREADS */ if (ps) diff --git a/thread.h b/thread.h index 035c5ca..50d9fc3 100644 --- a/thread.h +++ b/thread.h @@ -3,44 +3,36 @@ #ifdef WIN32 # include #else - -#ifndef DJGPP -/* POSIXish threads */ -#ifdef OLD_PTHREADS_API -# define pthread_mutexattr_init(a) pthread_mutexattr_create(a) -# define pthread_mutexattr_settype(a,t) pthread_mutexattr_setkind_np(a,t) -# define pthread_key_create(k,d) pthread_keycreate(k,(pthread_destructor_t)(d)) -# define YIELD pthread_yield() -# define DETACH(t) \ +# if defined(OLD_PTHREADS_API) && !defined(DJGPP) + /* POSIXish threads */ +# define pthread_mutexattr_init(a) pthread_mutexattr_create(a) +# define pthread_mutexattr_settype(a,t) pthread_mutexattr_setkind_np(a,t) +# define pthread_key_create(k,d) pthread_keycreate(k,(pthread_destructor_t)(d)) +# define DETACH(t) \ STMT_START { \ if (pthread_detach(&(t)->self)) { \ MUTEX_UNLOCK(&(t)->mutex); \ croak("panic: DETACH"); \ } \ } STMT_END -#else -# define pthread_mutexattr_default NULL -# define pthread_condattr_default NULL -#endif /* OLD_PTHREADS_API */ +# else +# define pthread_mutexattr_default NULL +# define pthread_condattr_default NULL +# endif /* OLD_PTHREADS_API */ #endif + +#ifndef YIELD +# define YIELD SCHED_YIELD #endif -#ifdef PTHREADS_CREATED_JOINABLE +#ifdef PTHREAD_CREATE_JOINABLE # define ATTR_JOINABLE PTHREAD_CREATE_JOINABLE #else # ifdef PTHREAD_CREATE_UNDETACHED # define ATTR_JOINABLE PTHREAD_CREATE_UNDETACHED # else -# define ATTR_JOINABLE PTHREAD_CREATE_JOINABLE -# endif -#endif - -#ifndef YIELD -# ifdef HAS_SCHED_YIELD -# define YIELD sched_yield() -# else -# ifdef HAS_PTHREAD_YIELD -# define YIELD pthread_yield() +# ifdef __UNDETACHED +# define ATTR_JOINABLE __UNDETACHED # endif # endif #endif diff --git a/x2p/Makefile.SH b/x2p/Makefile.SH index 1f92d5d..1894d55 100755 --- a/x2p/Makefile.SH +++ b/x2p/Makefile.SH @@ -85,6 +85,7 @@ pl = find2perl.PL s2p.PL plextract = find2perl s2p plexe = find2perl.exe s2p.exe plc = find2perl.c s2p.c +plm = a2p.loadmap addedbyconf = $(shextract) $(plextract) @@ -129,7 +130,7 @@ a2p$(OBJ_EXT): a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h \ $(CCCMD) $(LARGE) a2p.c clean: - rm -f a2p *$(OBJ_EXT) $(plexe) $(plc) + rm -f a2p *$(OBJ_EXT) $(plexe) $(plc) $(plm) realclean: clean rm -f *.orig core $(addedbyconf) all malloc.c -- 1.8.3.1