diff options
Diffstat (limited to 'unix')
-rw-r--r-- | unix/Makefile.in | 154 | ||||
-rw-r--r-- | unix/configure.in | 8 | ||||
-rw-r--r-- | unix/tcl.spec | 4 | ||||
-rw-r--r-- | unix/tclLoadDyld.c | 168 | ||||
-rw-r--r-- | unix/tclUnixChan.c | 24 | ||||
-rw-r--r-- | unix/tclUnixPort.h | 4 |
6 files changed, 281 insertions, 81 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in index 7b5d57b..d2c828f 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -5,7 +5,7 @@ # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.61 2000/04/05 00:42:38 welch Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.62 2000/04/19 08:32:45 hobbs Exp $ VERSION = @TCL_VERSION@ @@ -20,10 +20,15 @@ VERSION = @TCL_VERSION@ # specific files (exec_prefix) and machine-independent files such # as scripts (prefix). The values specified here may be overridden # at configure-time with the --exec-prefix and --prefix options -# to the "configure" script. +# to the "configure" script. The *dir vars are standard configure +# substitutions that are based off prefix and exec_prefix. prefix = @prefix@ exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +includedir = @includedir@ +mandir = @mandir@ # The following definition can be set to non-null for special systems # like AFS with replication. It allows the pathnames used for installation @@ -32,37 +37,38 @@ exec_prefix = @exec_prefix@ # when installing files. INSTALL_ROOT = -TCL_LIBRARY = $(prefix)/lib/tcl$(VERSION) +# Path for the platform independent Tcl scripting libraries: +TCL_LIBRARY = $(prefix)/lib/tcl$(VERSION) # Path to use at runtime to refer to LIB_INSTALL_DIR: -LIB_RUNTIME_DIR = $(exec_prefix)/lib +LIB_RUNTIME_DIR = $(libdir) # Directory in which to install the program tclsh: -BIN_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/bin +BIN_INSTALL_DIR = $(INSTALL_ROOT)$(bindir) # Directory in which to install libtcl.so or libtcl.a: -LIB_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/lib +LIB_INSTALL_DIR = $(INSTALL_ROOT)$(libdir) # Path name to use when installing library scripts. Don't # include $(prefix) here since it's already part of $(TCL_LIBRARY) -SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(TCL_LIBRARY) +SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(TCL_LIBRARY) # Directory in which to install the include file tcl.h: -INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/include +INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(includedir) # Top-level directory in which to install manual entries: -MAN_INSTALL_DIR = $(INSTALL_ROOT)@mandir@ +MAN_INSTALL_DIR = $(INSTALL_ROOT)$(mandir) # Directory in which to install manual entry for tclsh: -MAN1_INSTALL_DIR = $(MAN_INSTALL_DIR)/man1 +MAN1_INSTALL_DIR = $(MAN_INSTALL_DIR)/man1 # Directory in which to install manual entries for Tcl's C library # procedures: -MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3 +MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3 # Directory in which to install manual entries for the built-in # Tcl commands: -MANN_INSTALL_DIR = $(MAN_INSTALL_DIR)/mann +MANN_INSTALL_DIR = $(MAN_INSTALL_DIR)/mann # Package search path. TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ @@ -79,23 +85,23 @@ CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ # To change the compiler switches, for example to change from optimization to # debugging symbols, change the following line: -#CFLAGS = $(CFLAGS_DEBUG) -#CFLAGS = $(CFLAGS_OPTIMIZE) -#CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) -CFLAGS = @CFLAGS@ +#CFLAGS = $(CFLAGS_DEBUG) +#CFLAGS = $(CFLAGS_OPTIMIZE) +#CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) +CFLAGS = @CFLAGS@ # To disable ANSI-C procedure prototypes reverse the comment characters # on the following lines: -PROTO_FLAGS = -#PROTO_FLAGS = -DNO_PROTOTYPE +PROTO_FLAGS = +#PROTO_FLAGS = -DNO_PROTOTYPE # Mathematical functions like sin and atan2 are enabled for expressions # by default. To disable them, reverse the comment characters on the # following pairs of lines: -MATH_FLAGS = -#MATH_FLAGS = -DTCL_NO_MATH -MATH_LIBS = @MATH_LIBS@ -#MATH_LIBS = +MATH_FLAGS = +#MATH_FLAGS = -DTCL_NO_MATH +MATH_LIBS = @MATH_LIBS@ +#MATH_LIBS = # If you use the setenv, putenv, or unsetenv procedures to modify # environment variables in your application and you'd like those @@ -124,41 +130,41 @@ NOTIFY_OBJS = tclUnixNotfy.o # lines. Warning: if you enable memory debugging, you must do it # *everywhere*, including all the code that calls Tcl, and you must use # ckalloc and ckfree everywhere instead of malloc and free. -MEM_DEBUG_FLAGS = -#MEM_DEBUG_FLAGS = -DTCL_MEM_DEBUG +MEM_DEBUG_FLAGS = +#MEM_DEBUG_FLAGS = -DTCL_MEM_DEBUG # To enable support for stubs in Tcl. -STUB_LIB_FILE = @STUB_LIB_FILE@ +STUB_LIB_FILE = @STUB_LIB_FILE@ -TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ -#TCL_STUB_LIB_FILE = libtclstub.a +TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ +#TCL_STUB_LIB_FILE = libtclstub.a -TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ -#TCL_STUB_LIB_FLAG = -ltclstub +TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ +#TCL_STUB_LIB_FLAG = -ltclstub # To enable compilation debugging reverse the comment characters on # one of the following lines. -COMPILE_DEBUG_FLAGS = -#COMPILE_DEBUG_FLAGS = -DTCL_COMPILE_STATS -#COMPILE_DEBUG_FLAGS = -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS +COMPILE_DEBUG_FLAGS = +#COMPILE_DEBUG_FLAGS = -DTCL_COMPILE_STATS +#COMPILE_DEBUG_FLAGS = -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS # To compile without backward compatibility and deprecated code # uncomment the following -NO_DEPRECATED_FLAGS= -#NO_DEPRECATED_FLAGS= -DTCL_NO_DEPRECATED +NO_DEPRECATED_FLAGS = +#NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED # Some versions of make, like SGI's, use the following variable to # determine which shell to use for executing commands: -SHELL = /bin/sh +SHELL = /bin/sh # Tcl used to let the configure script choose which program to use # for installing, but there are just too many different versions of # "install" around; better to use the install-sh script that comes # with the distribution, which is slower but guaranteed to work. -INSTALL = @srcdir@/install-sh -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 +INSTALL = @srcdir@/install-sh -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 # The symbols below provide support for dynamic loading and shared # libraries. See configure.in for a description of what the @@ -166,31 +172,31 @@ INSTALL_DATA = ${INSTALL} -m 644 # configure script. You shouldn't normally need to modify any of # these definitions by hand. -STLIB_LD = @STLIB_LD@ -SHLIB_LD = @SHLIB_LD@ -SHLIB_CFLAGS = @SHLIB_CFLAGS@ +STLIB_LD = @STLIB_LD@ +SHLIB_LD = @SHLIB_LD@ +SHLIB_CFLAGS = @SHLIB_CFLAGS@ -SHLIB_SUFFIX = @SHLIB_SUFFIX@ -#SHLIB_SUFFIX = +SHLIB_SUFFIX = @SHLIB_SUFFIX@ +#SHLIB_SUFFIX = -DLTEST_TARGETS = dltest/pkg5${SHLIB_SUFFIX} dltest/Makefile +DLTEST_TARGETS = dltest/pkg5${SHLIB_SUFFIX} dltest/Makefile # The following symbol is defined to "$(DLTEST_TARGETS)" if dynamic # loading is available; this causes everything in the "dltest" # subdirectory to be built when making "tcltest. If dynamic loading # isn't available, configure defines this symbol to an empty string, # in which case the shared libraries aren't built. -BUILD_DLTEST = @BUILD_DLTEST@ -#BUILD_DLTEST = +BUILD_DLTEST = @BUILD_DLTEST@ +#BUILD_DLTEST = -TCL_LIB_FILE = @TCL_LIB_FILE@ -#TCL_LIB_FILE = libtcl.a +TCL_LIB_FILE = @TCL_LIB_FILE@ +#TCL_LIB_FILE = libtcl.a -TCL_LIB_FLAG = @TCL_LIB_FLAG@ -#TCL_LIB_FLAG = -ltcl +TCL_LIB_FLAG = @TCL_LIB_FLAG@ +#TCL_LIB_FLAG = -ltcl -TCL_EXP_FILE = @TCL_EXP_FILE@ -TCL_BUILD_EXP_FILE = @TCL_BUILD_EXP_FILE@ +TCL_EXP_FILE = @TCL_EXP_FILE@ +TCL_BUILD_EXP_FILE = @TCL_BUILD_EXP_FILE@ #---------------------------------------------------------------- # The information below is modified by the configure script when @@ -198,23 +204,23 @@ TCL_BUILD_EXP_FILE = @TCL_BUILD_EXP_FILE@ # modify any of this stuff by hand. #---------------------------------------------------------------- -COMPAT_OBJS = @LIBOBJS@ +COMPAT_OBJS = @LIBOBJS@ -AC_FLAGS = @EXTRA_CFLAGS@ @DEFS@ -RANLIB = @RANLIB@ -SRC_DIR = @srcdir@ -TOP_DIR = @srcdir@/.. -GENERIC_DIR = $(TOP_DIR)/generic -COMPAT_DIR = $(TOP_DIR)/compat -TOOL_DIR = $(TOP_DIR)/tools -UNIX_DIR = $(TOP_DIR)/unix +AC_FLAGS = @EXTRA_CFLAGS@ @DEFS@ +RANLIB = @RANLIB@ +SRC_DIR = @srcdir@ +TOP_DIR = @srcdir@/.. +GENERIC_DIR = $(TOP_DIR)/generic +COMPAT_DIR = $(TOP_DIR)/compat +TOOL_DIR = $(TOP_DIR)/tools +UNIX_DIR = $(TOP_DIR)/unix # Must be absolute because of the cd dltest $(DLTEST_DIR)/configure below. -DLTEST_DIR = @TCL_SRC_DIR@/unix/dltest +DLTEST_DIR = @TCL_SRC_DIR@/unix/dltest # Must be absolute to so the corresponding tcltest's tcl_library is absolute. -TCL_BUILDTIME_LIBRARY= @TCL_SRC_DIR@/library +TCL_BUILDTIME_LIBRARY = @TCL_SRC_DIR@/library -#CC = purify -best-effort @CC@ -CC = @CC@ +#CC = purify -best-effort @CC@ +CC = @CC@ #---------------------------------------------------------------- # The information below should be usable as is. The configure @@ -223,7 +229,7 @@ CC = @CC@ #---------------------------------------------------------------- -CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ +CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ -I${GENERIC_DIR} -I${SRC_DIR} \ ${AC_FLAGS} ${MATH_FLAGS} ${GENERIC_FLAGS} ${PROTO_FLAGS} ${MEM_DEBUG_FLAGS} \ ${COMPILE_DEBUG_FLAGS} ${NO_DEPRECATED_FLAGS} ${ENV_FLAGS} \ @@ -234,9 +240,9 @@ STUB_CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ ${AC_FLAGS} ${MATH_FLAGS} ${GENERIC_FLAGS} ${PROTO_FLAGS} ${MEM_DEBUG_FLAGS} \ ${COMPILE_DEBUG_FLAGS} ${ENV_FLAGS} -DTCL_SHLIB_EXT=\"${SHLIB_SUFFIX}\" -LIBS = @DL_LIBS@ @LIBS@ $(MATH_LIBS) -lc +LIBS = @DL_LIBS@ @LIBS@ $(MATH_LIBS) -lc -DEPEND_SWITCHES = ${CFLAGS} -I${GENERIC_DIR} -I${SRC_DIR} \ +DEPEND_SWITCHES = ${CFLAGS} -I${GENERIC_DIR} -I${SRC_DIR} \ ${AC_FLAGS} ${MATH_FLAGS} \ ${GENERIC_FLAGS} ${PROTO_FLAGS} ${MEM_DEBUG_FLAGS} \ -DTCL_SHLIB_EXT=\"${SHLIB_SUFFIX}\" @@ -371,6 +377,7 @@ DL_SRCS = \ $(UNIX_DIR)/tclLoadDl.c \ $(UNIX_DIR)/tclLoadDl2.c \ $(UNIX_DIR)/tclLoadDld.c \ + $(UNIX_DIR)/tclLoadDyld.c \ $(GENERIC_DIR)/tclLoadNone.c \ $(UNIX_DIR)/tclLoadOSF.c \ $(UNIX_DIR)/tclLoadShl.c @@ -460,7 +467,7 @@ topDirName: gendate: yacc -l $(GENERIC_DIR)/tclGetDate.y sed -e 's/yy/TclDate/g' -e '/^#include <values.h>/d' \ - -e 's?SCCSID?RCS: @(#) $$Id: Makefile.in,v 1.61 2000/04/05 00:42:38 welch Exp $$?' \ + -e 's?SCCSID?RCS: @(#) $$Id: Makefile.in,v 1.62 2000/04/19 08:32:45 hobbs Exp $$?' \ -e '/#ifdef __STDC__/,/#endif/d' -e '/TclDateerrlab:/d' \ -e '/TclDatenewstate:/d' -e '/#pragma/d' \ -e '/#include <inttypes.h>/d' -e 's/const /CONST /g' \ @@ -487,6 +494,9 @@ dltest/Makefile: $(DLTEST_DIR)/configure $(DLTEST_DIR)/Makefile.in tclConfig.sh install: install-binaries install-libraries install-doc +install-strip: + $(MAKE) install INSTALL_PROGRAM="$(INSTALL_PROGRAM) -s" + # Note: before running ranlib below, must cd to target directory because # some ranlibs write to current directory, and this might not always be # possible (e.g. if installing as root). @@ -524,8 +534,7 @@ install-binaries: binaries fi install-libraries: libraries - @for i in $(INSTALL_ROOT)$(prefix)/lib $(INCLUDE_INSTALL_DIR) \ - $(SCRIPT_INSTALL_DIR); \ + @for i in $(INCLUDE_INSTALL_DIR) $(SCRIPT_INSTALL_DIR); \ do \ if [ ! -d $$i ] ; then \ echo "Making directory $$i"; \ @@ -803,6 +812,9 @@ tclLoadDl2.o: $(UNIX_DIR)/tclLoadDl2.c tclLoadDld.o: $(UNIX_DIR)/tclLoadDld.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclLoadDld.c +tclLoadDyld.o: $(UNIX_DIR)/tclLoadDyld.c + $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclLoadDyld.c + tclLoadNone.o: $(GENERIC_DIR)/tclLoadNone.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclLoadNone.c diff --git a/unix/configure.in b/unix/configure.in index 603de33..c8a342c 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,12 +3,12 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tcl installation dnl to configure the system for the local environment. AC_INIT(../generic/tcl.h) -# RCS: @(#) $Id: configure.in,v 1.56 2000/02/10 08:55:27 hobbs Exp $ +# RCS: @(#) $Id: configure.in,v 1.57 2000/04/19 08:32:45 hobbs Exp $ TCL_VERSION=8.3 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=3 -TCL_PATCH_LEVEL=".0" +TCL_PATCH_LEVEL=".1" VERSION=${TCL_VERSION} #------------------------------------------------------------------------ @@ -37,10 +37,10 @@ AC_HAVE_HEADERS(unistd.h limits.h) SC_ENABLE_THREADS -#------------------------------------------------------------------------------ +#------------------------------------------------------------------------ # If we're using GCC, see if the compiler understands -pipe. If so, use it. # It makes compiling go faster. (This is only a performance feature.) -#------------------------------------------------------------------------------ +#------------------------------------------------------------------------ if test -z "$no_pipe"; then if test -n "$GCC"; then diff --git a/unix/tcl.spec b/unix/tcl.spec index dc7b148..ed3a675 100644 --- a/unix/tcl.spec +++ b/unix/tcl.spec @@ -1,7 +1,7 @@ -# $Id: tcl.spec,v 1.2 2000/03/24 23:15:29 ericm Exp $ +# $Id: tcl.spec,v 1.3 2000/04/19 08:32:45 hobbs Exp $ # This file is the basis for a binary Tcl RPM for Linux. -%define version 8.3.0 +%define version 8.3.1 %define directory /usr/local Summary: Tcl scripting language development environment diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c new file mode 100644 index 0000000..6b17ba9 --- /dev/null +++ b/unix/tclLoadDyld.c @@ -0,0 +1,168 @@ +/* + * tclLoadDyld.c -- + * + * This procedure provides a version of the TclLoadFile that + * works with NeXT/Apple's dyld dynamic loading. This file + * provided by Wilfredo Sanchez (wsanchez@apple.com). + * The works on Mac OS X and Mac OS X Server. + * It should work with OpenStep, but it's not been tried. + * + * Copyright (c) 1995 Apple Computer, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * RCS: @(#) $Id: tclLoadDyld.c,v 1.1 2000/04/19 08:32:45 hobbs Exp $ + */ + +#include "tclInt.h" +#include <mach-o/dyld.h> + +/* + *---------------------------------------------------------------------- + * + * TclpLoadFile -- + * + * Dynamically loads a binary code file into memory and returns + * the addresses of two procedures within that file, if they + * are defined. + * + * Results: + * A standard Tcl completion code. If an error occurs, an error + * message is left in interp->result. *proc1Ptr and *proc2Ptr + * are filled in with the addresses of the symbols given by + * *sym1 and *sym2, or NULL if those symbols can't be found. + * + * Side effects: + * New code suddenly appears in memory. + * + *---------------------------------------------------------------------- + */ + +int +TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) + Tcl_Interp *interp; /* Used for error reporting. */ + char *fileName; /* Name of the file containing the desired + * code. */ + char *sym1, *sym2; /* Names of two procedures to look up in + * the file's symbol table. */ + Tcl_PackageInitProc **proc1Ptr, **proc2Ptr; + /* Where to return the addresses corresponding + * to sym1 and sym2. */ + ClientData *clientDataPtr; /* Filled with token for dynamically loaded + * file which will be passed back to + * TclpUnloadFile() to unload the file. */ +{ + NSObjectFileImageReturnCode err; + NSObjectFileImage image; + NSModule module; + NSSymbol symbol; + char *name; + + err = NSCreateObjectFileImageFromFile(fileName, &image); + if (err != NSObjectFileImageSuccess) { + switch (err) { + case NSObjectFileImageFailure: + interp->result = "dyld: general failure"; + break; + case NSObjectFileImageInappropriateFile: + interp->result = "dyld: inappropriate Mach-O file"; + break; + case NSObjectFileImageArch: + interp->result = "dyld: inappropriate Mach-O architecture"; + break; + case NSObjectFileImageFormat: + interp->result = "dyld: invalid Mach-O file format"; + break; + case NSObjectFileImageAccess: + interp->result = "dyld: permission denied"; + break; + default: + interp->result = "dyld: unknown failure"; + break; + } + return TCL_ERROR; + } + + module = NSLinkModule(image, fileName, TRUE); + + if (module == NULL) { + interp->result = "dyld: falied to link module"; + return TCL_ERROR; + } + + name = (char*)malloc(sizeof(char)*(strlen(sym1)+2)); + sprintf(name, "_%s", sym1); + symbol = NSLookupAndBindSymbol(name); + free(name); + *proc1Ptr = NSAddressOfSymbol(symbol); + + name = (char*)malloc(sizeof(char)*(strlen(sym2)+2)); + sprintf(name, "_%s", sym2); + symbol = NSLookupAndBindSymbol(name); + free(name); + *proc2Ptr = NSAddressOfSymbol(symbol); + + *clientDataPtr = module; + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclpUnloadFile -- + * + * Unloads a dynamically loaded binary code file from memory. + * Code pointers in the formerly loaded file are no longer valid + * after calling this function. + * + * Results: + * None. + * + * Side effects: + * Code dissapears from memory. + * Note that this is a no-op on older (OpenStep) versions of dyld. + * + *---------------------------------------------------------------------- + */ + +void +TclpUnloadFile(clientData) + ClientData clientData; /* ClientData returned by a previous call + * to TclpLoadFile(). The clientData is + * a token that represents the loaded + * file. */ +{ + NSUnLinkModule(clientData, FALSE); +} + +/* + *---------------------------------------------------------------------- + * + * TclGuessPackageName -- + * + * If the "load" command is invoked without providing a package + * name, this procedure is invoked to try to figure it out. + * + * Results: + * Always returns 0 to indicate that we couldn't figure out a + * package name; generic code will then try to guess the package + * from the file name. A return value of 1 would have meant that + * we figured out the package name and put it in bufPtr. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TclGuessPackageName(fileName, bufPtr) + char *fileName; /* Name of file containing package (already + * translated to local form if needed). */ + Tcl_DString *bufPtr; /* Initialized empty dstring. Append + * package name to this if possible. */ +{ + return 0; +} diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index b0a57f5..3420fd4 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixChan.c,v 1.15 2000/04/15 17:34:23 hobbs Exp $ + * RCS: @(#) $Id: tclUnixChan.c,v 1.16 2000/04/19 08:32:46 hobbs Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ @@ -2056,7 +2056,27 @@ CreateSocket(interp, port, host, server, myaddr, myport, async) asyncConnect = 1; status = 0; } - } + } else { + /* + * Here we are if the connect succeeds. In case of an + * asynchronous connect we have to reset the channel to + * blocking mode. This appears to happen not very often, + * but e.g. on a HP 9000/800 under HP-UX B.11.00 we enter + * this stage. [Bug: 4388] + */ + if (async) { +#ifndef USE_FIONBIO + origState = fcntl(sock, F_GETFL); + curState = origState & ~(O_NONBLOCK); + status = fcntl(sock, F_SETFL, curState); +#endif + +#ifdef USE_FIONBIO + curState = 0; + status = ioctl(sock, FIONBIO, &curState); +#endif + } + } } } diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index b7b0215..fa6333a 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -19,7 +19,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixPort.h,v 1.13 2000/01/24 02:30:17 hobbs Exp $ + * RCS: @(#) $Id: tclUnixPort.h,v 1.14 2000/04/19 08:32:46 hobbs Exp $ */ #ifndef _TCLUNIXPORT @@ -423,7 +423,7 @@ extern int errno; * Variables provided by the C library: */ -#if defined(_sgi) || defined(__sgi) +#if defined(_sgi) || defined(__sgi) || (defined(__APPLE__) && defined(__DYNAMIC__)) # define environ _environ #endif extern char **environ; |