diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-06-14 18:31:24 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-06-14 18:31:24 (GMT) |
commit | 14994d8a856c6e59890aad6023793a6760c98e1a (patch) | |
tree | 1c5559c8ce5c44ad2f0275b5c0bc56d0c65cbab8 /unix | |
parent | 5e1789954df3a512ab8d71df2c60ffb6ea72b777 (diff) | |
parent | 919ec44584344d71c8ddad8d14d58adfdec28e8b (diff) | |
download | tcl-14994d8a856c6e59890aad6023793a6760c98e1a.zip tcl-14994d8a856c6e59890aad6023793a6760c98e1a.tar.gz tcl-14994d8a856c6e59890aad6023793a6760c98e1a.tar.bz2 |
Merge trunk. Some more size_t additions in parameters/fields
Diffstat (limited to 'unix')
-rw-r--r-- | unix/Makefile.in | 2 | ||||
-rw-r--r-- | unix/README | 2 | ||||
-rwxr-xr-x | unix/configure | 34 | ||||
-rw-r--r-- | unix/tcl.m4 | 11 | ||||
-rw-r--r-- | unix/tclConfig.h.in | 3 | ||||
-rw-r--r-- | unix/tclUnixChan.c | 24 | ||||
-rw-r--r-- | unix/tclUnixPort.h | 13 |
7 files changed, 69 insertions, 20 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in index a668f75..41d7e7f 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -1759,7 +1759,7 @@ configure-packages: $$i/configure --with-tcl=../.. \ --with-tclinclude=$(GENERIC_DIR) \ $(PKG_CFG_ARGS) --libdir=$(PACKAGE_DIR) \ - --enable-shared --enable-threads; ) || exit $$?; \ + --enable-shared; ) || exit $$?; \ fi; \ fi; \ fi; \ diff --git a/unix/README b/unix/README index d8f1090..381cbdd 100644 --- a/unix/README +++ b/unix/README @@ -45,8 +45,6 @@ How To Compile And Install Tcl: refer to the autoconf documentation (not included here). Tcl's "configure" supports the following special switches in addition to the standard ones: - --enable-threads If this switch is set, Tcl will compile itself - with multithreading support. --disable-load If this switch is specified then Tcl will configure itself not to allow dynamic loading, even if your system appears to support it. diff --git a/unix/configure b/unix/configure index 18c27ef..4fe994c 100755 --- a/unix/configure +++ b/unix/configure @@ -6868,6 +6868,40 @@ $as_echo "#define HAVE_STRUCT_DIRENT64 1" >>confdefs.h fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DIR64" >&5 +$as_echo_n "checking for DIR64... " >&6; } +if ${tcl_cv_DIR64+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> +#include <dirent.h> +int +main () +{ +struct dirent64 *p; DIR64 d = opendir64("."); + p = readdir64(d); rewinddir64(d); closedir64(d); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_DIR64=yes +else + tcl_cv_DIR64=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_DIR64" >&5 +$as_echo "$tcl_cv_DIR64" >&6; } + if test "x${tcl_cv_DIR64}" = "xyes" ; then + +$as_echo "#define HAVE_DIR64 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat64" >&5 $as_echo_n "checking for struct stat64... " >&6; } if ${tcl_cv_struct_stat64+:} false; then : diff --git a/unix/tcl.m4 b/unix/tcl.m4 index aaf5835..cf6345f 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2412,7 +2412,7 @@ AC_DEFUN([SC_TCL_EARLY_FLAGS],[ # Might define the following vars: # TCL_WIDE_INT_IS_LONG # TCL_WIDE_INT_TYPE -# HAVE_STRUCT_DIRENT64 +# HAVE_STRUCT_DIRENT64, HAVE_DIR64 # HAVE_STRUCT_STAT64 # HAVE_TYPE_OFF64_T # @@ -2448,6 +2448,15 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [ AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?]) fi + AC_CACHE_CHECK([for DIR64], tcl_cv_DIR64,[ + AC_TRY_COMPILE([#include <sys/types.h> +#include <dirent.h>],[struct dirent64 *p; DIR64 d = opendir64("."); + p = readdir64(d); rewinddir64(d); closedir64(d);], + tcl_cv_DIR64=yes,tcl_cv_DIR64=no)]) + if test "x${tcl_cv_DIR64}" = "xyes" ; then + AC_DEFINE(HAVE_DIR64, 1, [Is 'DIR64' in <sys/types.h>?]) + fi + AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[ AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p; ], diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index b9d0059..21c3bef 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -196,6 +196,9 @@ /* Is 'struct dirent64' in <sys/types.h>? */ #undef HAVE_STRUCT_DIRENT64 +/* Is 'DIR64' in <sys/types.h>? */ +#undef HAVE_DIR64 + /* Define to 1 if the system has the type `struct in6_addr'. */ #undef HAVE_STRUCT_IN6_ADDR diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index ced684a..6eed23b 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -1503,30 +1503,32 @@ Tcl_MakeFileChannel( char channelName[16 + TCL_INTEGER_SPACE]; int fd = PTR2INT(handle); const Tcl_ChannelType *channelTypePtr; - struct sockaddr sockaddr; - socklen_t sockaddrLen = sizeof(sockaddr); + struct stat buf; if (mode == 0) { return NULL; } - sockaddr.sa_family = AF_UNSPEC; - #ifdef SUPPORTS_TTY if (isatty(fd)) { channelTypePtr = &ttyChannelType; sprintf(channelName, "serial%d", fd); } else #endif /* SUPPORTS_TTY */ - if ((getsockname(fd, (struct sockaddr *)&sockaddr, &sockaddrLen) == 0) - && (sockaddrLen > 0) - && (sockaddr.sa_family == AF_INET || sockaddr.sa_family == AF_INET6)) { - return TclpMakeTcpClientChannelMode(INT2PTR(fd), mode); - } else { - channelTypePtr = &fileChannelType; - sprintf(channelName, "file%d", fd); + if (fstat(fd, &buf) == 0 && S_ISSOCK(buf.st_mode)) { + struct sockaddr sockaddr; + socklen_t sockaddrLen = sizeof(sockaddr); + sockaddr.sa_family = AF_UNSPEC; + if ((getsockname(fd, (struct sockaddr *)&sockaddr, &sockaddrLen) == 0) + && (sockaddrLen > 0) + && (sockaddr.sa_family == AF_INET || sockaddr.sa_family == AF_INET6)) { + return TclpMakeTcpClientChannelMode(INT2PTR(fd), mode); + } } + channelTypePtr = &fileChannelType; + sprintf(channelName, "file%d", fd); + fsPtr = ckalloc(sizeof(FileState)); fsPtr->fd = fd; fsPtr->validMask = mode | TCL_EXCEPTION; diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 64417e7..cd85e90 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -57,16 +57,19 @@ */ #ifdef HAVE_STRUCT_DIRENT64 -typedef DIR64 TclDIR; -typedef struct dirent64 Tcl_DirEntry; +typedef struct dirent64 Tcl_DirEntry; # define TclOSreaddir readdir64 +#else +typedef struct dirent Tcl_DirEntry; +# define TclOSreaddir readdir +#endif +#ifdef HAVE_DIR64 +typedef DIR64 TclDIR; # define TclOSopendir opendir64 # define TclOSrewinddir rewinddir64 # define TclOSclosedir closedir64 #else -typedef DIR TclDIR; -typedef struct dirent Tcl_DirEntry; -# define TclOSreaddir readdir +typedef DIR TclDIR; # define TclOSopendir opendir # define TclOSrewinddir rewinddir # define TclOSclosedir closedir |