--- a/generic/tclXfcntl.c	2023-03-15 19:34:15.074669138 +0100
+++ b/generic/tclXfcntl.c	2023-03-15 19:33:20.805545639 +0100
@@ -200,8 +200,12 @@
         value = (optValue == TCLX_BUFFERING_LINE);
         break;
       case ATTR_KEEPALIVE:
-        if (TclXOSgetsockopt (interp, channel, SO_KEEPALIVE, &value) != TCL_OK)
+        {
+        socklen_t len;
+        if (TclXOSgetsockopt (interp, channel, SO_KEEPALIVE, &len) != TCL_OK)
             return TCL_ERROR;
+        value = len;
+        }
         break;
       default:
         panic ("bug in fcntl get attrib");
--- a/generic/tclXhandles.c	2023-03-15 19:36:33.992425688 +0100
+++ b/generic/tclXhandles.c	2023-03-15 19:43:05.552120448 +0100
@@ -20,6 +20,9 @@
 
 #include "tclExtdInt.h"
 
+#include <stdint.h>
+#include <inttypes.h>
+
 /*
  * Variable set to contain the alignment factor (in bytes) for this machine.
  * It is set on the first table initialization.
@@ -539,7 +542,7 @@
 
     entryHdrPtr = HEADER_AREA (entryPtr);
     if (entryHdrPtr->freeLink != ALLOCATED_IDX)
-        panic ("Tcl_HandleFree: entry not allocated %x\n", entryHdrPtr);
+        panic ("Tcl_HandleFree: entry not allocated %" PRIxPTR "\n", (intptr_t)entryHdrPtr);
 
     entryHdrPtr->freeLink = tblHdrPtr->freeHeadIdx;
     tblHdrPtr->freeHeadIdx =
--- a/generic/tclXkeylist.c	2023-03-15 20:02:16.177763876 +0100
+++ b/generic/tclXkeylist.c	2023-03-15 20:04:46.029420986 +0100
@@ -17,6 +17,7 @@
  */
 
 #include "tclExtdInt.h"
+#include <stdint.h>
 
 /*
  * Keyed lists are stored as arrays recursively defined objects.  The data
@@ -338,7 +339,7 @@
     if (keylIntPtr->hashTbl != NULL) {
 	Tcl_HashEntry *entryPtr;
 	Tcl_HashSearch search;
-	int nidx;
+	intptr_t nidx;
 
 	entryPtr = Tcl_FindHashEntry(keylIntPtr->hashTbl,
 		keylIntPtr->entries [entryIdx].key);
@@ -354,7 +355,7 @@
 	 */
 	for (entryPtr = Tcl_FirstHashEntry(keylIntPtr->hashTbl, &search);
 	     entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) {
-	    nidx = (int) Tcl_GetHashValue(entryPtr);
+	    nidx = (intptr_t) Tcl_GetHashValue(entryPtr);
 	    if (nidx > entryIdx) {
 		Tcl_SetHashValue(entryPtr, (ClientData) (uintptr_t) (nidx - 1));
 	    }
@@ -394,7 +395,8 @@
                     char	    **nextSubKeyPtr)
 {
     char *keySeparPtr;
-    int keyLen, findIdx = -1;
+    int keyLen;
+    intptr_t findIdx = -1;
 
     keySeparPtr = strchr (key, '.');
     if (keySeparPtr != NULL) {
@@ -416,7 +418,7 @@
 	}
 	entryPtr = Tcl_FindHashEntry(keylIntPtr->hashTbl, key);
 	if (entryPtr != NULL) {
-	    findIdx = (int) Tcl_GetHashValue(entryPtr);
+	    findIdx = (intptr_t) Tcl_GetHashValue(entryPtr);
 	}
 	if (keySeparPtr != NULL) {
 	    key[keyLen] = tmp;
--- a/generic/tclXsignal.c	2023-03-15 20:07:18.687031905 +0100
+++ b/generic/tclXsignal.c	2023-03-15 20:07:55.997447649 +0100
@@ -463,7 +463,7 @@
  *-----------------------------------------------------------------------------
  */
 static int
-BlockSignals (Tcl_Interp *interp, int action, unsigned char signals[])
+BlockSignals (Tcl_Interp *interp, int action, unsigned char signals[MAXSIG])
 {
 #ifndef NO_SIGACTION
     int      signalNum;
--- a/unix/tclXunixDup.c	2023-03-15 20:09:58.482528699 +0100
+++ b/unix/tclXunixDup.c	2023-03-15 20:13:22.981321777 +0100
@@ -17,6 +17,7 @@
  */
 
 #include "tclExtdInt.h"
+#include <stdint.h>
 
 
 /*-----------------------------------------------------------------------------
@@ -75,7 +76,8 @@
     ClientData handle;
     const Tcl_ChannelType *channelType;
     Tcl_Channel newChannel = NULL;
-    int srcFileNum, newFileNum = -1;
+    intptr_t srcFileNum;
+    int newFileNum = -1;
 
     /*
      * On Unix, the channels we can dup share the same file for the read and
@@ -86,7 +88,7 @@
     } else {
         Tcl_GetChannelHandle (srcChannel, TCL_WRITABLE, &handle);
     }
-    srcFileNum = (int) handle;
+    srcFileNum = (intptr_t) handle;
     channelType = Tcl_GetChannelType (srcChannel);
 
     /*
--- a/unix/tclXunixId.c	2023-03-15 20:14:58.037829847 +0100
+++ b/unix/tclXunixId.c	2023-03-15 20:15:50.699002979 +0100
@@ -444,7 +444,7 @@
 #endif
     char hostNameBuf[MAXHOSTNAMELEN];
 
-    if (objc != 2)
+	if (objc != 2)
         return TclX_WrongArgs (interp, objv [0], "host");
 
 	if (gethostname (hostNameBuf, MAXHOSTNAMELEN) < 0) {
--- a/unix/tclXunixOS.c	2023-03-15 20:16:27.021432520 +0100
+++ b/unix/tclXunixOS.c	2023-03-15 20:25:12.202242082 +0100
@@ -23,6 +23,7 @@
 
 #include "tclExtdInt.h"
 
+#include <stdint.h>
 #ifndef NO_GETPRIORITY
 #include <sys/resource.h>
 #endif
@@ -113,7 +114,7 @@
             return -1;
 	}
     }
-    return (int) handle;
+    return (intptr_t) handle;
 }
 
 /*-----------------------------------------------------------------------------
@@ -401,7 +402,7 @@
     if (pid == 0) {
         close (errPipes [0]);
         execl ("/bin/sh", "sh", "-c", command, (char *) NULL);
-        write (errPipes [1], &errno, sizeof (errno));
+        if(write (errPipes [1], &errno, sizeof (errno))) {};
         _exit (127);
     }
 
@@ -918,8 +919,9 @@
 int
 TclXOSgetsockname (Tcl_Interp *interp, Tcl_Channel channel, void *sockaddr, int sockaddrSize)
 {
+    socklen_t siz = sockaddrSize;
     if (getsockname (ChannelToFnum (channel, 0),
-		(struct sockaddr *) sockaddr, &sockaddrSize) < 0) {
+		(struct sockaddr *) sockaddr, &siz) < 0) {
 	TclX_AppendObjResult (interp, Tcl_GetChannelName (channel), ": ",
 		Tcl_PosixError (interp), (char *) NULL);
 	return TCL_ERROR;
@@ -943,7 +945,7 @@
 int
 TclXOSgetsockopt (Tcl_Interp *interp, Tcl_Channel channel, int option, socklen_t *valuePtr)
 {
-    int valueLen = sizeof (*valuePtr);
+    socklen_t valueLen = sizeof (*valuePtr);
 
     if (getsockopt (ChannelToFnum (channel, 0), SOL_SOCKET, option, 
 		(void*) valuePtr, &valueLen) != 0) {
@@ -1385,7 +1387,7 @@
                               (char *) NULL);
         return TCL_ERROR;
     }
-    *fnumPtr = (int) handle;
+    *fnumPtr = (intptr_t) handle;
     return TCL_OK;
 }
 
