| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef _TCLUNIXPORT |
| | #define _TCLUNIXPORT |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #include <errno.h> |
| | #include <fcntl.h> |
| | #ifdef HAVE_NET_ERRNO_H |
| | # include <net/errno.h> |
| | #endif |
| | #include <pwd.h> |
| | #include <signal.h> |
| | #ifdef HAVE_SYS_PARAM_H |
| | # include <sys/param.h> |
| | #endif |
| | #include <sys/types.h> |
| | #ifdef USE_DIRENT2_H |
| | # include "../compat/dirent2.h" |
| | #else |
| | #ifdef NO_DIRENT_H |
| | # include "../compat/dirent.h" |
| | #else |
| | # include <dirent.h> |
| | #endif |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #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__ |
| | #ifdef __cplusplus |
| | extern "C" { |
| | #endif |
| | |
| | # define DWORD unsigned int |
| | # define CP_UTF8 65001 |
| | # define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 |
| | # define HANDLE void * |
| | # define HINSTANCE void * |
| | # define SOCKET unsigned int |
| | # define WSAEWOULDBLOCK 10035 |
| | typedef unsigned short WCHAR; |
| | #ifdef __clang__ |
| | #pragma clang diagnostic push |
| | #pragma clang diagnostic ignored "-Wignored-attributes" |
| | #endif |
| | __declspec(dllimport) extern __stdcall int GetModuleHandleExW(unsigned int, const void *, void *); |
| | __declspec(dllimport) extern __stdcall int GetModuleFileNameW(void *, const void *, int); |
| | __declspec(dllimport) extern __stdcall int WideCharToMultiByte(int, int, const void *, int, |
| | char *, int, const char *, void *); |
| | __declspec(dllimport) extern __stdcall int MultiByteToWideChar(int, int, const char *, int, |
| | WCHAR *, int); |
| | __declspec(dllimport) extern __stdcall void OutputDebugStringW(const WCHAR *); |
| | __declspec(dllimport) extern __stdcall int IsDebuggerPresent(void); |
| | __declspec(dllimport) extern __stdcall int GetLastError(void); |
| | __declspec(dllimport) extern __stdcall int GetFileAttributesW(const WCHAR *); |
| | __declspec(dllimport) extern __stdcall int SetFileAttributesW(const WCHAR *, int); |
| | __declspec(dllimport) extern int cygwin_conv_path(int, const void *, void *, int); |
| | #ifdef __clang__ |
| | #pragma clang diagnostic pop |
| | #endif |
| | # define timezone _timezone |
| | extern int TclOSstat(const char *name, void *statBuf); |
| | extern int TclOSlstat(const char *name, void *statBuf); |
| | #ifdef __cplusplus |
| | } |
| | #endif |
| | #elif defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__) |
| | # define TclOSstat(name, buf) stat64(name, (struct stat64 *)buf) |
| | # define TclOSlstat(name,buf) lstat64(name, (struct stat64 *)buf) |
| | #else |
| | # define TclOSstat(name, buf) stat(name, (struct stat *)buf) |
| | # define TclOSlstat(name, buf) lstat(name, (struct stat *)buf) |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #include <sys/file.h> |
| | #ifdef HAVE_SYS_SELECT_H |
| | # include <sys/select.h> |
| | #endif |
| | #include <sys/stat.h> |
| | #ifdef TIME_WITH_SYS_TIME |
| | # include <sys/time.h> |
| | # include <time.h> |
| | #else |
| | #ifdef HAVE_SYS_TIME_H |
| | # include <sys/time.h> |
| | #else |
| | # include <time.h> |
| | #endif |
| | #endif |
| | #ifndef NO_SYS_WAIT_H |
| | # include <sys/wait.h> |
| | #endif |
| | #ifdef HAVE_INTTYPES_H |
| | # include <inttypes.h> |
| | #endif |
| | #include <limits.h> |
| | #ifdef HAVE_STDINT_H |
| | # include <stdint.h> |
| | #endif |
| | #ifdef HAVE_UNISTD_H |
| | # include <unistd.h> |
| | #else |
| | # include "../compat/unistd.h" |
| | #endif |
| |
|
| | extern int TclUnixSetBlockingMode(int fd, int mode); |
| |
|
| | #include <utime.h> |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #include <sys/socket.h> |
| | #ifndef NO_UNAME |
| | # include <sys/utsname.h> |
| | #endif |
| | #include <netinet/in.h> |
| | #include <arpa/inet.h> |
| | #include <netdb.h> |
| | #ifdef NEED_FAKE_RFC2553 |
| | # include "../compat/fake-rfc2553.h" |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef NO_FLOAT_H |
| | # include <float.h> |
| | #else |
| | #ifndef NO_VALUES_H |
| | # include <values.h> |
| | #endif |
| | #endif |
| |
|
| | #ifndef FLT_MAX |
| | # ifdef MAXFLOAT |
| | # define FLT_MAX MAXFLOAT |
| | # else |
| | # define FLT_MAX 3.402823466E+38F |
| | # endif |
| | #endif |
| | #ifndef FLT_MIN |
| | # ifdef MINFLOAT |
| | # define FLT_MIN MINFLOAT |
| | # else |
| | # define FLT_MIN 1.175494351E-38F |
| | # endif |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef O_NONBLOCK |
| | # define O_NONBLOCK 0x80 |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifdef _AIX |
| | # define WAIT_STATUS_TYPE pid_t |
| | #else |
| | #ifndef NO_UNION_WAIT |
| | # define WAIT_STATUS_TYPE union wait |
| | #else |
| | # define WAIT_STATUS_TYPE int |
| | #endif |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef WIFEXITED |
| | # define WIFEXITED(stat) (((*((int *) &(stat))) & 0xFF) == 0) |
| | #endif |
| |
|
| | #ifndef WEXITSTATUS |
| | # define WEXITSTATUS(stat) (((*((int *) &(stat))) >> 8) & 0xFF) |
| | #endif |
| |
|
| | #ifndef WIFSIGNALED |
| | # define WIFSIGNALED(stat) \ |
| | (((*((int *) &(stat)))) && ((*((int *) &(stat))) \ |
| | == ((*((int *) &(stat))) & 0x00FF))) |
| | #endif |
| |
|
| | #ifndef WTERMSIG |
| | # define WTERMSIG(stat) ((*((int *) &(stat))) & 0x7F) |
| | #endif |
| |
|
| | #ifndef WIFSTOPPED |
| | # define WIFSTOPPED(stat) (((*((int *) &(stat))) & 0xFF) == 0177) |
| | #endif |
| |
|
| | #ifndef WSTOPSIG |
| | # define WSTOPSIG(stat) (((*((int *) &(stat))) >> 8) & 0xFF) |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef WNOHANG |
| | # define WNOHANG 1 |
| | #endif |
| | #ifndef WUNTRACED |
| | # define WUNTRACED 2 |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef SEEK_SET |
| | # define SEEK_SET 0 |
| | #endif |
| | #ifndef SEEK_CUR |
| | # define SEEK_CUR 1 |
| | #endif |
| | #ifndef SEEK_END |
| | # define SEEK_END 2 |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifdef NO_GETTOD |
| | # include <sys/times.h> |
| | #else |
| | # ifdef HAVE_BSDGETTIMEOFDAY |
| | # define gettimeofday BSDgettimeofday |
| | # endif |
| | #endif |
| |
|
| | #ifdef GETTOD_NOT_DECLARED |
| | extern int gettimeofday(struct timeval *tp, |
| | struct timezone *tzp); |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef F_OK |
| | # define F_OK 00 |
| | #endif |
| | #ifndef X_OK |
| | # define X_OK 01 |
| | #endif |
| | #ifndef W_OK |
| | # define W_OK 02 |
| | #endif |
| | #ifndef R_OK |
| | # define R_OK 04 |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef FD_CLOEXEC |
| | # define FD_CLOEXEC 1 |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef S_IFLNK |
| | # undef TclOSlstat |
| | # define lstat stat |
| | # define lstat64 stat64 |
| | # define TclOSlstat TclOSstat |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef S_ISREG |
| | # ifdef S_IFREG |
| | # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) |
| | # else |
| | # define S_ISREG(m) 0 |
| | # endif |
| | #endif |
| | #ifndef S_ISDIR |
| | # ifdef S_IFDIR |
| | # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) |
| | # else |
| | # define S_ISDIR(m) 0 |
| | # endif |
| | #endif |
| | #ifndef S_ISCHR |
| | # ifdef S_IFCHR |
| | # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) |
| | # else |
| | # define S_ISCHR(m) 0 |
| | # endif |
| | #endif |
| |
|
| | #ifndef S_ISBLK |
| | # ifdef S_IFBLK |
| | # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) |
| | # else |
| | # define S_ISBLK(m) 0 |
| | # endif |
| | #endif |
| |
|
| | #ifndef S_ISFIFO |
| | # ifdef S_IFIFO |
| | # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) |
| | # else |
| | # define S_ISFIFO(m) 0 |
| | # endif |
| | #endif |
| |
|
| | #ifndef S_ISLNK |
| | # ifdef S_IFLNK |
| | # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) |
| | # else |
| | # define S_ISLNK(m) 0 |
| | # endif |
| | #endif |
| |
|
| | #ifndef S_ISSOCK |
| | # ifdef S_IFSOCK |
| | # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) |
| | # else |
| | # define S_ISSOCK(m) 0 |
| | # endif |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef MAXPATHLEN |
| | # ifdef PATH_MAX |
| | # define MAXPATHLEN PATH_MAX |
| | # else |
| | # define MAXPATHLEN 2048 |
| | # endif |
| | #endif |
| |
|
| | #ifndef MAXNAMLEN |
| | # ifdef NAME_MAX |
| | # define MAXNAMLEN NAME_MAX |
| | # else |
| | # define MAXNAMLEN 255 |
| | # endif |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef NO_FD_SET |
| | # define SELECT_MASK fd_set |
| | #else |
| | # ifndef _AIX |
| | typedef long fd_mask; |
| | # endif |
| | # if defined(_IBMR2) |
| | # define SELECT_MASK void |
| | # else |
| | # define SELECT_MASK int |
| | # endif |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef NBBY |
| | # define NBBY 8 |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef FD_SETSIZE |
| | # ifdef OPEN_MAX |
| | # define FD_SETSIZE OPEN_MAX |
| | # else |
| | # define FD_SETSIZE 256 |
| | # endif |
| | #endif |
| |
|
| | #ifndef howmany |
| | # define howmany(x, y) (((x)+((y)-1))/(y)) |
| | #endif |
| |
|
| | #ifndef NFDBITS |
| | # define NFDBITS NBBY*sizeof(fd_mask) |
| | #endif |
| |
|
| | #define MASK_SIZE howmany(FD_SETSIZE, NFDBITS) |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifdef NO_ERRNO |
| | extern int errno; |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef EOVERFLOW |
| | # ifdef EFBIG |
| | # define EOVERFLOW EFBIG |
| | # else |
| | # define EOVERFLOW EINVAL |
| | # endif |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #if defined(__APPLE__) && defined(__DYNAMIC__) |
| | # include <crt_externs.h> |
| | # define environ (*_NSGetEnviron()) |
| | # define USE_PUTENV 1 |
| | #else |
| | # if defined(_sgi) || defined(__sgi) |
| | # define environ _environ |
| | # endif |
| | extern char ** environ; |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifdef __APPLE__ |
| |
|
| | |
| | |
| | |
| | |
| | |
| |
|
| | # if defined(__LP64__) && defined (NO_COREFOUNDATION_64) |
| | # undef HAVE_COREFOUNDATION |
| | # endif |
| | # include <sys/cdefs.h> |
| | # ifdef __DARWIN_UNIX03 |
| | # if __DARWIN_UNIX03 |
| | # undef HAVE_PUTENV_THAT_COPIES |
| | # else |
| | # define HAVE_PUTENV_THAT_COPIES 1 |
| | # endif |
| | # endif |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | # ifdef HAVE_AVAILABILITYMACROS_H |
| | # include <AvailabilityMacros.h> |
| | # endif |
| |
|
| | |
| | |
| | |
| | |
| | |
| |
|
| | # ifdef HAVE_WEAK_IMPORT |
| | # if !defined(HAVE_AVAILABILITYMACROS_H) || !defined(MAC_OS_X_VERSION_MIN_REQUIRED) |
| | # undef HAVE_WEAK_IMPORT |
| | # else |
| | # ifndef WEAK_IMPORT_ATTRIBUTE |
| | # define WEAK_IMPORT_ATTRIBUTE __attribute__((weak_import)) |
| | # endif |
| | # endif |
| | # endif |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | # ifdef MAC_OS_X_VERSION_MAX_ALLOWED |
| | # if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 && defined(__LP64__) |
| | # undef HAVE_COREFOUNDATION |
| | # endif |
| | # if MAC_OS_X_VERSION_MAX_ALLOWED < 1040 |
| | # undef HAVE_OSSPINLOCKLOCK |
| | # undef HAVE_PTHREAD_ATFORK |
| | # undef HAVE_COPYFILE |
| | # endif |
| | # if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 |
| | # ifdef TCL_THREADS |
| | |
| | # define NO_REALPATH 1 |
| | # endif |
| | # undef HAVE_LANGINFO |
| | # endif |
| | # endif |
| | # if defined(HAVE_COREFOUNDATION) && defined(__LP64__) && \ |
| | defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050 |
| | # warning "Weak import of 64-bit CoreFoundation is not supported, will not run on Mac OS X < 10.5." |
| | # endif |
| | |
| | |
| | |
| | |
| | |
| | # undef HAVE_POSIX_SPAWNP |
| | # undef HAVE_VFORK |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | |
| | |
| | |
| |
|
| | #ifdef DJGPP |
| | #define TCL_PLATFORM_TRANSLATION TCL_TRANSLATE_CRLF |
| | typedef int socklen_t; |
| | #else |
| | #define TCL_PLATFORM_TRANSLATION TCL_TRANSLATE_LF |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #define TclpReleaseFile(file) |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #define TclpSysAlloc(size, isBin) malloc((size_t)(size)) |
| | #define TclpSysFree(ptr) free((char *)(ptr)) |
| | #define TclpSysRealloc(ptr, size) realloc((char *)(ptr), (size_t)(size)) |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #define TclpExit exit |
| |
|
| | #ifdef TCL_THREADS |
| | # include <pthread.h> |
| | #endif |
| |
|
| | |
| | #ifndef AF_INET6 |
| | # define AF_INET6 10 |
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #include <pwd.h> |
| | #include <grp.h> |
| |
|
| | extern struct passwd * TclpGetPwNam(const char *name); |
| | extern struct group * TclpGetGrNam(const char *name); |
| | extern struct passwd * TclpGetPwUid(uid_t uid); |
| | extern struct group * TclpGetGrGid(gid_t gid); |
| | extern struct hostent * TclpGetHostByName(const char *name); |
| | extern struct hostent * TclpGetHostByAddr(const char *addr, |
| | int length, int type); |
| | extern void *TclpMakeTcpClientChannelMode( |
| | void *tcpSocket, int mode); |
| |
|
| | #endif |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|