case SIGHUP:
case SIGINT:
case SIGKILL:
+ case SIGQUIT:
case SIGTERM:
- case SIGUSR1:
- case SIGUSR2:
/* default action is "exit" */
ExitProcess(PMGT_SIGSTATUS_ENCODE(signo));
break;
- case SIGQUIT:
case SIGILL:
case SIGABRT:
case SIGFPE:
RaiseException((DWORD) PMGT_SIGSTATUS_ENCODE(signo),
EXCEPTION_NONCONTINUABLE, 0, NULL);
break;
+ case SIGUSR1:
+ case SIGUSR2:
case SIGCHLD:
/* default action is "ignore" */
break;
static DWORD WINAPI
RemoteSignalThread(LPVOID param)
{
- int signo = (int)param;
+ int signo = (int)(intptr_t)param;
DWORD rc = 0;
if (SignalIsDefined(signo)) {
RemoteSignalListenerThread(LPVOID param)
{
HANDLE sigPipeHandle = (HANDLE) param;
+ HMODULE hLib = LoadLibrary("AFSPROCMGMT.DLL");
while (1) {
/* wait for pipe client to connect */
*/
sigThreadHandle = CreateThread(NULL, /* default security attr. */
0, /* default stack size */
- RemoteSignalThread, (LPVOID) signo, /* thread argument */
+ RemoteSignalThread, (LPVOID) (intptr_t)signo, /* thread argument */
0, /* creation flags */
&sigThreadId); /* thread id */
}
/* never reached */
+ FreeLibrary(hLib);
return (0);
}
for (strCount = 0; strArray[strCount] != NULL; strCount++) {
/* sum all string lengths */
- byteCount += strlen(strArray[strCount]);
+ byteCount += (int)strlen(strArray[strCount]);
}
/* put all strings into buffer; guarantee buffer is at least one char */
HANDLE * bufEventHandlep)
{ /* buffer read event handle */
BOOL fsuccess = FALSE;
- DWORD bufMemSize = dataLen + sizeof(size_t);
+ DWORD bufMemSize = dataLen + (DWORD)sizeof(size_t);
char bufMemName[sizeof(PMGT_DATA_MEM_PREFIX) + 20];
char bufEventName[sizeof(PMGT_DATA_EVENT_PREFIX) + 20];
/* Create and initialize named shared memory and named event */
- *bufMemHandlep = CreateFileMapping((HANDLE) 0xFFFFFFFF, /* page-file backed */
+ *bufMemHandlep = CreateFileMapping(INVALID_HANDLE_VALUE, /* page-file backed */
NULL, PAGE_READWRITE, 0, bufMemSize,
bufMemName);
static DWORD WINAPI
ChildMonitorThread(LPVOID param)
{
- int tidx = (int)param;
+ int tidx = (int)(intptr_t)param;
HANDLE childProcHandle;
BOOL fsuccess;
DWORD rc = -1;
*/
monitorHandle = CreateThread(NULL, /* default security attr. */
0, /* default stack size */
- ChildMonitorThread, (LPVOID) tidx, /* thread argument */
+ ChildMonitorThread, (LPVOID)(intptr_t) tidx, /* thread argument */
0, /* creation flags */
&monitorId); /* thread id */
DWORD reason, /* reason function is being called */
LPVOID reserved)
{ /* reserved for future use */
- if (reason == DLL_PROCESS_ATTACH) {
+ switch (reason) {
+ case DLL_PROCESS_ATTACH:
/* library is being attached to a process */
if (PmgtLibraryInitialize()) {
/* failed to initialize library */
/* disable thread attach/detach notifications */
(void)DisableThreadLibraryCalls(dllInstHandle);
+ return TRUE;
+ case DLL_PROCESS_DETACH:
+ pmgt_RestoreNativeSignals();
+ return TRUE;
+ default:
+ return FALSE;
}
-
- return TRUE;
}