Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81876c865c | ||
|
|
038af24f6e | ||
|
|
cd3e094d36 | ||
|
|
5ca404962d | ||
|
|
418ac3a870 | ||
|
|
bbf0be941c | ||
|
|
4ed16adfa0 | ||
|
|
d42d5fec9d |
+4
-16
@@ -240,7 +240,6 @@ typedef void *ClientData;
|
||||
# undef TCL_WIDE_INT_IS_LONG
|
||||
# undef TCL_CFG_DO64BIT
|
||||
# endif /* __LP64__ */
|
||||
# undef HAVE_STRUCT_STAT64
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
/*
|
||||
@@ -308,15 +307,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
|
||||
#define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val)))
|
||||
|
||||
#if defined(_WIN32)
|
||||
# ifdef __BORLANDC__
|
||||
typedef struct stati64 Tcl_StatBuf;
|
||||
# elif defined(_WIN64)
|
||||
typedef struct __stat64 Tcl_StatBuf;
|
||||
# elif (defined(_MSC_VER) && (_MSC_VER < 1400)) || defined(_USE_32BIT_TIME_T)
|
||||
typedef struct _stati64 Tcl_StatBuf;
|
||||
# else
|
||||
typedef struct _stat32i64 Tcl_StatBuf;
|
||||
# endif /* _MSC_VER < 1400 */
|
||||
typedef struct __stat64 Tcl_StatBuf;
|
||||
#elif defined(__CYGWIN__)
|
||||
typedef struct {
|
||||
dev_t st_dev;
|
||||
@@ -329,13 +320,10 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
|
||||
dev_t st_rdev;
|
||||
/* Here is a 4-byte gap */
|
||||
long long st_size;
|
||||
struct {long tv_sec;} st_atim;
|
||||
struct {long tv_sec;} st_mtim;
|
||||
struct {long tv_sec;} st_ctim;
|
||||
/* Here is a 4-byte gap */
|
||||
struct {long long tv_sec;} st_atim;
|
||||
struct {long long tv_sec;} st_mtim;
|
||||
struct {long long tv_sec;} st_ctim;
|
||||
} Tcl_StatBuf;
|
||||
#elif defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__)
|
||||
typedef struct stat64 Tcl_StatBuf;
|
||||
#else
|
||||
typedef struct stat Tcl_StatBuf;
|
||||
#endif
|
||||
|
||||
+4
-4
@@ -639,14 +639,14 @@ Tcl_CreateInterp(void)
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
if (sizeof(time_t) != 4) {
|
||||
if (sizeof(time_t) != 8) {
|
||||
/*NOTREACHED*/
|
||||
Tcl_Panic("<time.h> is not compatible with MSVC");
|
||||
Tcl_Panic("<time.h> is not compatible with VS2005+");
|
||||
}
|
||||
if ((offsetof(Tcl_StatBuf,st_atime) != 32)
|
||||
|| (offsetof(Tcl_StatBuf,st_ctime) != 40)) {
|
||||
|| (offsetof(Tcl_StatBuf,st_ctime) != 48)) {
|
||||
/*NOTREACHED*/
|
||||
Tcl_Panic("<sys/stat.h> is not compatible with MSVC");
|
||||
Tcl_Panic("<sys/stat.h> is not compatible with VS2005+");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Vendored
-152
@@ -6908,158 +6908,6 @@ _ACEOF
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${tcl_cv_type_64bit}" >&5
|
||||
$as_echo "${tcl_cv_type_64bit}" >&6; }
|
||||
|
||||
# Now check for auxiliary declarations
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct dirent64" >&5
|
||||
$as_echo_n "checking for struct dirent64... " >&6; }
|
||||
if ${tcl_cv_struct_dirent64+:} 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;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
tcl_cv_struct_dirent64=yes
|
||||
else
|
||||
tcl_cv_struct_dirent64=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_struct_dirent64" >&5
|
||||
$as_echo "$tcl_cv_struct_dirent64" >&6; }
|
||||
if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
|
||||
|
||||
$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 :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <sys/stat.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
struct stat64 p;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
tcl_cv_struct_stat64=yes
|
||||
else
|
||||
tcl_cv_struct_stat64=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_struct_stat64" >&5
|
||||
$as_echo "$tcl_cv_struct_stat64" >&6; }
|
||||
if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
|
||||
|
||||
$as_echo "#define HAVE_STRUCT_STAT64 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
for ac_func in open64 lseek64
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for off64_t" >&5
|
||||
$as_echo_n "checking for off64_t... " >&6; }
|
||||
if ${tcl_cv_type_off64_t+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <sys/types.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
off64_t offset;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
tcl_cv_type_off64_t=yes
|
||||
else
|
||||
tcl_cv_type_off64_t=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
|
||||
if test "x${tcl_cv_type_off64_t}" = "xyes" && \
|
||||
test "x${ac_cv_func_lseek64}" = "xyes" && \
|
||||
test "x${ac_cv_func_open64}" = "xyes" ; then
|
||||
|
||||
$as_echo "#define HAVE_TYPE_OFF64_T 1" >>confdefs.h
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
-46
@@ -2364,9 +2364,6 @@ AC_DEFUN([SC_TCL_EARLY_FLAGS],[
|
||||
# Might define the following vars:
|
||||
# TCL_WIDE_INT_IS_LONG
|
||||
# TCL_WIDE_INT_TYPE
|
||||
# HAVE_STRUCT_DIRENT64, HAVE_DIR64
|
||||
# HAVE_STRUCT_STAT64
|
||||
# HAVE_TYPE_OFF64_T
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
@@ -2390,49 +2387,6 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [
|
||||
AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
|
||||
[What type should be used to define wide integers?])
|
||||
AC_MSG_RESULT([${tcl_cv_type_64bit}])
|
||||
|
||||
# Now check for auxiliary declarations
|
||||
AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <dirent.h>],[struct dirent64 p;],
|
||||
tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
|
||||
if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
|
||||
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;
|
||||
],
|
||||
tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
|
||||
if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
|
||||
AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(open64 lseek64)
|
||||
AC_MSG_CHECKING([for off64_t])
|
||||
AC_CACHE_VAL(tcl_cv_type_off64_t,[
|
||||
AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
|
||||
],
|
||||
tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
|
||||
dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
|
||||
dnl functions lseek64 and open64 are defined.
|
||||
if test "x${tcl_cv_type_off64_t}" = "xyes" && \
|
||||
test "x${ac_cv_func_lseek64}" = "xyes" && \
|
||||
test "x${ac_cv_func_open64}" = "xyes" ; then
|
||||
AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
@@ -196,9 +196,6 @@
|
||||
/* Define to 1 if the system has the type `struct addrinfo'. */
|
||||
#undef HAVE_STRUCT_ADDRINFO
|
||||
|
||||
/* Is 'struct dirent64' in <sys/types.h>? */
|
||||
#undef HAVE_STRUCT_DIRENT64
|
||||
|
||||
/* Define to 1 if the system has the type `struct in6_addr'. */
|
||||
#undef HAVE_STRUCT_IN6_ADDR
|
||||
|
||||
@@ -208,9 +205,6 @@
|
||||
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
|
||||
#undef HAVE_STRUCT_SOCKADDR_STORAGE
|
||||
|
||||
/* Is 'struct stat64' in <sys/stat.h>? */
|
||||
#undef HAVE_STRUCT_STAT64
|
||||
|
||||
/* Define to 1 if `st_blksize' is member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
|
||||
@@ -253,9 +247,6 @@
|
||||
/* Should we use the tm_tzadj field of struct tm? */
|
||||
#undef HAVE_TM_TZADJ
|
||||
|
||||
/* Is off64_t in <sys/types.h>? */
|
||||
#undef HAVE_TYPE_OFF64_T
|
||||
|
||||
/* Do we have the uintptr_t type? */
|
||||
#undef HAVE_UINTPTR_T
|
||||
|
||||
|
||||
+10
-18
@@ -448,7 +448,7 @@ FileSeekProc(
|
||||
* Save our current place in case we need to roll-back the seek.
|
||||
*/
|
||||
|
||||
oldLoc = TclOSseek(fsPtr->fd, (Tcl_SeekOffset) 0, SEEK_CUR);
|
||||
oldLoc = lseek(fsPtr->fd, (off_t) 0, SEEK_CUR);
|
||||
if (oldLoc == -1) {
|
||||
/*
|
||||
* Bad things are happening. Error out...
|
||||
@@ -458,7 +458,7 @@ FileSeekProc(
|
||||
return -1;
|
||||
}
|
||||
|
||||
newLoc = TclOSseek(fsPtr->fd, (Tcl_SeekOffset) offset, mode);
|
||||
newLoc = lseek(fsPtr->fd, (off_t) offset, mode);
|
||||
|
||||
/*
|
||||
* Check for expressability in our return type, and roll-back otherwise.
|
||||
@@ -466,7 +466,7 @@ FileSeekProc(
|
||||
|
||||
if (newLoc > INT_MAX) {
|
||||
*errorCodePtr = EOVERFLOW;
|
||||
TclOSseek(fsPtr->fd, (Tcl_SeekOffset) oldLoc, SEEK_SET);
|
||||
lseek(fsPtr->fd, (off_t) oldLoc, SEEK_SET);
|
||||
return -1;
|
||||
} else {
|
||||
*errorCodePtr = (newLoc == -1) ? errno : 0;
|
||||
@@ -505,7 +505,7 @@ FileWideSeekProc(
|
||||
FileState *fsPtr = instanceData;
|
||||
Tcl_WideInt newLoc;
|
||||
|
||||
newLoc = TclOSseek(fsPtr->fd, (Tcl_SeekOffset) offset, mode);
|
||||
newLoc = lseek(fsPtr->fd, (off_t) offset, mode);
|
||||
|
||||
*errorCodePtr = (newLoc == -1) ? errno : 0;
|
||||
return newLoc;
|
||||
@@ -1666,7 +1666,7 @@ TclpOpenFileChannel(
|
||||
SET_BITS(mode, O_BINARY);
|
||||
#endif
|
||||
|
||||
fd = TclOSopen(native, mode, permissions);
|
||||
fd = open(native, mode, permissions);
|
||||
|
||||
if (fd < 0) {
|
||||
if (interp != NULL) {
|
||||
@@ -1847,12 +1847,12 @@ TclpGetDefaultStdChannel(
|
||||
* Some #def's to make the code a little clearer!
|
||||
*/
|
||||
|
||||
#define ZERO_OFFSET ((Tcl_SeekOffset) 0)
|
||||
#define ERROR_OFFSET ((Tcl_SeekOffset) -1)
|
||||
#define ZERO_OFFSET ((off_t) 0)
|
||||
#define ERROR_OFFSET ((off_t) -1)
|
||||
|
||||
switch (type) {
|
||||
case TCL_STDIN:
|
||||
if ((TclOSseek(0, ZERO_OFFSET, SEEK_CUR) == ERROR_OFFSET)
|
||||
if ((lseek(0, ZERO_OFFSET, SEEK_CUR) == ERROR_OFFSET)
|
||||
&& (errno == EBADF)) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -1861,7 +1861,7 @@ TclpGetDefaultStdChannel(
|
||||
bufMode = "line";
|
||||
break;
|
||||
case TCL_STDOUT:
|
||||
if ((TclOSseek(1, ZERO_OFFSET, SEEK_CUR) == ERROR_OFFSET)
|
||||
if ((lseek(1, ZERO_OFFSET, SEEK_CUR) == ERROR_OFFSET)
|
||||
&& (errno == EBADF)) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -1870,7 +1870,7 @@ TclpGetDefaultStdChannel(
|
||||
bufMode = "line";
|
||||
break;
|
||||
case TCL_STDERR:
|
||||
if ((TclOSseek(2, ZERO_OFFSET, SEEK_CUR) == ERROR_OFFSET)
|
||||
if ((lseek(2, ZERO_OFFSET, SEEK_CUR) == ERROR_OFFSET)
|
||||
&& (errno == EBADF)) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -2033,15 +2033,7 @@ FileTruncateProc(
|
||||
FileState *fsPtr = instanceData;
|
||||
int result;
|
||||
|
||||
#ifdef HAVE_TYPE_OFF64_T
|
||||
/*
|
||||
* We assume this goes with the type for now...
|
||||
*/
|
||||
|
||||
result = ftruncate64(fsPtr->fd, (off64_t) length);
|
||||
#else
|
||||
result = ftruncate(fsPtr->fd, (off_t) length);
|
||||
#endif
|
||||
if (result) {
|
||||
return errno;
|
||||
}
|
||||
|
||||
+16
-19
@@ -271,10 +271,7 @@ MODULE_SCOPE long tclMacOSXDarwinRelease;
|
||||
#endif /* NO_REALPATH */
|
||||
|
||||
#ifdef HAVE_FTS
|
||||
#if defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__)
|
||||
/* fts doesn't do stat64 */
|
||||
# define noFtsStat 1
|
||||
#elif defined(__APPLE__) && defined(__LP64__) && \
|
||||
#if defined(__APPLE__) && defined(__LP64__) && \
|
||||
defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
|
||||
MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||
/*
|
||||
@@ -367,27 +364,27 @@ DoRenameFile(
|
||||
|
||||
if (errno == EINVAL && haveRealpath) {
|
||||
char srcPath[MAXPATHLEN], dstPath[MAXPATHLEN];
|
||||
TclDIR *dirPtr;
|
||||
Tcl_DirEntry *dirEntPtr;
|
||||
DIR *dirPtr;
|
||||
struct dirent *dirEntPtr;
|
||||
|
||||
if ((Realpath((char *) src, srcPath) != NULL) /* INTL: Native. */
|
||||
&& (Realpath((char *) dst, dstPath) != NULL) /* INTL: Native */
|
||||
&& (strncmp(srcPath, dstPath, strlen(srcPath)) != 0)) {
|
||||
dirPtr = TclOSopendir(dst); /* INTL: Native. */
|
||||
dirPtr = opendir(dst); /* INTL: Native. */
|
||||
if (dirPtr != NULL) {
|
||||
while (1) {
|
||||
dirEntPtr = TclOSreaddir(dirPtr); /* INTL: Native. */
|
||||
dirEntPtr = readdir(dirPtr); /* INTL: Native. */
|
||||
if (dirEntPtr == NULL) {
|
||||
break;
|
||||
}
|
||||
if ((strcmp(dirEntPtr->d_name, ".") != 0) &&
|
||||
(strcmp(dirEntPtr->d_name, "..") != 0)) {
|
||||
errno = EEXIST;
|
||||
TclOSclosedir(dirPtr);
|
||||
closedir(dirPtr);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
TclOSclosedir(dirPtr);
|
||||
closedir(dirPtr);
|
||||
}
|
||||
}
|
||||
errno = EINVAL;
|
||||
@@ -564,11 +561,11 @@ TclUnixCopyFile(
|
||||
|
||||
#define DEFAULT_COPY_BLOCK_SIZE 4096
|
||||
|
||||
if ((srcFd = TclOSopen(src, O_RDONLY BINMODE, 0)) < 0) { /* INTL: Native */
|
||||
if ((srcFd = open(src, O_RDONLY BINMODE, 0)) < 0) { /* INTL: Native */
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
dstFd = TclOSopen(dst, O_CREAT|O_TRUNC|O_WRONLY BINMODE, /* INTL: Native */
|
||||
dstFd = open(dst, O_CREAT|O_TRUNC|O_WRONLY BINMODE, /* INTL: Native */
|
||||
statBufPtr->st_mode);
|
||||
if (dstFd < 0) {
|
||||
close(srcFd);
|
||||
@@ -962,8 +959,8 @@ TraverseUnixTree(
|
||||
size_t targetLen, sourceLen;
|
||||
#ifndef HAVE_FTS
|
||||
int numProcessed = 0;
|
||||
Tcl_DirEntry *dirEntPtr;
|
||||
TclDIR *dirPtr;
|
||||
struct dirent *dirEntPtr;
|
||||
DIR *dirPtr;
|
||||
#else
|
||||
const char *paths[2] = {NULL, NULL};
|
||||
FTS *fts = NULL;
|
||||
@@ -988,7 +985,7 @@ TraverseUnixTree(
|
||||
errorPtr);
|
||||
}
|
||||
#ifndef HAVE_FTS
|
||||
dirPtr = TclOSopendir(source); /* INTL: Native. */
|
||||
dirPtr = opendir(source); /* INTL: Native. */
|
||||
if (dirPtr == NULL) {
|
||||
/*
|
||||
* Can't read directory
|
||||
@@ -1000,7 +997,7 @@ TraverseUnixTree(
|
||||
result = traverseProc(sourcePtr, targetPtr, &statBuf, DOTREE_PRED,
|
||||
errorPtr);
|
||||
if (result != TCL_OK) {
|
||||
TclOSclosedir(dirPtr);
|
||||
closedir(dirPtr);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1012,7 +1009,7 @@ TraverseUnixTree(
|
||||
targetLen = Tcl_DStringLength(targetPtr);
|
||||
}
|
||||
|
||||
while ((dirEntPtr = TclOSreaddir(dirPtr)) != NULL) { /* INTL: Native. */
|
||||
while ((dirEntPtr = readdir(dirPtr)) != NULL) { /* INTL: Native. */
|
||||
if ((dirEntPtr->d_name[0] == '.')
|
||||
&& ((dirEntPtr->d_name[1] == '\0')
|
||||
|| (strcmp(dirEntPtr->d_name, "..") == 0))) {
|
||||
@@ -1050,11 +1047,11 @@ TraverseUnixTree(
|
||||
* NULL-return that may a symptom of a buggy readdir.
|
||||
*/
|
||||
|
||||
TclOSrewinddir(dirPtr);
|
||||
rewinddir(dirPtr);
|
||||
numProcessed = 0;
|
||||
}
|
||||
}
|
||||
TclOSclosedir(dirPtr);
|
||||
closedir(dirPtr);
|
||||
|
||||
/*
|
||||
* Strip off the trailing slash we added
|
||||
|
||||
+5
-5
@@ -259,8 +259,8 @@ TclpMatchInDirectory(
|
||||
Tcl_DecrRefCount(tailPtr);
|
||||
Tcl_DecrRefCount(fileNamePtr);
|
||||
} else {
|
||||
TclDIR *d;
|
||||
Tcl_DirEntry *entryPtr;
|
||||
DIR *d;
|
||||
struct dirent *entryPtr;
|
||||
const char *dirName;
|
||||
size_t dirLength, nativeDirLen;
|
||||
int matchHidden, matchHiddenPat;
|
||||
@@ -309,7 +309,7 @@ TclpMatchInDirectory(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
d = TclOSopendir(native); /* INTL: Native. */
|
||||
d = opendir(native); /* INTL: Native. */
|
||||
if (d == NULL) {
|
||||
Tcl_DStringFree(&ds);
|
||||
if (interp != NULL) {
|
||||
@@ -332,7 +332,7 @@ TclpMatchInDirectory(
|
||||
|| ((pattern[0] == '\\') && (pattern[1] == '.'));
|
||||
matchHidden = matchHiddenPat
|
||||
|| (types && (types->perm & TCL_GLOB_PERM_HIDDEN));
|
||||
while ((entryPtr = TclOSreaddir(d)) != NULL) { /* INTL: Native. */
|
||||
while ((entryPtr = readdir(d)) != NULL) { /* INTL: Native. */
|
||||
Tcl_DString utfDs;
|
||||
const char *utfname;
|
||||
|
||||
@@ -387,7 +387,7 @@ TclpMatchInDirectory(
|
||||
}
|
||||
}
|
||||
|
||||
TclOSclosedir(d);
|
||||
closedir(d);
|
||||
Tcl_DStringFree(&ds);
|
||||
Tcl_DStringFree(&dsOrig);
|
||||
Tcl_DecrRefCount(fileNamePtr);
|
||||
|
||||
+3
-3
@@ -362,13 +362,13 @@ TclpInitPlatform(void)
|
||||
* Make sure, that the standard FDs exist. [Bug 772288]
|
||||
*/
|
||||
|
||||
if (TclOSseek(0, (Tcl_SeekOffset) 0, SEEK_CUR) == -1 && errno == EBADF) {
|
||||
if (lseek(0, (off_t) 0, SEEK_CUR) == -1 && errno == EBADF) {
|
||||
open("/dev/null", O_RDONLY);
|
||||
}
|
||||
if (TclOSseek(1, (Tcl_SeekOffset) 0, SEEK_CUR) == -1 && errno == EBADF) {
|
||||
if (lseek(1, (off_t) 0, SEEK_CUR) == -1 && errno == EBADF) {
|
||||
open("/dev/null", O_WRONLY);
|
||||
}
|
||||
if (TclOSseek(2, (Tcl_SeekOffset) 0, SEEK_CUR) == -1 && errno == EBADF) {
|
||||
if (lseek(2, (off_t) 0, SEEK_CUR) == -1 && errno == EBADF) {
|
||||
open("/dev/null", O_WRONLY);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -142,7 +142,7 @@ TclpOpenFile(
|
||||
Tcl_DString ds;
|
||||
|
||||
native = Tcl_UtfToExternalDString(NULL, fname, -1, &ds);
|
||||
fd = TclOSopen(native, mode, 0666); /* INTL: Native. */
|
||||
fd = open(native, mode, 0666); /* INTL: Native. */
|
||||
Tcl_DStringFree(&ds);
|
||||
if (fd != -1) {
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
@@ -153,7 +153,7 @@ TclpOpenFile(
|
||||
*/
|
||||
|
||||
if ((mode & O_WRONLY) && !(mode & O_APPEND)) {
|
||||
TclOSseek(fd, (Tcl_SeekOffset) 0, SEEK_END);
|
||||
lseek(fd, (off_t) 0, SEEK_END);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -205,7 +205,7 @@ TclpCreateTempFile(
|
||||
return NULL;
|
||||
}
|
||||
Tcl_DStringFree(&dstring);
|
||||
TclOSseek(fd, (Tcl_SeekOffset) 0, SEEK_SET);
|
||||
lseek(fd, (off_t) 0, SEEK_SET);
|
||||
}
|
||||
return MakeFile(fd);
|
||||
}
|
||||
|
||||
@@ -56,35 +56,6 @@
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_STRUCT_DIRENT64
|
||||
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;
|
||||
# define TclOSopendir opendir
|
||||
# define TclOSrewinddir rewinddir
|
||||
# define TclOSclosedir closedir
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TYPE_OFF64_T
|
||||
typedef off64_t Tcl_SeekOffset;
|
||||
# define TclOSseek lseek64
|
||||
# define TclOSopen open64
|
||||
#else
|
||||
typedef off_t Tcl_SeekOffset;
|
||||
# define TclOSseek lseek
|
||||
# define TclOSopen open
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
|
||||
/* Make some symbols available without including <windows.h> */
|
||||
@@ -117,9 +88,6 @@ typedef off_t Tcl_SeekOffset;
|
||||
# define timezone _timezone
|
||||
extern int TclOSstat(const char *name, void *statBuf);
|
||||
extern int TclOSlstat(const char *name, void *statBuf);
|
||||
#elif defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__)
|
||||
# define TclOSstat stat64
|
||||
# define TclOSlstat lstat64
|
||||
#else
|
||||
# define TclOSstat stat
|
||||
# define TclOSlstat lstat
|
||||
|
||||
+7
-7
@@ -149,8 +149,8 @@ typedef struct {
|
||||
* Other typedefs required by this code.
|
||||
*/
|
||||
|
||||
static time_t ToCTime(FILETIME fileTime);
|
||||
static void FromCTime(time_t posixTime, FILETIME *fileTime);
|
||||
static __time64_t ToCTime(FILETIME fileTime);
|
||||
static void FromCTime(__time64_t posixTime, FILETIME *fileTime);
|
||||
|
||||
/*
|
||||
* Declarations for local functions defined in this file:
|
||||
@@ -2265,7 +2265,7 @@ NativeStatMode(
|
||||
*
|
||||
* ToCTime --
|
||||
*
|
||||
* Converts a Windows FILETIME to a time_t in UTC.
|
||||
* Converts a Windows FILETIME to a __time64_t in UTC.
|
||||
*
|
||||
* Results:
|
||||
* Returns the count of seconds from the Posix epoch.
|
||||
@@ -2273,7 +2273,7 @@ NativeStatMode(
|
||||
*------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static time_t
|
||||
static __time64_t
|
||||
ToCTime(
|
||||
FILETIME fileTime) /* UTC time */
|
||||
{
|
||||
@@ -2282,7 +2282,7 @@ ToCTime(
|
||||
convertedTime.LowPart = fileTime.dwLowDateTime;
|
||||
convertedTime.HighPart = (LONG) fileTime.dwHighDateTime;
|
||||
|
||||
return (time_t) ((convertedTime.QuadPart -
|
||||
return (__time64_t) ((convertedTime.QuadPart -
|
||||
(Tcl_WideInt) POSIX_EPOCH_AS_FILETIME) / (Tcl_WideInt) 10000000);
|
||||
}
|
||||
|
||||
@@ -2291,7 +2291,7 @@ ToCTime(
|
||||
*
|
||||
* FromCTime --
|
||||
*
|
||||
* Converts a time_t to a Windows FILETIME
|
||||
* Converts a __time64_t to a Windows FILETIME
|
||||
*
|
||||
* Results:
|
||||
* Returns the count of 100-ns ticks seconds from the Windows epoch.
|
||||
@@ -2301,7 +2301,7 @@ ToCTime(
|
||||
|
||||
static void
|
||||
FromCTime(
|
||||
time_t posixTime,
|
||||
__time64_t posixTime,
|
||||
FILETIME *fileTime) /* UTC Time */
|
||||
{
|
||||
LARGE_INTEGER convertedTime;
|
||||
|
||||
+1
-2
@@ -15,8 +15,7 @@
|
||||
#define _TCLWINPORT
|
||||
|
||||
#if !defined(_WIN64) && defined(BUILD_tcl)
|
||||
/* See [Bug 3354324]: file mtime sets wrong time */
|
||||
# define _USE_32BIT_TIME_T
|
||||
# define __MINGW_USE_VC2005_COMPAT
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user