]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
cleanup based on HP-UX CC
authorwessels <>
Thu, 12 Sep 1996 09:23:51 +0000 (09:23 +0000)
committerwessels <>
Thu, 12 Sep 1996 09:23:51 +0000 (09:23 +0000)
-k signal option

ChangeLog
configure.in
lib/Makefile.in
src/acl.cc
src/client_side.cc
src/comm.cc
src/dnsserver.cc
src/fqdncache.cc
src/main.cc
src/neighbors.cc
src/tools.cc

index bf75c9f8bd7e0949576fe33e516c3506b5a9689c..0f0975cb59df00f76fd5deaafaff2f78f13e0cfb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
+Changes to squid-1.1.alpha18:
+
        - Fixed storeCheckPurgeMem() to both 'purge' *and* 'release'
          objects as needed. 
+       - Fixed up RWStateCallbackAndFree() to prevent it from getting
+         called twice.
+       - Added 'deny_info' support for redirecting denied requests to
+         a specific URL (maex@space.net).  
+       - Fixed protoUnregister() to not abort objects being swapped in.
+       - Changed debug log timestamp format.
+       - Fixed coredump-causing bugs in icpHandleIMSReply().
+       - Fixed FMR bug in neighborsUdpAck() for UDP_HIT_OBJ replies.
+       - Fixed up InvokeHandlers() to clear handler before calling.
 
 Changes to squid-1.1.alpha17:
 
index e02ee6784f4cabb60e65d65170f5f5aa3ec9218b..eb5062ef7199171f042f3938bf69a3a5b9069a42 100644 (file)
@@ -3,13 +3,13 @@ dnl  Configuration input file for Squid
 dnl
 dnl  Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
 dnl
-dnl  $Id: configure.in,v 1.32 1996/09/03 19:24:00 wessels Exp $
+dnl  $Id: configure.in,v 1.33 1996/09/12 03:23:52 wessels Exp $
 dnl
 dnl
 dnl
 AC_INIT(src/main.c)
 AC_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.32 $)dnl
+AC_REVISION($Revision: 1.33 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AC_CONFIG_AUX_DIR(aux)
 
@@ -286,7 +286,6 @@ AC_CHECK_FUNCS(\
        setrlimit \
        setsid \
        sigaction \
-       socketpair \
        srand48 \
        strdup \
        sysconf \
index 6e1adbacc2062f8e72c2acf660434b87efbf294d..27824f667b28eb60d42ddacf2538d43265d20985 100644 (file)
@@ -3,7 +3,7 @@
 #
 #  Darren Hardy, hardy@cs.colorado.edu, April 1994
 #
-#  $Id: Makefile.in,v 1.12 1996/08/26 22:47:47 wessels Exp $
+#  $Id: Makefile.in,v 1.13 1996/09/12 03:23:59 wessels Exp $
 #
 prefix         = @prefix@
 srcdir         = @srcdir@
@@ -18,6 +18,7 @@ RANLIB                = @RANLIB@
 AC_CFLAGS      = @CFLAGS@
 LDFLAGS                = @LDFLAGS@
 XTRA_LIBS      = @XTRA_LIBS@
+RM             = @RM@
 
 INCLUDE                = -I../include -I$(srcdir)/../include
 UTILOBJS       = rfc850.o \
@@ -37,6 +38,7 @@ CFLAGS                = $(AC_CFLAGS) $(INCLUDE)
 all: $(LIBS)
 
 libmiscutil.a: $(UTILOBJS)
+       $(RM) -f $@
        ar r $@ $(UTILOBJS)
        $(RANLIB) $@
 
index f0ff2ff86233cdfb35872f44dc1c97806330d72b..ae015686cc7e15032b7e65171e632aab3b861c66 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: acl.cc,v 1.31 1996/09/11 22:41:10 wessels Exp $
+ * $Id: acl.cc,v 1.32 1996/09/12 03:24:00 wessels Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -942,7 +942,7 @@ void aclDestroyAcls()
     AclListTail = &AclList;
 }
 
-void aclDestroyAclList(list)
+static void aclDestroyAclList(list)
      struct _acl_list *list;
 {
     struct _acl_list *next = NULL;
index 238df753f0b6de131bab4976561fddaf548ca727..8aa5c381529e98b8a2d8ef4aee2ae80933e59cdd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.21 1996/09/12 00:32:33 wessels Exp $
+ * $Id: client_side.cc,v 1.22 1996/09/12 03:24:01 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -394,7 +394,7 @@ int icpProcessExpired(fd, icpState)
 }
 
 
-int icpHandleIMSReply(fd, entry, data)
+static int icpHandleIMSReply(fd, entry, data)
      int fd;
      StoreEntry *entry;
      void *data;
index e9f2d48d59e9209d050b74c873ebe6e5b06d7987..bf828fa2aab21214c992b4b0bbdd0c6ed628cf72 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.63 1996/09/12 00:31:34 wessels Exp $
+ * $Id: comm.cc,v 1.64 1996/09/12 03:24:02 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -204,10 +204,14 @@ u_short comm_local_port(fd)
     return fde->local_port;
 }
 
+#ifdef __STDC__
+static int commBind (int s, struct in_addr in_addr, u_short port)
+#else /* K&R C */
 static int commBind(s, in_addr, port)
      int s;
      struct in_addr in_addr;
      u_short port;
+#endif
 {
     struct sockaddr_in S;
 
@@ -226,11 +230,15 @@ static int commBind(s, in_addr, port)
 
 /* Create a socket. Default is blocking, stream (TCP) socket.  IO_TYPE
  * is OR of flags specified in comm.h. */
+#ifdef __STDC__
+int comm_open(unsigned int io_type, struct in_addr addr, u_short port, char *note)
+#else /* K&R C */
 int comm_open(io_type, addr, port, note)
      unsigned int io_type;
      struct in_addr addr;
      u_short port;
      char *note;
+#endif
 {
     int new_socket;
     FD_ENTRY *conn = NULL;
@@ -264,7 +272,7 @@ int comm_open(io_type, addr, port, note)
 
     if (!(io_type & COMM_NOCLOEXEC))
        commSetCloseOnExec(new_socket);
-    if (port > 0) {
+    if (port > (u_short) 0) {
        commSetNoLinger(new_socket);
        if (do_reuse)
            commSetReuseAddr(new_socket);
@@ -523,12 +531,17 @@ int comm_cleanup_fd_entry(fd)
 
 
 /* Send a udp datagram to specified PORT at HOST. */
+#ifdef __STDC__
+int
+comm_udp_send(int fd, char *host, u_short port, char *buf, int len)
+#else /* K&R C */
 int comm_udp_send(fd, host, port, buf, len)
      int fd;
      char *host;
      u_short port;
      char *buf;
      int len;
+#endif
 {
     struct hostent *hp = NULL;
     static struct sockaddr_in to_addr;
@@ -722,7 +735,7 @@ int comm_select(sec)
            return COMM_SHUTDOWN;
        if (shutdown_pending || reread_pending)
            debug(5, 2, "comm_select: Still waiting on %d FDs\n", nfds);
-       while (1) {
+       for (;;) {
 #if USE_ASYNC_IO
            /* Another CPU vs latency tradeoff for async IO */
            poll_time.tv_sec = 0;
index 8952dfc97d6845865c3f02b5ae719ab7c8ff0374..33075a1227a522d13e33a69d76e04da058452e61 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: dnsserver.cc,v 1.20 1996/09/11 22:41:12 wessels Exp $
+ * $Id: dnsserver.cc,v 1.21 1996/09/12 03:24:02 wessels Exp $
  *
  * DEBUG: section 0     DNS Resolver
  * AUTHOR: Harvest Derived
@@ -424,4 +424,5 @@ int main(argc, argv)
        }
     }
     /* NOTREACHED */
+    return 0;
 }
index 7a5d0a20c7184e56b6fbe5c699fe8fefe1c9302a..a07d317c5a438a990d6c2241b2f3b084a90fa45d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fqdncache.cc,v 1.15 1996/09/04 22:03:23 wessels Exp $
+ * $Id: fqdncache.cc,v 1.16 1996/09/12 03:24:03 wessels Exp $
  *
  * DEBUG: section 35    FQDN Cache
  * AUTHOR: Harvest Derived
@@ -559,7 +559,7 @@ static int fqdncache_dnsHandleRead(fd, dnsData)
            dnsData->ip_inbuf[0] = '\0';
            f = dnsData->data;
            f->name_count = x->name_count;
-           for (n = 0; n < f->name_count; n++)
+           for (n = 0; n < (int) f->name_count; n++)
                f->names[n] = x->names[n];
            f->error_message = x->error_message;
            f->status = x->status;
index 5d4b0b1bbef6374d7bea3b3b47d04dacde3ccd34..ccd60a51426a79b9eea4363667721fc37e81bfd7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: main.cc,v 1.69 1996/08/30 22:39:30 wessels Exp $
+ * $Id: main.cc,v 1.70 1996/09/12 03:24:06 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -118,6 +118,7 @@ int opt_foreground_rebuild = 0;
 int opt_zap_disk_store = 0;
 int opt_syslog_enable = 0;     /* disabled by default */
 int opt_no_ipcache = 0;                /* use ipcache by default */
+static int opt_send_signal = -1;/* no signal to send */
 int vhost_mode = 0;
 int unbuffered_logs = 1;       /* debug and hierarhcy unbuffered by default */
 int shutdown_pending = 0;      /* set by SIGTERM handler (shut_down()) */
@@ -151,16 +152,19 @@ static void mainReinitialize _PARAMS((void));
 static time_t mainMaintenance _PARAMS((void));
 static void usage _PARAMS((void));
 static void mainParseOptions _PARAMS((int, char **));
+static void sendSignal _PARAMS((void));
 
 static void usage()
 {
     fprintf(stderr, "\
-Usage: %s [-hsvzCDFRUVY] [-f config-file] [-[au] port]\n\
+Usage: %s [-hsvzCDFRUVY] [-f config-file] [-[au] port] [-k signal]\n\
        -a port   Specify ASCII port number (default: %d).\n\
        -f file   Use given config-file instead of\n\
                  %s\n\
-       -i        Disable IP caching.\n\
        -h        Print help message.\n\
+       -i        Disable IP caching.\n\
+       -k reconfigure|rotate|shutdown|kill|debug|check\n\
+                Send signal to running copy and exit.\n\
        -s        Enable logging to syslog.\n\
        -u port   Specify ICP port number (default: %d), disable with 0.\n\
        -v        Print version.\n\
@@ -183,7 +187,7 @@ static void mainParseOptions(argc, argv)
     extern char *optarg;
     int c;
 
-    while ((c = getopt(argc, argv, "CDFRUVYa:bf:him:su:vz?")) != -1) {
+    while ((c = getopt(argc, argv, "CDFRUVYa:bf:hik:m:su:vz?")) != -1) {
        switch (c) {
        case 'C':
            opt_catch_signals = 0;
@@ -222,6 +226,24 @@ static void mainParseOptions(argc, argv)
        case 'i':
            opt_no_ipcache = 1;
            break;
+       case 'k':
+           if (strlen(optarg) < 1)
+               usage();
+           if (!strncmp(optarg, "reconfigure", strlen(optarg)))
+               opt_send_signal = SIGHUP;
+           else if (!strncmp(optarg, "rotate", strlen(optarg)))
+               opt_send_signal = SIGUSR1;
+           else if (!strncmp(optarg, "debug", strlen(optarg)))
+               opt_send_signal = SIGUSR2;
+           else if (!strncmp(optarg, "shutdown", strlen(optarg)))
+               opt_send_signal = SIGTERM;
+           else if (!strncmp(optarg, "kill", strlen(optarg)))
+               opt_send_signal = SIGKILL;
+           else if (!strncmp(optarg, "check", strlen(optarg)))
+               opt_send_signal = 0;  /* SIGNULL */
+           else
+               usage();
+           break;
        case 'm':
 #if MALLOC_DBG
            malloc_debug_level = atoi(optarg);
@@ -253,7 +275,7 @@ static void mainParseOptions(argc, argv)
     }
 }
 
-void rotate_logs(sig)
+static void rotate_logs(sig)
      int sig;
 {
     debug(21, 1, "rotate_logs: SIGUSR1 received.\n");
@@ -263,7 +285,7 @@ void rotate_logs(sig)
 #endif
 }
 
-void reconfigure(sig)
+static void reconfigure(sig)
      int sig;
 {
     debug(21, 1, "reconfigure: SIGHUP received\n");
@@ -315,7 +337,7 @@ void serverConnectionsOpen()
        theHttpConnection);
 
     if (!httpd_accel_mode || Config.Accel.withProxy) {
-       if ((port = Config.Port.icp) > 0) {
+       if ((port = Config.Port.icp) > (u_short) 0) {
            theInIcpConnection = comm_open(COMM_NONBLOCKING | COMM_DGRAM,
                Config.Addrs.udp_incoming,
                port,
@@ -567,6 +589,12 @@ int main(argc, argv)
 
     mainParseOptions(argc, argv);
 
+    /* send signal to running copy and exit */
+    if (opt_send_signal != -1) {
+       sendSignal();
+       /* NOTREACHED */
+    }
+
     setMaxFD();
 
     if (opt_catch_signals)
@@ -644,3 +672,28 @@ int main(argc, argv)
     /* NOTREACHED */
     return 0;
 }
+
+static void sendSignal()
+{
+       int pid;
+       debug_log = stderr;
+       if (ConfigFile == NULL)
+           ConfigFile = xstrdup(DefaultConfigFile);
+       parseConfigFile(ConfigFile);
+       pid = readPidFile();
+       if (pid > 1) {
+           if (kill(pid, opt_send_signal) &&
+               /* ignore permissions if just running check */
+               !(opt_send_signal == 0 && errno == EPERM)) {
+               fprintf(stderr, "%s: ERROR: Could not send ", appname);
+               fprintf(stderr, "signal %d to process %d: %s\n",
+                       opt_send_signal, pid, xstrerror());
+               exit(1);
+           }
+       } else {
+           fprintf(stderr, "%s: ERROR: No running copy\n", appname);
+           exit(1);
+       }
+       /* signal successfully sent */
+       exit(0);
+    }
index 5a4d42bcdda6a9cc6692cc7a3e769d4d5428c2d9..bf7b5e71e2796ec4cf7db05e6b94ca61f60f4670 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: neighbors.cc,v 1.47 1996/09/12 00:31:12 wessels Exp $
+ * $Id: neighbors.cc,v 1.48 1996/09/12 03:24:06 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -264,7 +264,7 @@ edge *getFirstEdge()
     return friends->edges_head;
 }
 
-void neighborRemove(target)
+static void neighborRemove(target)
      edge *target;
 {
     edge *e = NULL;
index 05f4f61b65ddfa4a039cd21d6ed0aa12e6a2bdd7..782ad9e74aa1f65b3f4a55d8ced36a9a8f8597cf 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.53 1996/09/11 22:41:15 wessels Exp $
+ * $Id: tools.cc,v 1.54 1996/09/12 03:24:08 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -477,6 +477,32 @@ void writePidFile()
 }
 
 
+int readPidFile()
+{
+    FILE *pid_fp = NULL;
+    char *f = NULL;
+    int pid = -1;
+
+    if ((f = Config.pidFilename) == NULL) {
+       fprintf(stderr, "%s: ERROR: No pid file name defined\n", appname);
+       exit(1);
+    }
+    pid_fp = fopen(f, "r");
+    if (pid_fp != NULL) {
+       if (fscanf(pid_fp, "%d", &pid) != 1)
+           pid = 0;
+       fclose(pid_fp);
+    } else {
+       if (errno != ENOENT) {
+           fprintf(stderr, "%s: ERROR: Could not read pid file\n", appname);
+           fprintf(stderr, "\t%s: %s\n", f, xstrerror());
+           exit(1);
+       }
+    }
+    return pid;
+}
+
+
 void setMaxFD()
 {
 #if HAVE_SETRLIMIT