]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1147] System errors should be logged to msyslog()
authorDanny Mayer <mayer@ntp.org>
Sun, 12 Apr 2009 04:38:47 +0000 (00:38 -0400)
committerDanny Mayer <mayer@ntp.org>
Sun, 12 Apr 2009 04:38:47 +0000 (00:38 -0400)
bk: 49e17057BW0ynOwk_CqMPyi_kWgjAQ

ports/winnt/ntpd/ntp_iocompletionport.c

index b6ba146dd33ab0f94b415559c2ac45e6df08b31b..217317a6baa0149fb12235c02186d39437b95ef3 100644 (file)
@@ -18,6 +18,7 @@
 #include "transmitbuff.h"
 #include "ntp_request.h"
 #include "ntp_io.h"
+#include "clockstuff.h"
 
 /*
  * Request types
@@ -54,9 +55,6 @@ typedef struct IoCompletionInfo {
   typedef DWORD ULONG_PTR;
 #endif
 
-/* in nt_clockstuff.c */
-extern void lock_thread_to_processor(HANDLE);
-
 /*
  * local function definitions
  */
@@ -143,7 +141,8 @@ static void
 signal_io_completion_port_exit()
 {
        if (!PostQueuedCompletionStatus(hIoCompletionPort, 0, 0, 0)) {
-               DPRINTF(1, ("Can't request IO thread to exit: %d\n", GetLastError()));
+               msyslog(LOG_ERR, "Can't request service thread to exit: %m");
+               exit(1);
        }
 }
 
@@ -275,24 +274,28 @@ init_io_completion_port(
 
        /* Create the event used to signal an IO event
         */
-       WaitableIoEventHandle = CreateEvent(NULL, FALSE, FALSE, NULL);
-
+       WaitableIoEventHandle = CreateEvent(NULL, FALSE, FALSE, "WaitableIoEventHandle");
+       if (WaitableIoEventHandle == NULL) {
+               msyslog(LOG_ERR,
+               "Can't create I/O event handle: %m - another process may be running - EXITING");
+               exit(1);
+       }
        /* Create the event used to signal an exit event
         */
-       WaitableExitEventHandle = CreateEvent(NULL, FALSE, FALSE, NULL);
+       WaitableExitEventHandle = CreateEvent(NULL, FALSE, FALSE, "WaitableExitEventHandle");
+       if (WaitableExitEventHandle == NULL) {
+               msyslog(LOG_ERR,
+               "Can't create exit event handle: %m - another process may be running - EXITING");
+               exit(1);
+       }
 
        /* Create the IO completion port
         */
        hIoCompletionPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
-
-#ifdef DEBUG
-       if (NULL == WaitableExitEventHandle || 
-           NULL == WaitableIoEventHandle ||
-           NULL == hIoCompletionPort) {
-               DPRINTF(1, ("init_io_completion_port: Can't create event or port\n"));
+       if (hIoCompletionPort == NULL) {
+               msyslog(LOG_ERR, "Can't create I/O completion port: %m");
                exit(1);
        }
-#endif
 
        /*
         * Initialize the Wait Handles