summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-04 14:50:05 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-04 14:50:05 (GMT)
commit1cbe41a90cc155259e98e2e4ed1cfdae770d19a6 (patch)
tree09a887b9d2dbdf1d0aadc016d311022eeea7008b /generic
parent5cc8272056a2950e552b579f4717b123a9578bdc (diff)
downloadtcl-1cbe41a90cc155259e98e2e4ed1cfdae770d19a6.zip
tcl-1cbe41a90cc155259e98e2e4ed1cfdae770d19a6.tar.gz
tcl-1cbe41a90cc155259e98e2e4ed1cfdae770d19a6.tar.bz2
implement TclpGetPid for Cygwin
Diffstat (limited to 'generic')
-rw-r--r--generic/tclInt.decls28
-rw-r--r--generic/tclIntPlatDecls.h74
-rw-r--r--generic/tclStubInit.c18
3 files changed, 100 insertions, 20 deletions
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index d380270..b7c7ee4 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -978,8 +978,9 @@ declare 7 unix {
int TclWinSetSockOpt(void *s, int level, int optname,
const char *optval, int optlen)
}
+# On non-cygwin, this is actually a reference to TclUnixWaitForFile
declare 8 unix {
- int TclUnixWaitForFile(int fd, int mask, int timeout)
+ unsigned long TclpGetPid(Tcl_Pid pid)
}
# Added in 8.1:
@@ -1049,7 +1050,30 @@ declare 30 unix {
declare 31 unix {
int TclpCloseFile(TclFile file)
}
-
+#declare 32 unix {
+# Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
+# TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)
+#}
+#declare 33 unix {
+# int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe)
+#}
+declare 34 unix {
+ int TclpCreateProcess (Tcl_Interp *interp,
+ int argc, const char **argv, TclFile inputFile,
+ TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr)
+}
+#declare 35 unix {
+# char *TclpInetNtoa(struct in_addr addr)
+#}
+declare 36 unix {
+ TclFile TclpMakeFile (Tcl_Channel channel, int direction)
+}
+declare 37 unix {
+ TclFile TclpOpenFile (const char *fname, int mode)
+}
+declare 38 unix {
+ int TclUnixWaitForFile(int fd, int mask, int timeout)
+}
# Local Variables:
# mode: tcl
diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h
index 7ce711d..50c546c 100644
--- a/generic/tclIntPlatDecls.h
+++ b/generic/tclIntPlatDecls.h
@@ -13,16 +13,6 @@
#ifndef _TCLINTPLATDECLS
#define _TCLINTPLATDECLS
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
-EXTERN int TclpCreateProcess _ANSI_ARGS_((Tcl_Interp *interp,
- int argc, CONST char **argv, TclFile inputFile,
- TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr));
-EXTERN TclFile TclpMakeFile _ANSI_ARGS_((Tcl_Channel channel,
- int direction));
-EXTERN TclFile TclpOpenFile _ANSI_ARGS_((CONST char *fname,
- int mode));
-#endif
-
/*
* WARNING: This file is automatically generated by the tools/genStubs.tcl
* script. Any modifications to the function declarations below should be made
@@ -58,8 +48,7 @@ EXTERN unsigned short TclWinNToHS _ANSI_ARGS_((unsigned short ns));
EXTERN int TclWinSetSockOpt _ANSI_ARGS_((VOID *s, int level,
int optname, CONST char *optval, int optlen));
/* 8 */
-EXTERN int TclUnixWaitForFile _ANSI_ARGS_((int fd, int mask,
- int timeout));
+EXTERN unsigned long TclpGetPid _ANSI_ARGS_((Tcl_Pid pid));
/* 9 */
EXTERN int TclWinGetPlatformId _ANSI_ARGS_((void));
/* 10 */
@@ -110,6 +99,23 @@ EXTERN void TclGetAndDetachPids _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Channel chan));
/* 31 */
EXTERN int TclpCloseFile _ANSI_ARGS_((TclFile file));
+/* Slot 32 is reserved */
+/* Slot 33 is reserved */
+/* 34 */
+EXTERN int TclpCreateProcess _ANSI_ARGS_((Tcl_Interp *interp,
+ int argc, CONST char **argv,
+ TclFile inputFile, TclFile outputFile,
+ TclFile errorFile, Tcl_Pid *pidPtr));
+/* Slot 35 is reserved */
+/* 36 */
+EXTERN TclFile TclpMakeFile _ANSI_ARGS_((Tcl_Channel channel,
+ int direction));
+/* 37 */
+EXTERN TclFile TclpOpenFile _ANSI_ARGS_((CONST char *fname,
+ int mode));
+/* 38 */
+EXTERN int TclUnixWaitForFile _ANSI_ARGS_((int fd, int mask,
+ int timeout));
#endif /* UNIX */
#ifdef __WIN32__
/* 0 */
@@ -267,7 +273,7 @@ typedef struct TclIntPlatStubs {
VOID *reserved5;
unsigned short (*tclWinNToHS) _ANSI_ARGS_((unsigned short ns)); /* 6 */
int (*tclWinSetSockOpt) _ANSI_ARGS_((VOID *s, int level, int optname, CONST char *optval, int optlen)); /* 7 */
- int (*tclUnixWaitForFile) _ANSI_ARGS_((int fd, int mask, int timeout)); /* 8 */
+ unsigned long (*tclpGetPid) _ANSI_ARGS_((Tcl_Pid pid)); /* 8 */
int (*tclWinGetPlatformId) _ANSI_ARGS_((void)); /* 9 */
Tcl_DirEntry * (*tclpReaddir) _ANSI_ARGS_((DIR *dir)); /* 10 */
struct tm * (*tclpLocaltime_unix) _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 11 */
@@ -291,6 +297,13 @@ typedef struct TclIntPlatStubs {
int (*tclWinCPUID) _ANSI_ARGS_((unsigned int index, unsigned int *regs)); /* 29 */
void (*tclGetAndDetachPids) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 30 */
int (*tclpCloseFile) _ANSI_ARGS_((TclFile file)); /* 31 */
+ VOID *reserved32;
+ VOID *reserved33;
+ int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr)); /* 34 */
+ VOID *reserved35;
+ TclFile (*tclpMakeFile) _ANSI_ARGS_((Tcl_Channel channel, int direction)); /* 36 */
+ TclFile (*tclpOpenFile) _ANSI_ARGS_((CONST char *fname, int mode)); /* 37 */
+ int (*tclUnixWaitForFile) _ANSI_ARGS_((int fd, int mask, int timeout)); /* 38 */
#endif /* UNIX */
#ifdef __WIN32__
void (*tclWinConvertError) _ANSI_ARGS_((DWORD errCode)); /* 0 */
@@ -399,9 +412,9 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr;
#define TclWinSetSockOpt \
(tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */
#endif
-#ifndef TclUnixWaitForFile
-#define TclUnixWaitForFile \
- (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
+#ifndef TclpGetPid
+#define TclpGetPid \
+ (tclIntPlatStubsPtr->tclpGetPid) /* 8 */
#endif
#ifndef TclWinGetPlatformId
#define TclWinGetPlatformId \
@@ -477,6 +490,25 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr;
#define TclpCloseFile \
(tclIntPlatStubsPtr->tclpCloseFile) /* 31 */
#endif
+/* Slot 32 is reserved */
+/* Slot 33 is reserved */
+#ifndef TclpCreateProcess
+#define TclpCreateProcess \
+ (tclIntPlatStubsPtr->tclpCreateProcess) /* 34 */
+#endif
+/* Slot 35 is reserved */
+#ifndef TclpMakeFile
+#define TclpMakeFile \
+ (tclIntPlatStubsPtr->tclpMakeFile) /* 36 */
+#endif
+#ifndef TclpOpenFile
+#define TclpOpenFile \
+ (tclIntPlatStubsPtr->tclpOpenFile) /* 37 */
+#endif
+#ifndef TclUnixWaitForFile
+#define TclUnixWaitForFile \
+ (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 38 */
+#endif
#endif /* UNIX */
#ifdef __WIN32__
#ifndef TclWinConvertError
@@ -703,7 +735,14 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr;
#undef TclpLocaltime_unix
#undef TclpGmtime_unix
-#if !defined(__WIN32__) && !defined(MAC_TCL) && defined(USE_TCL_STUBS)
+#if !defined(__WIN32__) && !defined(MAC_TCL)
+# undef TclpGetPid
+# define TclpGetPid(pid) ((unsigned long) (pid))
+
+# if defined(USE_TCL_STUBS)
+# undef TclpCreateProcess
+# undef TclpMakeFile
+# undef TclpOpenFile
# ifdef __CYGWIN__
# define TclpCreateProcess ((int (*) _ANSI_ARGS_((Tcl_Interp *, int, \
CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *))) \
@@ -732,6 +771,7 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr;
# define TclpCloseFile ((int (*) _ANSI_ARGS_((TclFile))) \
tclIntPlatStubsPtr->tclWinConvertWSAError)
# endif
+# endif
#endif
#endif /* _TCLINTPLATDECLS */
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index cbb89a2..50fc9eb 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -31,6 +31,7 @@
#undef Tcl_ValidateAllMemory
#undef Tcl_FindHashEntry
#undef Tcl_CreateHashEntry
+#undef TclpGetPid
/*
* Keep a record of the original Notifier procedures, created in the
@@ -85,6 +86,7 @@ int __stdcall GetModuleHandleExW(unsigned int, const char *, void *);
#define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing
#define TclWinFlushDirtyChannels doNothing
#define TclWinResetInterfaces doNothing
+#define TclpGetPid getPid
static Tcl_Encoding winTCharEncoding;
@@ -130,6 +132,12 @@ TclWinNoBackslash(char *path)
return path;
}
+static unsigned long
+TclpGetPid(Tcl_Pid pid)
+{
+ return (unsigned long) (size_t) pid;
+}
+
static void
doNothing(void)
{
@@ -186,6 +194,7 @@ Tcl_WinTCharToUtf(
# define TclWinSetInterfaces 0
# define TclWinFlushDirtyChannels 0
# define TclWinResetInterfaces 0
+# define TclpGetPid 0
# define TclMacOSXGetFileAttribute 0 /* Only implemented in Tcl >= 8.5 */
# define TclMacOSXMatchType 0 /* Only implemented in Tcl >= 8.5 */
# define TclMacOSXNotifierAddRunLoopMode 0 /* Only implemented in Tcl >= 8.5 */
@@ -454,7 +463,7 @@ TclIntPlatStubs tclIntPlatStubs = {
NULL, /* 5 */
TclWinNToHS, /* 6 */
TclWinSetSockOpt, /* 7 */
- TclUnixWaitForFile, /* 8 */
+ TclpGetPid, /* 8 */
TclWinGetPlatformId, /* 9 */
TclpReaddir, /* 10 */
TclpLocaltime_unix, /* 11 */
@@ -478,6 +487,13 @@ TclIntPlatStubs tclIntPlatStubs = {
TclWinCPUID, /* 29 */
TclGetAndDetachPids, /* 30 */
TclpCloseFile, /* 31 */
+ NULL, /* 32 */
+ NULL, /* 33 */
+ TclpCreateProcess, /* 34 */
+ NULL, /* 35 */
+ TclpMakeFile, /* 36 */
+ TclpOpenFile, /* 37 */
+ TclUnixWaitForFile, /* 38 */
#endif /* UNIX */
#ifdef __WIN32__
TclWinConvertError, /* 0 */