summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-11-20 20:07:43 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-11-20 20:07:43 (GMT)
commite043c623f79de150a3f1230d95d4d66d6d9da62c (patch)
tree4412d9a45167b471a9b3efb92230e9d46d6321f8
parenteec237466690316958a6a7686e5ba5030992a358 (diff)
downloadtcl-e043c623f79de150a3f1230d95d4d66d6d9da62c.zip
tcl-e043c623f79de150a3f1230d95d4d66d6d9da62c.tar.gz
tcl-e043c623f79de150a3f1230d95d4d66d6d9da62c.tar.bz2
Fix TclpGetPid() signature (should use Tcl_Size, not size_t)
-rw-r--r--generic/tclInt.decls4
-rw-r--r--generic/tclIntPlatDecls.h8
-rw-r--r--generic/tclPipe.c2
-rw-r--r--generic/tclProcess.c10
-rw-r--r--generic/tclStubInit.c6
-rw-r--r--unix/tclUnixPipe.c4
-rw-r--r--win/tclWinPipe.c16
7 files changed, 25 insertions, 25 deletions
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index 36c6159..7c8ea15 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -759,7 +759,7 @@ declare 7 {
TclFile TclpOpenFile(const char *fname, int mode)
}
declare 8 {
- size_t TclpGetPid(Tcl_Pid pid)
+ Tcl_Size TclpGetPid(Tcl_Pid pid)
}
declare 9 {
TclFile TclpCreateTempFile(const char *contents)
@@ -780,7 +780,7 @@ declare 17 {
const Tcl_StatBuf *statBufPtr, int dontCopyAtts)
}
declare 20 {
- void TclWinAddProcess(void *hProcess, size_t id)
+ void TclWinAddProcess(void *hProcess, Tcl_Size id)
}
declare 24 {
char *TclWinNoBackslash(char *path)
diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h
index c935302..eb27932 100644
--- a/generic/tclIntPlatDecls.h
+++ b/generic/tclIntPlatDecls.h
@@ -587,7 +587,7 @@ EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction);
/* 7 */
EXTERN TclFile TclpOpenFile(const char *fname, int mode);
/* 8 */
-EXTERN size_t TclpGetPid(Tcl_Pid pid);
+EXTERN Tcl_Size TclpGetPid(Tcl_Pid pid);
/* 9 */
EXTERN TclFile TclpCreateTempFile(const char *contents);
/* Slot 10 is reserved */
@@ -611,7 +611,7 @@ EXTERN int TclUnixCopyFile(const char *src, const char *dst,
/* Slot 18 is reserved */
/* Slot 19 is reserved */
/* 20 */
-EXTERN void TclWinAddProcess(void *hProcess, size_t id);
+EXTERN void TclWinAddProcess(void *hProcess, Tcl_Size id);
/* Slot 21 is reserved */
/* Slot 22 is reserved */
/* Slot 23 is reserved */
@@ -641,7 +641,7 @@ typedef struct TclIntPlatStubs {
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 5 */
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 7 */
- size_t (*tclpGetPid) (Tcl_Pid pid); /* 8 */
+ Tcl_Size (*tclpGetPid) (Tcl_Pid pid); /* 8 */
TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */
void (*reserved10)(void);
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 11 */
@@ -653,7 +653,7 @@ typedef struct TclIntPlatStubs {
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 17 */
void (*reserved18)(void);
void (*reserved19)(void);
- void (*tclWinAddProcess) (void *hProcess, size_t id); /* 20 */
+ void (*tclWinAddProcess) (void *hProcess, Tcl_Size id); /* 20 */
void (*reserved21)(void);
void (*reserved22)(void);
void (*reserved23)(void);
diff --git a/generic/tclPipe.c b/generic/tclPipe.c
index 7e51d57..854ecd5 100644
--- a/generic/tclPipe.c
+++ b/generic/tclPipe.c
@@ -975,7 +975,7 @@ TclCreatePipeline(
}
if (pidPtr != NULL) {
for (i = 0; i < numPids; i++) {
- if (pidPtr[i] != (Tcl_Pid) -1) {
+ if (pidPtr[i] != (Tcl_Pid)-1) {
Tcl_DetachPids(1, &pidPtr[i]);
}
}
diff --git a/generic/tclProcess.c b/generic/tclProcess.c
index b621e31..b16c73d 100644
--- a/generic/tclProcess.c
+++ b/generic/tclProcess.c
@@ -44,10 +44,10 @@ TCL_DECLARE_MUTEX(infoTablesMutex)
*/
static void InitProcessInfo(ProcessInfo *info, Tcl_Pid pid,
- int resolvedPid);
+ Tcl_Size resolvedPid);
static void FreeProcessInfo(ProcessInfo *info);
static int RefreshProcessInfo(ProcessInfo *info, int options);
-static TclProcessWaitStatus WaitProcessStatus(Tcl_Pid pid, size_t resolvedPid,
+static TclProcessWaitStatus WaitProcessStatus(Tcl_Pid pid, Tcl_Size resolvedPid,
int options, int *codePtr, Tcl_Obj **msgPtr,
Tcl_Obj **errorObjPtr);
static Tcl_Obj * BuildProcessStatusObj(ProcessInfo *info);
@@ -76,7 +76,7 @@ void
InitProcessInfo(
ProcessInfo *info, /* Structure to initialize. */
Tcl_Pid pid, /* Process id. */
- int resolvedPid) /* Resolved process id. */
+ Tcl_Size resolvedPid) /* Resolved process id. */
{
info->pid = pid;
info->resolvedPid = resolvedPid;
@@ -185,7 +185,7 @@ RefreshProcessInfo(
TclProcessWaitStatus
WaitProcessStatus(
Tcl_Pid pid, /* Process id. */
- size_t resolvedPid, /* Resolved process id. */
+ Tcl_Size resolvedPid, /* Resolved process id. */
int options, /* Options passed to Tcl_WaitPid. */
int *codePtr, /* If non-NULL, will receive either:
* - 0 for normal exit.
@@ -789,7 +789,7 @@ void
TclProcessCreated(
Tcl_Pid pid) /* Process id. */
{
- size_t resolvedPid;
+ Tcl_Size resolvedPid;
Tcl_HashEntry *entry, *entry2;
int isNew;
ProcessInfo *info;
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 754023c..6ee2c7a 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -294,7 +294,7 @@ doNothing(void)
{
/* dummy implementation, no need to do anything */
}
-# define TclWinAddProcess (void (*) (void *, size_t)) doNothing
+# define TclWinAddProcess (void (*) (void *, Tcl_Size)) doNothing
# define TclWinFlushDirtyChannels doNothing
#define TclWinNoBackslash winNoBackslash
@@ -319,10 +319,10 @@ void *TclWinGetTclInstance()
return hInstance;
}
-size_t
+Tcl_Size
TclpGetPid(Tcl_Pid pid)
{
- return (size_t)pid;
+ return (Tcl_Size)PTR2INT(pid);
}
#if defined(TCL_WIDE_INT_IS_LONG)
diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c
index 08f60b2..a889f1d 100644
--- a/unix/tclUnixPipe.c
+++ b/unix/tclUnixPipe.c
@@ -638,7 +638,7 @@ TclpCreateProcess(
}
TclpCloseFile(errPipeIn);
- *pidPtr = (Tcl_Pid) INT2PTR(pid);
+ *pidPtr = (Tcl_Pid)INT2PTR(pid);
return TCL_OK;
error:
@@ -1342,7 +1342,7 @@ Tcl_WaitPid(
while (1) {
result = (int) waitpid(real_pid, statPtr, options);
if ((result != -1) || (errno != EINTR)) {
- return (Tcl_Pid) INT2PTR(result);
+ return (Tcl_Pid)INT2PTR(result);
}
}
}
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index 9f889b2..157547f 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -61,7 +61,7 @@ typedef struct {
typedef struct ProcInfo {
HANDLE hProcess;
- size_t dwProcessId;
+ int dwProcessId;
struct ProcInfo *nextPtr;
} ProcInfo;
@@ -864,7 +864,7 @@ TclpCloseFile(
*--------------------------------------------------------------------------
*/
-size_t
+Tcl_Size
TclpGetPid(
Tcl_Pid pid) /* The HANDLE of the child process. */
{
@@ -874,13 +874,13 @@ TclpGetPid(
Tcl_MutexLock(&pipeMutex);
for (infoPtr = procList; infoPtr != NULL; infoPtr = infoPtr->nextPtr) {
- if (infoPtr->dwProcessId == (size_t)pid) {
+ if (infoPtr->dwProcessId == (Tcl_Size)pid) {
Tcl_MutexUnlock(&pipeMutex);
return infoPtr->dwProcessId;
}
}
Tcl_MutexUnlock(&pipeMutex);
- return TCL_INDEX_NONE;
+ return -1;
}
/*
@@ -1168,7 +1168,7 @@ TclpCreateProcess(
WaitForInputIdle(procInfo.hProcess, 5000);
CloseHandle(procInfo.hThread);
- *pidPtr = (Tcl_Pid) (size_t) procInfo.dwProcessId;
+ *pidPtr = (Tcl_Pid)INT2PTR(procInfo.dwProcessId);
if (*pidPtr != 0) {
TclWinAddProcess(procInfo.hProcess, procInfo.dwProcessId);
}
@@ -2564,7 +2564,7 @@ Tcl_WaitPid(
prevPtrPtr = &procList;
for (infoPtr = procList; infoPtr != NULL;
prevPtrPtr = &infoPtr->nextPtr, infoPtr = infoPtr->nextPtr) {
- if (infoPtr->dwProcessId == (size_t) pid) {
+ if (infoPtr->dwProcessId == (Tcl_Size)pid) {
*prevPtrPtr = infoPtr->nextPtr;
break;
}
@@ -2674,7 +2674,7 @@ Tcl_WaitPid(
} else {
errno = ECHILD;
*statPtr = 0xC0000000 | ECHILD;
- result = (Tcl_Pid) -1;
+ result = (Tcl_Pid)-1;
}
/*
@@ -2708,7 +2708,7 @@ Tcl_WaitPid(
void
TclWinAddProcess(
void *hProcess, /* Handle to process */
- size_t id) /* Global process identifier */
+ Tcl_Size id) /* Global process identifier */
{
ProcInfo *procPtr = (ProcInfo *)Tcl_Alloc(sizeof(ProcInfo));