Blame SOURCES/opencryptoki-3.16.0-19f56d12b302b87e1dacf613cc61a063ad209d15.patch

2c1758
commit 19f56d12b302b87e1dacf613cc61a063ad209d15
2c1758
Author: Ingo Franzki <ifranzki@linux.ibm.com>
2c1758
Date:   Fri Feb 12 15:57:20 2021 +0100
2c1758
2c1758
    Fix compile warning when compiling pkcsslotd with -DDEV and/or -DTHREADED
2c1758
    
2c1758
    Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2c1758
2c1758
diff --git a/usr/sbin/pkcsslotd/garbage_linux.c b/usr/sbin/pkcsslotd/garbage_linux.c
2c1758
index d4878c3b..a4dd9713 100644
2c1758
--- a/usr/sbin/pkcsslotd/garbage_linux.c
2c1758
+++ b/usr/sbin/pkcsslotd/garbage_linux.c
2c1758
@@ -15,6 +15,7 @@
2c1758
 #include <string.h>
2c1758
 #include <sys/types.h>
2c1758
 #include <fcntl.h>
2c1758
+#include <stdlib.h>
2c1758
 
2c1758
 #include "log.h"
2c1758
 #include "slotmgr.h"
2c1758
@@ -80,8 +81,8 @@ BOOL StartGCThread(Slot_Mgr_Shr_t *MemPtr)
2c1758
 #ifdef DEV
2c1758
     // Only development builds
2c1758
     LogLog("StartGCThread: garbage collection thread started as ID "
2c1758
-           "%d (%#x) by ID %d (%#x)",
2c1758
-           GCThread, GCThread, pthread_self(), pthread_self());
2c1758
+           "%lu by ID %lu",
2c1758
+           GCThread, pthread_self());
2c1758
 #endif
2c1758
 
2c1758
     return TRUE;
2c1758
@@ -115,8 +116,8 @@ BOOL StopGCThread(void *Ptr)
2c1758
         return FALSE;
2c1758
     }
2c1758
 
2c1758
-    DbgLog(DL0, "StopGCThread: tid %d is stopping the garbage collection "
2c1758
-           "thread (tid %d)",
2c1758
+    DbgLog(DL0, "StopGCThread: tid %lu is stopping the garbage collection "
2c1758
+           "thread (tid %lu)",
2c1758
            pthread_self(), GCThread);
2c1758
 
2c1758
     /* Cause the GC thread to be cancelled */
2c1758
@@ -245,7 +246,7 @@ void GCCancel(void *Ptr)
2c1758
     UNUSED(Ptr);
2c1758
 
2c1758
     /* Yeah, yeah.  Doesn't do anything, but I had plans */
2c1758
-    DbgLog(DL3, "GCCancel: tid: %d running cleanup routine", pthread_self());
2c1758
+    DbgLog(DL3, "GCCancel: tid: %lu running cleanup routine", pthread_self());
2c1758
 
2c1758
     return;
2c1758
 }
2c1758
@@ -268,7 +269,7 @@ BOOL CheckForGarbage(Slot_Mgr_Shr_t *MemPtr)
2c1758
 
2c1758
     ASSERT(MemPtr != NULL_PTR);
2c1758
 #ifdef DEV
2c1758
-    DbgLog(DL5, "Thread %d is checking for garbage", pthread_self());
2c1758
+    DbgLog(DL5, "Thread %lu is checking for garbage", pthread_self());
2c1758
 #endif                          /* DEV */
2c1758
 
2c1758
 
2c1758
@@ -326,9 +327,9 @@ BOOL CheckForGarbage(Slot_Mgr_Shr_t *MemPtr)
2c1758
                 if (*pProcSessions > 0) {
2c1758
 
2c1758
 #ifdef DEV
2c1758
-                    DbgLog(DL2, "GC: Invalid pid (%d) is holding %d sessions "
2c1758
+                    DbgLog(DL2, "GC: Invalid pid (%d) is holding %u sessions "
2c1758
                            "open on slot %d.  Global session count for this "
2c1758
-                           "slot is %d",
2c1758
+                           "slot is %u",
2c1758
                            pProc->proc_id, *pProcSessions, SlotIndex,
2c1758
                            *pGlobalSessions);
2c1758
 #endif                          /* DEV */
2c1758
@@ -338,9 +339,9 @@ BOOL CheckForGarbage(Slot_Mgr_Shr_t *MemPtr)
2c1758
                         WarnLog("Garbage Collection: Illegal values in table "
2c1758
                                 "for defunct process");
2c1758
                         DbgLog(DL0, "Garbage collection: A process "
2c1758
-                               "( Index: %d, pid: %d ) showed %d sessions "
2c1758
-                               "open on slot %s, but the global count for this "
2c1758
-                               "slot is only %d",
2c1758
+                               "( Index: %d, pid: %d ) showed %u sessions "
2c1758
+                               "open on slot %d, but the global count for this "
2c1758
+                               "slot is only %u",
2c1758
                                ProcIndex, pProc->proc_id, *pProcSessions,
2c1758
                                SlotIndex, *pGlobalSessions);
2c1758
 #endif                          /* DEV */
2c1758
@@ -395,14 +396,8 @@ int Stat2Proc(int pid, proc_t *p)
2c1758
     char fbuf[800];         // about 40 fields, 64-bit decimal is about 20 chars
2c1758
     char *tmp;
2c1758
     int fd, num;
2c1758
-    //  FILE *fp;
2c1758
-
2c1758
-    //  sprintf(buf, "%s/%d/stat", PROC_BASE, pid);
2c1758
-    //  if( (fp = fopen(buf, "r")) == NULL )
2c1758
-    //    return FALSE;
2c1758
 
2c1758
     sprintf(fbuf, "%s/%d/stat", PROC_BASE, pid);
2c1758
-    printf("Buff = %s \n", fbuf);
2c1758
     fflush(stdout);
2c1758
     if ((fd = open(fbuf, O_RDONLY, 0)) == -1)
2c1758
         return FALSE;
2c1758
diff --git a/usr/sbin/pkcsslotd/log.c b/usr/sbin/pkcsslotd/log.c
2c1758
index 0214f952..0394cc7d 100644
2c1758
--- a/usr/sbin/pkcsslotd/log.c
2c1758
+++ b/usr/sbin/pkcsslotd/log.c
2c1758
@@ -463,8 +463,8 @@ BOOL PKCS_Log(pLogHandle phLog, char *fmt, va_list ap)
2c1758
 #endif                          /* DEV */
2c1758
 
2c1758
         if (WriteNow) {
2c1758
-            fprintf(stderr, "%s[%d.%d]: %s\n", pInfo->Descrip, getpid(),
2c1758
-                    (int) pthread_self(), buf);
2c1758
+            fprintf(stderr, "%s[%d.%lu]: %s\n", pInfo->Descrip, getpid(),
2c1758
+                    pthread_self(), buf);
2c1758
         }
2c1758
     }
2c1758
 
2c1758
@@ -482,7 +482,7 @@ BOOL PKCS_Log(pLogHandle phLog, char *fmt, va_list ap)
2c1758
             GetCurrentTimeString(timebuf);
2c1758
 
2c1758
             /* Date/Time stamp, descrip, Error message */
2c1758
-            fprintf(fd, "%s %s[%d.%d]: ", timebuf, pInfo->Descrip, getpid(),
2c1758
+            fprintf(fd, "%s %s[%d.%lu]: ", timebuf, pInfo->Descrip, getpid(),
2c1758
                     pthread_self());
2c1758
             fprintf(fd, "%s\n", buf);
2c1758
             fflush(fd);
2c1758
diff --git a/usr/sbin/pkcsslotd/slotmgr.c b/usr/sbin/pkcsslotd/slotmgr.c
2c1758
index 94288f13..efbfe8fd 100644
2c1758
--- a/usr/sbin/pkcsslotd/slotmgr.c
2c1758
+++ b/usr/sbin/pkcsslotd/slotmgr.c
2c1758
@@ -660,7 +660,6 @@ int main(int argc, char *argv[], char *envp[])
2c1758
      */
2c1758
 
2c1758
 #if !defined(NOGARBAGE)
2c1758
-    printf("Start garbage \n");
2c1758
     /* start garbage collection thread */
2c1758
     if (!StartGCThread(shmp)) {
2c1758
         term_socket_server();