diff options
author | stanton <stanton> | 1999-04-16 00:46:29 (GMT) |
---|---|---|
committer | stanton <stanton> | 1999-04-16 00:46:29 (GMT) |
commit | 97464e6cba8eb0008cf2727c15718671992b913f (patch) | |
tree | ce9959f2747257d98d52ec8d18bf3b0de99b9535 /unix/tclUnixPort.h | |
parent | a8c96ddb94d1483a9de5e340b740cb74ef6cafa7 (diff) | |
download | tcl-97464e6cba8eb0008cf2727c15718671992b913f.zip tcl-97464e6cba8eb0008cf2727c15718671992b913f.tar.gz tcl-97464e6cba8eb0008cf2727c15718671992b913f.tar.bz2 |
merged tcl 8.1 branch back into the main trunk
Diffstat (limited to 'unix/tclUnixPort.h')
-rw-r--r-- | unix/tclUnixPort.h | 136 |
1 files changed, 87 insertions, 49 deletions
diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 6ab38ee..89ebf7f 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -14,12 +14,12 @@ * by Karl Lehenbauer, Mark Diekhans and Peter da Silva. * * Copyright (c) 1991-1994 The Regents of the University of California. - * Copyright (c) 1994-1995 Sun Microsystems, Inc. + * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * 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.10 1999/03/11 00:19:24 stanton Exp $ + * RCS: @(#) $Id: tclUnixPort.h,v 1.11 1999/04/16 00:48:05 stanton Exp $ */ #ifndef _TCLUNIXPORT @@ -28,6 +28,14 @@ #ifndef _TCLINT # include "tclInt.h" #endif + +/* + *--------------------------------------------------------------------------- + * The following sets of #includes and #ifdefs are required to get Tcl to + * compile under the various flavors of unix. + *--------------------------------------------------------------------------- + */ + #include <errno.h> #include <fcntl.h> #ifdef HAVE_NET_ERRNO_H @@ -35,16 +43,18 @@ #endif #include <pwd.h> #include <signal.h> -#include <sys/param.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 +#ifdef NO_DIRENT_H +# include "../compat/dirent.h" +#else +# include <dirent.h> +#endif #endif #include <sys/file.h> #ifdef HAVE_SYS_SELECT_H @@ -55,11 +65,11 @@ # include <sys/time.h> # include <time.h> #else -# if HAVE_SYS_TIME_H -# include <sys/time.h> -# else -# include <time.h> -# endif +#if HAVE_SYS_TIME_H +# include <sys/time.h> +#else +# include <time.h> +#endif #endif #ifndef NO_SYS_WAIT_H # include <sys/wait.h> @@ -70,7 +80,6 @@ # include "../compat/unistd.h" #endif #ifdef USE_FIONBIO - /* * Not using the Posix fcntl(...,O_NONBLOCK,...) interface, instead * we are using ioctl(..,FIONBIO,..). @@ -105,11 +114,11 @@ */ #ifndef NO_FLOAT_H -#include <float.h> +# include <float.h> #else -# ifndef NO_VALUES_H -# include <values.h> -# endif +#ifndef NO_VALUES_H +# include <values.h> +#endif #endif #ifndef FLT_MAX @@ -148,20 +157,6 @@ #endif /* - * The default platform eol translation on Unix is TCL_TRANSLATE_LF: - */ - -#define TCL_PLATFORM_TRANSLATION TCL_TRANSLATE_LF - -/* - * Not all systems declare the errno variable in errno.h. so this - * file does it explicitly. The list of system error messages also - * isn't generally declared in a header file anywhere. - */ - -extern int errno; - -/* * The type of the status returned by wait varies from UNIX system * to UNIX system. The macro below defines it: */ @@ -225,21 +220,18 @@ extern int errno; #ifndef SEEK_SET # define SEEK_SET 0 #endif - #ifndef SEEK_CUR # define SEEK_CUR 1 #endif - #ifndef SEEK_END # define SEEK_END 2 #endif /* - * The stuff below is needed by the "time" command. If this - * system has no gettimeofday call, then must use times and the - * CLK_TCK #define (from sys/param.h) to compute elapsed time. - * Unfortunately, some systems only have HZ and no CLK_TCK, and - * some might not even have HZ. + * The stuff below is needed by the "time" command. If this system has no + * gettimeofday call, then must use times and the CLK_TCK #define (from + * sys/param.h) to compute elapsed time. Unfortunately, some systems only + * have HZ and no CLK_TCK, and some might not even have HZ. */ #ifdef NO_GETTOD @@ -295,7 +287,7 @@ EXTERN int gettimeofday _ANSI_ARGS_((struct timeval *tp, */ #ifndef S_IFLNK -# define lstat stat +# define lstat stat #endif /* @@ -419,16 +411,19 @@ EXTERN int gettimeofday _ANSI_ARGS_((struct timeval *tp, #define MASK_SIZE howmany(FD_SETSIZE, NFDBITS) /* - * The following implements the Unix method for exiting the process. + * Not all systems declare the errno variable in errno.h. so this + * file does it explicitly. The list of system error messages also + * isn't generally declared in a header file anywhere. */ -#define TclPlatformExit(status) exit(status) + +extern int errno; /* * Variables provided by the C library: */ #if defined(_sgi) || defined(__sgi) -#define environ _environ +# define environ _environ #endif extern char **environ; @@ -443,20 +438,63 @@ extern char **environ; extern double strtod(); /* - * The following macros define time related functions in terms of - * standard Unix routines. + *--------------------------------------------------------------------------- + * The following macros and declarations represent the interface between + * generic and unix-specific parts of Tcl. Some of the macros may override + * functions declared in tclInt.h. + *--------------------------------------------------------------------------- */ -#define TclpGetPid(pid) ((unsigned long) (pid)) +/* + * The default platform eol translation on Unix is TCL_TRANSLATE_LF. + */ -#define TclpReleaseFile(file) +#define TCL_PLATFORM_TRANSLATION TCL_TRANSLATE_LF /* - * The following defines stub out functions that aren't needed on Unix. + * The following macros have trivial definitions, allowing generic code to + * address platform-specific issues. */ -#define TclpFinalize() #define TclpAsyncMark(async) +#define TclpGetPid(pid) ((unsigned long) (pid)) +#define TclpReleaseFile(file) /* Nothing. */ + +/* + * The following macros and declaration wrap the C runtime library + * functions. + */ + +#define TclpExit exit + +#ifdef TclpStat +#undef TclpStat +#endif + +EXTERN int TclpLstat _ANSI_ARGS_((CONST char *path, + struct stat *buf)); +EXTERN int TclpStat _ANSI_ARGS_((CONST char *path, + struct stat *buf)); + +/* + * Platform specific mutex definition used by memory allocators. + * These mutexes are statically allocated and explicitly initialized. + * Most modules do not use this, but instead use Tcl_Mutex types and + * Tcl_MutexLock and Tcl_MutexUnlock that are self-initializing. + */ + +#ifdef TCL_THREADS +#include <pthread.h> +typedef pthread_mutex_t TclpMutex; +EXTERN void TclpMutexInit _ANSI_ARGS_((TclpMutex *mPtr)); +EXTERN void TclpMutexLock _ANSI_ARGS_((TclpMutex *mPtr)); +EXTERN void TclpMutexUnlock _ANSI_ARGS_((TclpMutex *mPtr)); +#else +typedef int TclpMutex; +#define TclpMutexInit(a) +#define TclpMutexLock(a) +#define TclpMutexUnlock(a) +#endif /* TCL_THREADS */ #include "tclPlatDecls.h" #include "tclIntPlatDecls.h" |