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