opencryptoki/opencryptoki-3.16.0-19f56d12b302b87e1dacf613cc61a063ad209d15.patch

137 lines
5.3 KiB
Diff
Raw Normal View History

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