From: Harlan Stenn Date: Sun, 27 Feb 2000 07:01:25 +0000 (-0000) Subject: ntpd.c: X-Git-Tag: NTP_4_0_99_G~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92b2dc7d66e84a689f50e3f98d3e158d746c0957;p=thirdparty%2Fntp.git ntpd.c: * ntpd/ntpd.c: Indentation cleanup. bk: 38b8cbc5UC_efK56KnazNMNOCzaG5g --- diff --git a/ntpd/ntpd.c b/ntpd/ntpd.c index b5538f1eb..b9b27acc0 100644 --- a/ntpd/ntpd.c +++ b/ntpd/ntpd.c @@ -85,11 +85,11 @@ #endif #ifdef _AIX -#include +# include #endif /* _AIX */ #ifdef SCO5_CLOCK -#include +# include #endif /* @@ -102,10 +102,10 @@ * Signals which terminate us gracefully. */ #ifndef SYS_WINNT -#define SIGDIE1 SIGHUP -#define SIGDIE3 SIGQUIT -#define SIGDIE2 SIGINT -#define SIGDIE4 SIGTERM +# define SIGDIE1 SIGHUP +# define SIGDIE3 SIGQUIT +# define SIGDIE2 SIGINT +# define SIGDIE4 SIGTERM #endif /* SYS_WINNT */ #if defined SYS_WINNT @@ -122,7 +122,7 @@ static BOOL WINAPI OnConsoleEvent(DWORD dwCtrlType); /* * Scheduling priority we run at */ -# define NTPD_PRIO (-12) +#define NTPD_PRIO (-12) /* * Debugging flag @@ -254,7 +254,7 @@ set_process_priority(void) ++done; #endif -# if defined(HAVE_SCHED_SETSCHEDULER) +#if defined(HAVE_SCHED_SETSCHEDULER) if (!done) { extern int config_priority_override, config_priority; int pmax, pmin; @@ -276,9 +276,9 @@ set_process_priority(void) else ++done; } -# endif /* HAVE_SCHED_SETSCHEDULER */ -# if defined(HAVE_RTPRIO) -# ifdef RTP_SET +#endif /* HAVE_SCHED_SETSCHEDULER */ +#if defined(HAVE_RTPRIO) +# ifdef RTP_SET if (!done) { struct rtprio srtp; @@ -290,17 +290,17 @@ set_process_priority(void) else ++done; } -# else /* not RTP_SET */ +# else /* not RTP_SET */ if (!done) { if (rtprio(0, 120) < 0) msyslog(LOG_ERR, "rtprio() error: %m"); else ++done; } -# endif /* not RTP_SET */ -# endif /* HAVE_RTPRIO */ -# if defined(NTPD_PRIO) && NTPD_PRIO != 0 -# ifdef HAVE_ATT_NICE +# endif /* not RTP_SET */ +#endif /* HAVE_RTPRIO */ +#if defined(NTPD_PRIO) && NTPD_PRIO != 0 +# ifdef HAVE_ATT_NICE if (!done) { errno = 0; if (-1 == nice (NTPD_PRIO) && errno != 0) @@ -308,16 +308,16 @@ set_process_priority(void) else ++done; } -# endif /* HAVE_ATT_NICE */ -# ifdef HAVE_BSD_NICE +# endif /* HAVE_ATT_NICE */ +# ifdef HAVE_BSD_NICE if (!done) { if (-1 == setpriority(PRIO_PROCESS, 0, NTPD_PRIO)) msyslog(LOG_ERR, "setpriority() error: %m"); else ++done; } -# endif /* HAVE_BSD_NICE */ -# endif /* NTPD_PRIO && NTPD_PRIO != 0 */ +# endif /* HAVE_BSD_NICE */ +#endif /* NTPD_PRIO && NTPD_PRIO != 0 */ if (!done) msyslog(LOG_ERR, "set_process_priority: No way found to improve our priority"); } @@ -395,9 +395,9 @@ ntpdmain( # endif /* DEBUG */ { # ifndef SYS_WINNT -# ifdef HAVE_DAEMON +# ifdef HAVE_DAEMON daemon(0, 0); -# else /* not HAVE_DAEMON */ +# else /* not HAVE_DAEMON */ if (fork()) /* HMS: What about a -1? */ exit(0); @@ -417,11 +417,11 @@ ntpdmain( msyslog(LOG_ERR, "ntpd: failed to close open files(): %m"); #else /* not F_CLOSEM */ -#if defined(HAVE_SYSCONF) && defined(_SC_OPEN_MAX) +# if defined(HAVE_SYSCONF) && defined(_SC_OPEN_MAX) max_fd = sysconf(_SC_OPEN_MAX); -#else /* HAVE_SYSCONF && _SC_OPEN_MAX */ +# else /* HAVE_SYSCONF && _SC_OPEN_MAX */ max_fd = getdtablesize(); -#endif /* HAVE_SYSCONF && _SC_OPEN_MAX */ +# endif /* HAVE_SYSCONF && _SC_OPEN_MAX */ for (s = 0; s < max_fd; s++) (void) close((int)s); #endif /* not F_CLOSEM */ @@ -473,8 +473,8 @@ ntpdmain( (void) sigaction(SIGDANGER, &sa, NULL); #endif /* _AIX */ } -#endif /* not HAVE_DAEMON */ -#else /* SYS_WINNT */ +# endif /* not HAVE_DAEMON */ +# else /* SYS_WINNT */ { SERVICE_TABLE_ENTRY dispatchTable[] = { @@ -489,10 +489,10 @@ ntpdmain( ExitProcess(2); } } -#endif /* SYS_WINNT */ +# endif /* SYS_WINNT */ } -#endif /* NODETACH */ -#if defined(SYS_WINNT) && !defined(NODETACH) +# endif /* NODETACH */ +# if defined(SYS_WINNT) && !defined(NODETACH) else service_main(argc, argv); return 0; /* must return a value */ @@ -541,7 +541,7 @@ service_main( } } /* debug */ -#endif /* defined(SYS_WINNT) && !defined(NODETACH) */ +# endif /* defined(SYS_WINNT) && !defined(NODETACH) */ #endif /* VMS */ /* @@ -638,15 +638,15 @@ service_main( if (plock(PROCLOCK) < 0) msyslog(LOG_ERR, "plock(PROCLOCK): %m"); # else /* not PROCLOCK */ -# ifdef TXTLOCK +# ifdef TXTLOCK /* * Lock text into ram */ if (plock(TXTLOCK) < 0) msyslog(LOG_ERR, "plock(TXTLOCK) error: %m"); -# else /* not TXTLOCK */ +# else /* not TXTLOCK */ msyslog(LOG_ERR, "plock() - don't know what to lock!"); -# endif /* not TXTLOCK */ +# endif /* not TXTLOCK */ # endif /* not PROCLOCK */ # endif /* HAVE_PLOCK */ #endif /* not (HAVE_MLOCKALL && MCL_CURRENT && MCL_FUTURE) */ @@ -735,7 +735,7 @@ service_main( # if defined(DEBUG) if(!debug) { -#endif +# endif /* report to the service control manager that the service is running */ ssStatus.dwCurrentState = SERVICE_RUNNING; ssStatus.dwWin32ExitCode = NO_ERROR; @@ -750,7 +750,7 @@ service_main( } # if defined(DEBUG) } -#endif +# endif #endif /* @@ -773,7 +773,7 @@ service_main( * and - lacking a hardware reference clock - I have * yet to learn about anything else that is. */ -# if defined(HAVE_IO_COMPLETION_PORT) +#if defined(HAVE_IO_COMPLETION_PORT) WaitHandles[0] = CreateEvent(NULL, FALSE, FALSE, NULL); /* exit reques */ WaitHandles[1] = get_timer_handle(); @@ -805,21 +805,21 @@ service_main( } /* switch */ rbuflist = getrecvbufs(); /* get received buffers */ -# else /* normal I/O */ +#else /* normal I/O */ was_alarmed = 0; rbuflist = (struct recvbuf *)0; for (;;) { -# if !defined(HAVE_SIGNALED_IO) +# if !defined(HAVE_SIGNALED_IO) extern fd_set activefds; extern int maxactivefd; fd_set rdfdes; int nfound; -# elif defined(HAVE_SIGNALED_IO) +# elif defined(HAVE_SIGNALED_IO) block_io_and_alarm(); -# endif +# endif rbuflist = getrecvbufs(); /* get received buffers */ if (alarm_flag) /* alarmed? */ @@ -833,9 +833,9 @@ service_main( /* * Nothing to do. Wait for something. */ -#ifndef HAVE_SIGNALED_IO +# ifndef HAVE_SIGNALED_IO rdfdes = activefds; -# if defined(VMS) || defined(SYS_VXWORKS) +# if defined(VMS) || defined(SYS_VXWORKS) /* make select() wake up after one second */ { struct timeval t1; @@ -844,10 +844,10 @@ service_main( nfound = select(maxactivefd+1, &rdfdes, (fd_set *)0, (fd_set *)0, &t1); } -# else +# else nfound = select(maxactivefd+1, &rdfdes, (fd_set *)0, (fd_set *)0, (struct timeval *)0); -# endif /* VMS */ +# endif /* VMS */ if (nfound > 0) { l_fp ts; @@ -861,10 +861,10 @@ service_main( else if (debug > 2) { msyslog(LOG_DEBUG, "select(): nfound=%d, error: %m", nfound); } -# else /* HAVE_SIGNALED_IO */ +# else /* HAVE_SIGNALED_IO */ wait_for_signal(); -# endif /* HAVE_SIGNALED_IO */ +# endif /* HAVE_SIGNALED_IO */ if (alarm_flag) /* alarmed? */ { was_alarmed = 1; @@ -886,7 +886,7 @@ service_main( was_alarmed = 0; } -# endif /* HAVE_IO_COMPLETION_PORT */ +#endif /* HAVE_IO_COMPLETION_PORT */ /* * Call the data procedure to handle each received * packet. @@ -898,11 +898,11 @@ service_main( (rbuf->receiver)(rbuf); freerecvbuf(rbuf); } -# if defined DEBUG && defined SYS_WINNT +#if defined DEBUG && defined SYS_WINNT if (debug > 4) printf("getrecvbufs: %ld handler interrupts, %ld frames\n", handler_calls, handler_pkts); -# endif +#endif /* * Go around again @@ -927,11 +927,11 @@ finish( switch (sig) { -#ifdef SIGBUS +# ifdef SIGBUS case SIGBUS: printf("\nfinish(SIGBUS)\n"); exit(0); -#endif +# endif case 0: /* Should never happen... */ return; default: