From: Danny Mayer Date: Sun, 12 Apr 2009 04:38:47 +0000 (-0400) Subject: [Bug 1147] System errors should be logged to msyslog() X-Git-Tag: NTP_4_2_4P7_RC3~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edbb7a6d50ec8af777c39ab3a19fb32db5c8e3d1;p=thirdparty%2Fntp.git [Bug 1147] System errors should be logged to msyslog() bk: 49e17057BW0ynOwk_CqMPyi_kWgjAQ --- diff --git a/ports/winnt/ntpd/ntp_iocompletionport.c b/ports/winnt/ntpd/ntp_iocompletionport.c index b6ba146dd..217317a6b 100644 --- a/ports/winnt/ntpd/ntp_iocompletionport.c +++ b/ports/winnt/ntpd/ntp_iocompletionport.c @@ -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