From: wessels <> Date: Tue, 28 Oct 1997 06:30:20 +0000 (+0000) Subject: define ALARM_UPDATES_TIME to use alarm(3). otherwise, update clock before each select() X-Git-Tag: SQUID_3_0_PRE1~4660 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b984c44567369cc23d4f3755d3f1cf7a0a3acbe2;p=thirdparty%2Fsquid.git define ALARM_UPDATES_TIME to use alarm(3). otherwise, update clock before each select() --- diff --git a/src/Makefile.in b/src/Makefile.in index aeeed87dc2..418187a7a4 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.86 1997/08/25 03:51:46 wessels Exp $ +# $Id: Makefile.in,v 1.87 1997/10/27 23:30:20 wessels Exp $ # # Uncomment and customize the following to suit your needs: # @@ -15,11 +15,13 @@ KILL_PARENT_OPT = # -DKILL_PARENT_OPT # do NOT define both USE_SPLAY_TREE and USE_BIN_TREE at the same time! USE_SPLAY_TREE = # -DUSE_SPLAY_TREE USE_BIN_TREE = # -DUSE_BIN_TREE +ALARM_UPDATES_TIME = # -DALARM_UPDATES_TIME=1 DEFINES = $(HOST_OPT) $(AUTH_OPT) $(LOG_HDRS_OPT) \ $(ICMP_OPT) $(DELAY_HACK) $(USERAGENT_OPT) \ - $(KILL_PARENT_OPT) $(USE_POLL_OPT) \ - $(USE_SPLAY_TREE) $(USE_BIN_TREE) + $(KILL_PARENT_OPT) $(USE_POLL_OPT) \ + $(USE_SPLAY_TREE) $(USE_BIN_TREE) \ + $(ALARM_UPDATES_TIME) prefix = @prefix@ exec_prefix = @exec_prefix@ diff --git a/src/comm.cc b/src/comm.cc index 8c98315828..2ba04c1eb6 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.198 1997/10/27 21:58:48 wessels Exp $ + * $Id: comm.cc,v 1.199 1997/10/27 23:30:22 wessels Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -824,11 +824,11 @@ comm_poll(time_t sec) int poll_time; static int incoming_counter = 0; time_t timeout; - /* assume all process are very fast (less than 1 second). Call - * time() only once */ - /* use only 1 second granularity */ timeout = squid_curtime + sec; do { +#if !ALARM_UPDATES_TIME + getCurrentTime(); +#endif if (shutdown_pending || reconfigure_pending) { serverConnectionsClose(); dnsShutdownServers(); @@ -974,6 +974,9 @@ comm_select(time_t sec) timeout = squid_curtime + sec; do { +#if !ALARM_UPDATES_TIME + getCurrentTime(); +#endif FD_ZERO(&readfds); FD_ZERO(&writefds); if (shutdown_pending || reconfigure_pending) { diff --git a/src/main.cc b/src/main.cc index d452d62345..c448f1943e 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.179 1997/10/26 02:35:35 wessels Exp $ + * $Id: main.cc,v 1.180 1997/10/27 23:30:24 wessels Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -117,9 +117,11 @@ static int icpPortNumOverride = 1; /* Want to detect "-u 0" */ static int malloc_debug_level = 0; #endif -static void rotate_logs(int); -static void reconfigure(int); -static void time_tick(int); +static SIGHDLR rotate_logs; +static SIGHDLR reconfigure; +#if ALARM_UPDATES_TIME +static SIGHDLR time_tick; +#endif static void mainInitialize(void); static void mainReconfigure(void); static void usage(void); @@ -259,6 +261,7 @@ rotate_logs(int sig) #endif } +#if ALARM_UPDATES_TIME static void time_tick(int sig) { @@ -268,7 +271,7 @@ time_tick(int sig) signal(sig, time_tick); #endif } - +#endif static void reconfigure(int sig) @@ -553,8 +556,10 @@ mainInitialize(void) squid_signal(SIGHUP, reconfigure, SA_RESTART); squid_signal(SIGTERM, shut_down, SA_NODEFER | SA_RESETHAND | SA_RESTART); squid_signal(SIGINT, shut_down, SA_NODEFER | SA_RESETHAND | SA_RESTART); +#if ALARM_UPDATES_TIME squid_signal(SIGALRM, time_tick, SA_RESTART); alarm(1); +#endif debug(1, 0) ("Ready to serve requests.\n"); if (!configured_once) {