r4349 - in trunk/varnish-cache: bin/varnishd bin/varnishtest include/compat lib/libvarnishcompat
phk at projects.linpro.no
phk at projects.linpro.no
Mon Nov 16 10:35:10 CET 2009
Author: phk
Date: 2009-11-16 10:35:09 +0100 (Mon, 16 Nov 2009)
New Revision: 4349
Modified:
trunk/varnish-cache/bin/varnishd/cache_panic.c
trunk/varnish-cache/bin/varnishtest/flint.lnt
trunk/varnish-cache/bin/varnishtest/flint.sh
trunk/varnish-cache/bin/varnishtest/vtc.c
trunk/varnish-cache/bin/varnishtest/vtc_http.c
trunk/varnish-cache/bin/varnishtest/vtc_log.c
trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
trunk/varnish-cache/include/compat/execinfo.h
trunk/varnish-cache/lib/libvarnishcompat/execinfo.c
Log:
Hide GCC specific backtrace() compat function under a #ifdef.
We do not want to be dependent on GCC.
Fixes #577
Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_panic.c 2009-11-10 19:49:32 UTC (rev 4348)
+++ trunk/varnish-cache/bin/varnishd/cache_panic.c 2009-11-16 09:35:09 UTC (rev 4349)
@@ -271,6 +271,8 @@
size_t i;
size = backtrace (array, 10);
+ if (size == 0)
+ return;
vsb_printf(vsp, "Backtrace:\n");
for (i = 0; i < size; i++) {
vsb_printf (vsp, " ");
Modified: trunk/varnish-cache/bin/varnishtest/flint.lnt
===================================================================
--- trunk/varnish-cache/bin/varnishtest/flint.lnt 2009-11-10 19:49:32 UTC (rev 4348)
+++ trunk/varnish-cache/bin/varnishtest/flint.lnt 2009-11-16 09:35:09 UTC (rev 4349)
@@ -11,7 +11,18 @@
-esym(850, av)
+-esym(528, svnid)
+-ffc // No automatic custody
+
+-e712 // 14 Info 712 Loss of precision (___) (___ to ___)
+-e747 // 16 Info 747 Significant prototype coercion (___) ___ to ___
+
+
+
+
+
+
// -header(../../config.h)
// Fix strchr() semtics, it can only return NULL if arg2 != 0
Modified: trunk/varnish-cache/bin/varnishtest/flint.sh
===================================================================
--- trunk/varnish-cache/bin/varnishtest/flint.sh 2009-11-10 19:49:32 UTC (rev 4348)
+++ trunk/varnish-cache/bin/varnishtest/flint.sh 2009-11-16 09:35:09 UTC (rev 4349)
@@ -1,30 +1,9 @@
#!/bin/sh
-T=/tmp/_$$
flexelint \
-I/usr/include \
-I. \
-I../../include \
-I../.. \
flint.lnt \
- *.c > $T 2>&1
-
-for t in Error Warning Info Note
-do
- sed -n "/$t [0-9][0-9][0-9]:/s/.*\($t [0-9][0-9][0-9]\).*/\1/p" $T
-done | awk '
-$2 == 830 { next }
-$2 == 831 { next }
- {
- i=$2"_"$1
- h[i]++
- n++
- }
-END {
- printf "%5d %s\n", n, "Total"
- for (i in h)
- printf "%5d %s\n", h[i], i
- }
-' | sort -rn
-
-cat $T
+ *.c
Modified: trunk/varnish-cache/bin/varnishtest/vtc.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc.c 2009-11-10 19:49:32 UTC (rev 4348)
+++ trunk/varnish-cache/bin/varnishtest/vtc.c 2009-11-16 09:35:09 UTC (rev 4349)
@@ -52,7 +52,7 @@
char *vtc_desc;
int vtc_error; /* Error encountered */
int vtc_stop; /* Stops current test without error */
-pthread_t vtc_thread;;
+pthread_t vtc_thread;
/**********************************************************************
* Read a file into memory
Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_http.c 2009-11-10 19:49:32 UTC (rev 4348)
+++ trunk/varnish-cache/bin/varnishtest/vtc_http.c 2009-11-16 09:35:09 UTC (rev 4349)
@@ -39,7 +39,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
-#include <ctype.h>
#include "libvarnish.h"
#include "vct.h"
@@ -521,6 +520,7 @@
if (!strcmp(*av, "-body")) {
AZ(body);
REPLACE(body, av[1]);
+ AN(body);
av++;
bodylen = strlen(body);
for (b = body; *b != '\0'; b++) {
Modified: trunk/varnish-cache/bin/varnishtest/vtc_log.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_log.c 2009-11-10 19:49:32 UTC (rev 4348)
+++ trunk/varnish-cache/bin/varnishtest/vtc_log.c 2009-11-16 09:35:09 UTC (rev 4349)
@@ -33,7 +33,6 @@
#include <stdio.h>
#include <string.h>
-#include <ctype.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2009-11-10 19:49:32 UTC (rev 4348)
+++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2009-11-16 09:35:09 UTC (rev 4349)
@@ -103,7 +103,7 @@
if (i != 0) {
vtc_log(v->vl, 0, "CLI failed (%s) = %d %u %s",
cmd, i, retval, r);
- return (retval);
+ return ((enum cli_status_e)retval);
}
assert(i == 0);
vtc_dump(v->vl, 4, "CLI RX", r);
@@ -213,12 +213,13 @@
{
struct varnish *v;
char buf[BUFSIZ];
- struct pollfd fds[1];
+ struct pollfd *fds, fd;
int i;
CAST_OBJ_NOTNULL(v, priv, VARNISH_MAGIC);
TCP_nonblocking(v->fds[0]);
while (1) {
+ fds = &fd;
memset(fds, 0, sizeof fds);
fds->fd = v->fds[0];
fds->events = POLLIN;
@@ -406,7 +407,7 @@
return;
u = varnish_ask_cli(v, cli, NULL);
vtc_log(v->vl, 2, "CLI %03u <%s>", u, cli);
- if (exp != 0 && exp != u)
+ if (exp != 0 && exp != (unsigned)u)
vtc_log(v->vl, 0, "FAIL CLI response %u expected %u", u, exp);
}
@@ -616,7 +617,7 @@
}
if (!strcmp(*av, "-cliok")) {
AN(av[1]);
- varnish_cli(v, av[1], CLIS_OK);
+ varnish_cli(v, av[1], (unsigned)CLIS_OK);
av++;
continue;
}
Modified: trunk/varnish-cache/include/compat/execinfo.h
===================================================================
--- trunk/varnish-cache/include/compat/execinfo.h 2009-11-10 19:49:32 UTC (rev 4348)
+++ trunk/varnish-cache/include/compat/execinfo.h 2009-11-16 09:35:09 UTC (rev 4349)
@@ -35,7 +35,6 @@
int backtrace(void **, int);
char ** backtrace_symbols(void *const *, int);
-void backtrace_symbols_fd(void *const *, int, int);
#ifdef __cplusplus
}
Modified: trunk/varnish-cache/lib/libvarnishcompat/execinfo.c
===================================================================
--- trunk/varnish-cache/lib/libvarnishcompat/execinfo.c 2009-11-10 19:49:32 UTC (rev 4348)
+++ trunk/varnish-cache/lib/libvarnishcompat/execinfo.c 2009-11-16 09:35:09 UTC (rev 4349)
@@ -29,6 +29,10 @@
#include "svnid.h"
SVNID("$Id: execinfo.c,v 1.3 2004/07/19 05:21:09 sobomax Exp $")
+#include "compat/execinfo.h"
+
+#if defined (__GNUC__) && __GNUC__ >= 4 /* XXX Correct version to check for ? */
+
#include <sys/types.h>
#include <sys/uio.h>
#include <dlfcn.h>
@@ -39,10 +43,9 @@
#include <string.h>
#include <unistd.h>
-#include "compat/execinfo.h"
-void *getreturnaddr(int);
-void *getframeaddr(int);
+static void *getreturnaddr(int);
+static void *getframeaddr(int);
#define D10(x) ceil(log10(((x) == 0) ? 2 : ((x) + 1)))
@@ -133,51 +136,7 @@
return rval;
}
-#if 0
-void
-backtrace_symbols_fd(void *const *buffer, int size, int fd)
-{
- int i, len, offset;
- char *buf;
- Dl_info info;
-
- for (i = 0; i < size; i++) {
- if (dladdr(buffer[i], &info) != 0) {
- if (info.dli_sname == NULL)
- info.dli_sname = "???";
- if (info.dli_saddr == NULL)
- info.dli_saddr = buffer[i];
- offset = (const char *)buffer[i] - (const char *)info.dli_saddr;
- /* "0x01234567 <function+offset> at filename" */
- len = 2 + /* "0x" */
- (sizeof(void *) * 2) + /* "01234567" */
- 2 + /* " <" */
- strlen(info.dli_sname) + /* "function" */
- 1 + /* "+" */
- D10(offset) + /* "offset */
- 5 + /* "> at " */
- strlen(info.dli_fname) + /* "filename" */
- 2; /* "\n\0" */
- buf = alloca(len);
- if (buf == NULL)
- return;
- snprintf(buf, len, "%p <%s+%d> at %s\n",
- buffer[i], info.dli_sname, offset, info.dli_fname);
- } else {
- len = 2 + /* "0x" */
- (sizeof(void *) * 2) + /* "01234567" */
- 2; /* "\n\0" */
- buf = alloca(len);
- if (buf == NULL)
- return;
- snprintf(buf, len, "%p\n", buffer[i]);
- }
- write(fd, buf, len - 1);
- }
-}
-#endif
-
-void *
+static void *
getreturnaddr(int level)
{
@@ -314,7 +273,7 @@
}
}
-void *
+static void *
getframeaddr(int level)
{
@@ -450,3 +409,23 @@
default: return NULL;
}
}
+
+#else
+
+int
+backtrace(void **buffer, int size)
+{
+ (void)buffer;
+ (void)size;
+ return (0);
+}
+
+char **
+backtrace_symbols(void *const *buffer, int size)
+{
+ (void)buffer;
+ (void)size;
+ return (0);
+}
+
+#endif
More information about the varnish-commit
mailing list